[GTK] Fix combinations of PLATFORM(GTK) and OS(DARWIN)
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Nov 2015 14:23:21 +0000 (14:23 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Nov 2015 14:23:21 +0000 (14:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144560

Patch by Philip Chimento <philip.chimento@gmail.com> on 2015-11-01
Reviewed by Darin Adler.

Source/bmalloc:

* PlatformGTK.cmake: Added. This adds Zone.cpp to the PlatformGTK
build, on Darwin only. Since there was previously nothing for the
build system to do that was specific to the GTK platform in
bmalloc, we need to create this file.

Source/WebCore:

* platform/graphics/PlatformDisplay.cpp: Only include the
X11-specific GDK header on PLATFORM(X11). In other cases the
normal gdk.h header is needed, which would otherwise be pulled in
by gdkx.h.
* platform/graphics/opentype/OpenTypeMathData.cpp: Change check
for FourCharCode type from OS(DARWIN) to PLATFORM(COCOA). We
can't remove it altogether because OT_MAKE_TAG doesn't work for
all platforms.

Source/WebKit2:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
Change order of OS(DARWIN) and USE(UNIX_DOMAIN_SOCKETS) checks,
so that we can use Unix domain sockets even on Darwin for the GTK
platform.
* Platform/IPC/Attachment.cpp: Add USE(UNIX_DOMAIN_SOCKETS) check
to OS(DARWIN) check, in order to support GTK platform on OSX.
* Platform/IPC/Attachment.h: Change order of OS(DARWIN) and
USE(UNIX_DOMAIN_SOCKETS) checks throughout.
(IPC::Attachment::size):
(IPC::Attachment::releaseFileDescriptor):
(IPC::Attachment::fileDescriptor):
(IPC::Attachment::disposition):
(IPC::Attachment::port):
* Platform/IPC/Connection.h: Ditto.
(IPC::Connection::identifierIsNull):
(IPC::Connection::Identifier::Identifier):
(IPC::Connection::xpcConnection):
* Platform/IPC/unix/ConnectionUnix.cpp: Only use SOCK_SEQPACKET
if the platform is not GTK, because otherwise the PLATFORM(GTK)
check below is never reached.
* Platform/SharedMemory.h: Change order of OS(DARWIN) and
USE(UNIX_DOMAIN_SOCKETS) checks.
* PluginProcess/PluginProcess.cpp: Ditto.
(WebKit::PluginProcess::createWebProcessConnection):
* Shared/API/c/WKBase.h: Don't include WKBaseMac.h if building
GTK.
* UIProcess/API/C/WKNativeEvent.h: Don't use Apple API if
building GTK.
* UIProcess/Launcher/ProcessLauncher.cpp: Change to
OS(DARWIN) && !PLATFORM(GTK), in the absence of a better platform
macro such as USE(MACH).
(WebKit::ProcessLauncher::didFinishLaunchingProcess):
* UIProcess/Launcher/ProcessLauncher.h: Ditto.
* UIProcess/Network/NetworkProcessProxy.cpp: Change order of
OS(DARWIN) and PLATFORM(GTK) checks.
(WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch):
(WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
* UIProcess/Plugins/PluginProcessProxy.cpp: Ditto.
(WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch):
(WebKit::PluginProcessProxy::didCreateWebProcessConnection):
* WebProcess/Plugins/PluginProcessConnectionManager.cpp: Ditto.
(WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
* WebProcess/WebPage/WebInspector.cpp: Ditto.
(WebKit::WebInspector::createInspectorPage):
* WebProcess/WebPage/WebInspectorUI.cpp: Ditto.
(WebKit::WebInspectorUI::establishConnection):
* WebProcess/WebProcess.cpp: Ditto.
(WebKit::WebProcess::ensureNetworkProcessConnection):

Source/WTF:

* wtf/Platform.h: Don't USE(ACCELERATE) on PLATFORM(GTK).
* wtf/WorkQueue.h: Change order of OS(DARWIN) and PLATFORM(GTK)
checks so that GTK facilities are used even when building the
GTK platform on Darwin.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191856 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WTF/wtf/WorkQueue.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/PlatformDisplay.cpp
Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp
Source/WebKit2/NetworkProcess/NetworkProcess.cpp
Source/WebKit2/Platform/IPC/Attachment.cpp
Source/WebKit2/Platform/IPC/Attachment.h
Source/WebKit2/Platform/IPC/Connection.h
Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp
Source/WebKit2/Platform/SharedMemory.h
Source/WebKit2/PluginProcess/PluginProcess.cpp
Source/WebKit2/Shared/API/c/WKBase.h
Source/WebKit2/UIProcess/API/C/WKNativeEvent.h
Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp
Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp
Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp
Source/WebKit2/WebProcess/WebProcess.cpp
Source/bmalloc/ChangeLog
Source/bmalloc/PlatformGTK.cmake [new file with mode: 0644]

index cd4c21a..7c6648d 100644 (file)
@@ -1,3 +1,15 @@
+2015-11-01  Philip Chimento  <philip.chimento@gmail.com>
+
+        [GTK] Fix combinations of PLATFORM(GTK) and OS(DARWIN)
+        https://bugs.webkit.org/show_bug.cgi?id=144560
+
+        Reviewed by Darin Adler.
+
+        * wtf/Platform.h: Don't USE(ACCELERATE) on PLATFORM(GTK).
+        * wtf/WorkQueue.h: Change order of OS(DARWIN) and PLATFORM(GTK)
+        checks so that GTK facilities are used even when building the
+        GTK platform on Darwin.
+
 2015-11-01  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Use RunLoop::Timer in main thread shared timer GTK+ implementation
index 9ad7dc7..0232a49 100644 (file)
 #define HAVE_PTHREAD_SETNAME_NP 1
 #define HAVE_READLINE 1
 #define HAVE_SYS_TIMEB_H 1
-#define USE_ACCELERATE 1
 
+#if !PLATFORM(GTK)
+#define USE_ACCELERATE 1
+#endif
 #if !PLATFORM(IOS)
 #define HAVE_HOSTED_CORE_ANIMATION 1
 #endif
index 1f12d4b..51200bd 100644 (file)
@@ -34,7 +34,7 @@
 #include <wtf/RefCounted.h>
 #include <wtf/Threading.h>
 
-#if OS(DARWIN)
+#if OS(DARWIN) && !PLATFORM(GTK)
 #include <dispatch/dispatch.h>
 #endif
 
@@ -73,13 +73,13 @@ public:
 
     WTF_EXPORT_PRIVATE static void concurrentApply(size_t iterations, const std::function<void (size_t index)>&);
 
-#if OS(DARWIN)
-    dispatch_queue_t dispatchQueue() const { return m_dispatchQueue; }
-#elif PLATFORM(GTK)
+#if PLATFORM(GTK)
     GMainContext* mainContext() const { return m_eventContext.get(); }
 #elif PLATFORM(EFL)
     void registerSocketEventHandler(int, std::function<void ()>);
     void unregisterSocketEventHandler(int);
+#elif OS(DARWIN)
+    dispatch_queue_t dispatchQueue() const { return m_dispatchQueue; }
 #endif
 
 private:
@@ -101,15 +101,15 @@ private:
     static DWORD WINAPI unregisterWaitAndDestroyItemCallback(void* context);
 #endif
 
-#if OS(DARWIN)
-    static void executeFunction(void*);
-    dispatch_queue_t m_dispatchQueue;
-#elif PLATFORM(GTK)
+#if PLATFORM(GTK)
     ThreadIdentifier m_workQueueThread;
     GRefPtr<GMainContext> m_eventContext;
     GRefPtr<GMainLoop> m_eventLoop;
 #elif PLATFORM(EFL)
     RefPtr<DispatchQueue> m_dispatchQueue;
+#elif OS(DARWIN)
+    static void executeFunction(void*);
+    dispatch_queue_t m_dispatchQueue;
 #elif OS(WINDOWS)
     volatile LONG m_isWorkThreadRegistered;
 
index a667842..9bec401 100644 (file)
@@ -1,3 +1,19 @@
+2015-11-01  Philip Chimento  <philip.chimento@gmail.com>
+
+        [GTK] Fix combinations of PLATFORM(GTK) and OS(DARWIN)
+        https://bugs.webkit.org/show_bug.cgi?id=144560
+
+        Reviewed by Darin Adler.
+
+        * platform/graphics/PlatformDisplay.cpp: Only include the
+        X11-specific GDK header on PLATFORM(X11). In other cases the
+        normal gdk.h header is needed, which would otherwise be pulled in
+        by gdkx.h.
+        * platform/graphics/opentype/OpenTypeMathData.cpp: Change check
+        for FourCharCode type from OS(DARWIN) to PLATFORM(COCOA). We
+        can't remove it altogether because OT_MAKE_TAG doesn't work for
+        all platforms.
+
 2015-11-01  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Use RunLoop::Timer in main thread shared timer GTK+ implementation
index e39ce2c..19a6b99 100644 (file)
 #endif
 
 #if PLATFORM(GTK)
-#if PLATFORM(X11)
+#include <gdk/gdk.h>
+#endif
+
+#if PLATFORM(GTK) && PLATFORM(X11)
 #include <gdk/gdkx.h>
 #endif
-#if PLATFORM(WAYLAND) && !defined(GTK_API_VERSION_2)
+
+#if PLATFORM(GTK) && PLATFORM(WAYLAND) && !defined(GTK_API_VERSION_2)
 #include <gdk/gdkwayland.h>
 #endif
-#endif // PLATFORM(GTK)
 
 #if PLATFORM(EFL) && defined(HAVE_ECORE_X)
 #include <Ecore_X.h>
index 1eb1810..d539688 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore {
 #if ENABLE(OPENTYPE_MATH)
 namespace OpenType {
 
-#if OS(DARWIN)
+#if PLATFORM(COCOA)
 const FourCharCode MATHTag = 'MATH';
 #else
 const uint32_t MATHTag = OT_MAKE_TAG('M', 'A', 'T', 'H');
index 7df676a..3a58da2 100644 (file)
@@ -1,3 +1,60 @@
+2015-11-01  Philip Chimento  <philip.chimento@gmail.com>
+
+        [GTK] Fix combinations of PLATFORM(GTK) and OS(DARWIN)
+        https://bugs.webkit.org/show_bug.cgi?id=144560
+
+        Reviewed by Darin Adler.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
+        Change order of OS(DARWIN) and USE(UNIX_DOMAIN_SOCKETS) checks,
+        so that we can use Unix domain sockets even on Darwin for the GTK
+        platform.
+        * Platform/IPC/Attachment.cpp: Add USE(UNIX_DOMAIN_SOCKETS) check
+        to OS(DARWIN) check, in order to support GTK platform on OSX.
+        * Platform/IPC/Attachment.h: Change order of OS(DARWIN) and
+        USE(UNIX_DOMAIN_SOCKETS) checks throughout.
+        (IPC::Attachment::size):
+        (IPC::Attachment::releaseFileDescriptor):
+        (IPC::Attachment::fileDescriptor):
+        (IPC::Attachment::disposition):
+        (IPC::Attachment::port): 
+        * Platform/IPC/Connection.h: Ditto.
+        (IPC::Connection::identifierIsNull):
+        (IPC::Connection::Identifier::Identifier): 
+        (IPC::Connection::xpcConnection): 
+        * Platform/IPC/unix/ConnectionUnix.cpp: Only use SOCK_SEQPACKET
+        if the platform is not GTK, because otherwise the PLATFORM(GTK)
+        check below is never reached.
+        * Platform/SharedMemory.h: Change order of OS(DARWIN) and
+        USE(UNIX_DOMAIN_SOCKETS) checks.
+        * PluginProcess/PluginProcess.cpp: Ditto.
+        (WebKit::PluginProcess::createWebProcessConnection):
+        * Shared/API/c/WKBase.h: Don't include WKBaseMac.h if building
+        GTK.
+        * UIProcess/API/C/WKNativeEvent.h: Don't use Apple API if
+        building GTK.
+        * UIProcess/Launcher/ProcessLauncher.cpp: Change to
+        OS(DARWIN) && !PLATFORM(GTK), in the absence of a better platform
+        macro such as USE(MACH).
+        (WebKit::ProcessLauncher::didFinishLaunchingProcess):
+        * UIProcess/Launcher/ProcessLauncher.h: Ditto.
+        * UIProcess/Network/NetworkProcessProxy.cpp: Change order of
+        OS(DARWIN) and PLATFORM(GTK) checks.
+        (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch):
+        (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
+        * UIProcess/Plugins/PluginProcessProxy.cpp: Ditto.
+        (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch):
+        (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
+        * WebProcess/Plugins/PluginProcessConnectionManager.cpp: Ditto.
+        (WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
+        * WebProcess/WebPage/WebInspector.cpp: Ditto.
+        (WebKit::WebInspector::createInspectorPage):
+        * WebProcess/WebPage/WebInspectorUI.cpp: Ditto.
+        (WebKit::WebInspectorUI::establishConnection):
+        * WebProcess/WebProcess.cpp: Ditto.
+        (WebKit::WebProcess::ensureNetworkProcessConnection):
+
 2015-11-01  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Use RunLoop::Timer in PluginInfoCache
index 411ffb4..f0bcc03 100644 (file)
@@ -184,7 +184,11 @@ void DatabaseProcess::performNextDatabaseTask()
 
 void DatabaseProcess::createDatabaseToWebProcessConnection()
 {
-#if OS(DARWIN)
+#if USE(UNIX_DOMAIN_SOCKETS)
+    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
+    m_databaseToWebProcessConnections.append(DatabaseToWebProcessConnection::create(socketPair.server));
+    parentProcessConnection()->send(Messages::DatabaseProcessProxy::DidCreateDatabaseToWebProcessConnection(IPC::Attachment(socketPair.client)), 0);
+#elif OS(DARWIN)
     // Create the listening port.
     mach_port_t listeningPort;
     mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort);
@@ -195,10 +199,6 @@ void DatabaseProcess::createDatabaseToWebProcessConnection()
 
     IPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND);
     parentProcessConnection()->send(Messages::DatabaseProcessProxy::DidCreateDatabaseToWebProcessConnection(clientPort), 0);
-#elif USE(UNIX_DOMAIN_SOCKETS)
-    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
-    m_databaseToWebProcessConnections.append(DatabaseToWebProcessConnection::create(socketPair.server));
-    parentProcessConnection()->send(Messages::DatabaseProcessProxy::DidCreateDatabaseToWebProcessConnection(IPC::Attachment(socketPair.client)), 0);
 #else
     notImplemented();
 #endif
index 496f5c0..321b927 100644 (file)
@@ -233,7 +233,15 @@ void NetworkProcess::initializeConnection(IPC::Connection* connection)
 
 void NetworkProcess::createNetworkConnectionToWebProcess()
 {
-#if OS(DARWIN)
+#if USE(UNIX_DOMAIN_SOCKETS)
+    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
+
+    RefPtr<NetworkConnectionToWebProcess> connection = NetworkConnectionToWebProcess::create(socketPair.server);
+    m_webProcessConnections.append(connection.release());
+
+    IPC::Attachment clientSocket(socketPair.client);
+    parentProcessConnection()->send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientSocket), 0);
+#elif OS(DARWIN)
     // Create the listening port.
     mach_port_t listeningPort;
     mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort);
@@ -244,14 +252,6 @@ void NetworkProcess::createNetworkConnectionToWebProcess()
 
     IPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND);
     parentProcessConnection()->send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientPort), 0);
-#elif USE(UNIX_DOMAIN_SOCKETS)
-    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
-
-    RefPtr<NetworkConnectionToWebProcess> connection = NetworkConnectionToWebProcess::create(socketPair.server);
-    m_webProcessConnections.append(connection.release());
-
-    IPC::Attachment clientSocket(socketPair.client);
-    parentProcessConnection()->send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientSocket), 0);
 #else
     notImplemented();
 #endif
index be08b1f..210dbd7 100644 (file)
@@ -36,7 +36,7 @@ Attachment::Attachment()
 {
 }
 
-#if OS(DARWIN)
+#if OS(DARWIN) && !USE(UNIX_DOMAIN_SOCKETS)
 Attachment::Attachment(mach_port_name_t port, mach_msg_type_name_t disposition)
     : m_type(MachPortType)
     , m_port(port)
index 1922409..10e66c2 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef Attachment_h
 #define Attachment_h
 
-#if OS(DARWIN)
+#if OS(DARWIN) && !USE(UNIX_DOMAIN_SOCKETS)
 #include <mach/mach_init.h>
 #include <mach/mach_traps.h>
 #endif
@@ -42,38 +42,37 @@ public:
 
     enum Type {
         Uninitialized,
-#if OS(DARWIN)
-        MachPortType,
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
         SocketType,
-        MappedMemoryType
+        MappedMemoryType,
+#elif OS(DARWIN)
+        MachPortType
 #endif
     };
 
-#if OS(DARWIN)
-    Attachment(mach_port_name_t port, mach_msg_type_name_t disposition);
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     Attachment(Attachment&&);
     Attachment& operator=(Attachment&&);
     Attachment(int fileDescriptor, size_t);
     Attachment(int fileDescriptor);
     ~Attachment();
+#elif OS(DARWIN)
+    Attachment(mach_port_name_t, mach_msg_type_name_t disposition);
 #endif
 
     Type type() const { return m_type; }
 
-#if OS(DARWIN)
+#if USE(UNIX_DOMAIN_SOCKETS)
+    size_t size() const { return m_size; }
+
+    int releaseFileDescriptor() { int temp = m_fileDescriptor; m_fileDescriptor = -1; return temp; }
+    int fileDescriptor() const { return m_fileDescriptor; }
+#elif OS(DARWIN)
     void release();
 
     // MachPortType
     mach_port_name_t port() const { return m_port; }
     mach_msg_type_name_t disposition() const { return m_disposition; }
-
-#elif USE(UNIX_DOMAIN_SOCKETS)
-    size_t size() const { return m_size; }
-
-    int releaseFileDescriptor() { int temp = m_fileDescriptor; m_fileDescriptor = -1; return temp; }
-    int fileDescriptor() const { return m_fileDescriptor; }
 #endif
 
     void encode(ArgumentEncoder&) const;
@@ -82,12 +81,12 @@ public:
 private:
     Type m_type;
 
-#if OS(DARWIN)
-    mach_port_name_t m_port;
-    mach_msg_type_name_t m_disposition;
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     int m_fileDescriptor { -1 };
     size_t m_size;
+#elif OS(DARWIN)
+    mach_port_name_t m_port;
+    mach_msg_type_name_t m_disposition;
 #endif
 };
 
index f3466e2..8c9cc91 100644 (file)
@@ -42,7 +42,7 @@
 #include <wtf/WorkQueue.h>
 #include <wtf/text/CString.h>
 
-#if OS(DARWIN)
+#if OS(DARWIN) && !USE(UNIX_DOMAIN_SOCKETS)
 #include <mach/mach_port.h>
 #include <wtf/OSObjectPtr.h>
 #include <wtf/spi/darwin/XPCSPI.h>
@@ -104,7 +104,22 @@ public:
     class WorkQueueMessageReceiver : public MessageReceiver, public ThreadSafeRefCounted<WorkQueueMessageReceiver> {
     };
 
-#if OS(DARWIN)
+#if USE(UNIX_DOMAIN_SOCKETS)
+    typedef int Identifier;
+    static bool identifierIsNull(Identifier identifier) { return identifier == -1; }
+
+    struct SocketPair {
+        int client;
+        int server;
+    };
+
+    enum ConnectionOptions {
+        SetCloexecOnClient = 1 << 0,
+        SetCloexecOnServer = 1 << 1,
+    };
+
+    static Connection::SocketPair createPlatformConnection(unsigned options = SetCloexecOnClient | SetCloexecOnServer);
+#elif OS(DARWIN)
     struct Identifier {
         Identifier()
             : port(MACH_PORT_NULL)
@@ -129,21 +144,6 @@ public:
     xpc_connection_t xpcConnection() const { return m_xpcConnection.get(); }
     bool getAuditToken(audit_token_t&);
     pid_t remoteProcessID() const;
-#elif USE(UNIX_DOMAIN_SOCKETS)
-    typedef int Identifier;
-    static bool identifierIsNull(Identifier identifier) { return identifier == -1; }
-
-    struct SocketPair {
-        int client;
-        int server;
-    };
-
-    enum ConnectionOptions {
-        SetCloexecOnClient = 1 << 0,
-        SetCloexecOnServer = 1 << 1,
-    };
-
-    static Connection::SocketPair createPlatformConnection(unsigned options = SetCloexecOnClient | SetCloexecOnServer);
 #endif
 
     static Ref<Connection> createServerConnection(Identifier, Client&);
@@ -326,7 +326,20 @@ private:
     bool m_shouldBoostMainThreadOnSyncMessage { false };
 #endif
 
-#if OS(DARWIN)
+#if USE(UNIX_DOMAIN_SOCKETS)
+    // Called on the connection queue.
+    void readyReadHandler();
+    bool processMessage();
+
+    Vector<uint8_t> m_readBuffer;
+    size_t m_readBufferSize;
+    Vector<int> m_fileDescriptors;
+    size_t m_fileDescriptorsSize;
+    int m_socketDescriptor;
+#if PLATFORM(GTK)
+    GMainLoopSource m_socketEventSource;
+#endif
+#elif OS(DARWIN)
     // Called on the connection queue.
     void receiveSourceEventHandler();
     void initializeDeadNameSource();
@@ -347,20 +360,6 @@ private:
 #endif
 
     OSObjectPtr<xpc_connection_t> m_xpcConnection;
-
-#elif USE(UNIX_DOMAIN_SOCKETS)
-    // Called on the connection queue.
-    void readyReadHandler();
-    bool processMessage();
-
-    Vector<uint8_t> m_readBuffer;
-    size_t m_readBufferSize;
-    Vector<int> m_fileDescriptors;
-    size_t m_fileDescriptorsSize;
-    int m_socketDescriptor;
-#if PLATFORM(GTK)
-    GMainLoopSource m_socketEventSource;
-#endif
 #endif
 };
 
index 21792ff..69da26f 100644 (file)
@@ -43,7 +43,7 @@
 #include <gio/gio.h>
 #endif
 
-#ifdef SOCK_SEQPACKET
+#if defined(SOCK_SEQPACKET) && !PLATFORM(GTK)
 #define SOCKET_TYPE SOCK_SEQPACKET
 #else
 #if PLATFORM(GTK)
index f127b35..be07554 100644 (file)
@@ -74,11 +74,11 @@ public:
 #endif
     private:
         friend class SharedMemory;
-#if OS(DARWIN)
+#if USE(UNIX_DOMAIN_SOCKETS)
+        mutable IPC::Attachment m_attachment;
+#elif OS(DARWIN)
         mutable mach_port_t m_port;
         size_t m_size;
-#elif USE(UNIX_DOMAIN_SOCKETS)
-        mutable IPC::Attachment m_attachment;
 #endif
     };
 
@@ -112,11 +112,11 @@ private:
     void* m_data;
     Protection m_protection;
 
-#if OS(DARWIN)
-    mach_port_t m_port;
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     int m_fileDescriptor;
     bool m_isWrappingMap { false };
+#elif OS(DARWIN)
+    mach_port_t m_port;
 #endif
 };
 
index 10b3ed4..40bf7c5 100644 (file)
@@ -148,7 +148,15 @@ void PluginProcess::createWebProcessConnection()
 {
     bool didHaveAnyWebProcessConnections = !m_webProcessConnections.isEmpty();
 
-#if OS(DARWIN)
+#if USE(UNIX_DOMAIN_SOCKETS)
+    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
+
+    RefPtr<WebProcessConnection> connection = WebProcessConnection::create(socketPair.server);
+    m_webProcessConnections.append(connection.release());
+
+    IPC::Attachment clientSocket(socketPair.client);
+    parentProcessConnection()->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientSocket, m_supportsAsynchronousPluginInitialization), 0);
+#elif OS(DARWIN)
     // Create the listening port.
     mach_port_t listeningPort;
     mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort);
@@ -167,14 +175,6 @@ void PluginProcess::createWebProcessConnection()
 
     IPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND);
     parentProcessConnection()->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientPort, m_supportsAsynchronousPluginInitialization), 0);
-#elif USE(UNIX_DOMAIN_SOCKETS)
-    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
-
-    RefPtr<WebProcessConnection> connection = WebProcessConnection::create(socketPair.server);
-    m_webProcessConnections.append(connection.release());
-
-    IPC::Attachment clientSocket(socketPair.client);
-    parentProcessConnection()->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientSocket, m_supportsAsynchronousPluginInitialization), 0);
 #else
     notImplemented();
 #endif
index c6b12c6..ec9f1d8 100644 (file)
@@ -42,7 +42,7 @@
 #include <WebKit/WKBaseEfl.h>
 #endif
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && !defined(BUILDING_GTK__)
 #include <WebKit/WKBaseMac.h>
 #endif
 
index 3495826..7d8b6b9 100644 (file)
@@ -34,7 +34,7 @@
 extern "C" {
 #endif
 
-#if defined(__APPLE__) && !TARGET_OS_IPHONE
+#if defined(__APPLE__) && !TARGET_OS_IPHONE && !defined(BUILDING_GTK__)
 #ifdef __OBJC__
 @class NSEvent;
 #elif __cplusplus
index cbfab7b..604e9d8 100644 (file)
@@ -134,10 +134,10 @@ void DatabaseProcessProxy::didClose(IPC::Connection&)
     while (!m_pendingConnectionReplies.isEmpty()) {
         auto reply = m_pendingConnectionReplies.takeFirst();
 
-#if OS(DARWIN)
-        reply->send(IPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND));
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
         reply->send(IPC::Attachment());
+#elif OS(DARWIN)
+        reply->send(IPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND));
 #else
         notImplemented();
 #endif
@@ -169,10 +169,10 @@ void DatabaseProcessProxy::didCreateDatabaseToWebProcessConnection(const IPC::At
 
     RefPtr<Messages::WebProcessProxy::GetDatabaseProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
 
-#if OS(DARWIN)
-    reply->send(IPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND));
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     reply->send(connectionIdentifier);
+#elif OS(DARWIN)
+    reply->send(IPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND));
 #else
     notImplemented();
 #endif
index b481eb1..76ea71f 100644 (file)
@@ -58,7 +58,8 @@ void ProcessLauncher::didFinishLaunchingProcess(PlatformProcessIdentifier proces
     
     if (!m_client) {
         // FIXME: Make Identifier a move-only object and release port rights/connections in the destructor.
-#if OS(DARWIN)
+#if OS(DARWIN) && !PLATFORM(GTK)
+        // FIXME: Should really be something like USE(MACH)
         if (identifier.port)
             mach_port_mod_refs(mach_task_self(), identifier.port, MACH_PORT_RIGHT_RECEIVE, -1);
 #endif
index 8ec1d30..fe7da8e 100644 (file)
@@ -61,7 +61,7 @@ public:
     struct LaunchOptions {
         ProcessType processType;
         HashMap<String, String> extraInitializationData;
-#if OS(DARWIN)
+#if OS(DARWIN) && !PLATFORM(GTK)
         static const cpu_type_t MatchCurrentArchitecture = 0;
         cpu_type_t architecture;
         bool executableHeap;
index be1c0da..969867e 100644 (file)
@@ -170,10 +170,10 @@ void NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch()
     while (!m_pendingConnectionReplies.isEmpty()) {
         RefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
 
-#if OS(DARWIN)
-        reply->send(IPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND));
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
         reply->send(IPC::Attachment());
+#elif OS(DARWIN)
+        reply->send(IPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND));
 #else
         notImplemented();
 #endif
@@ -236,10 +236,10 @@ void NetworkProcessProxy::didCreateNetworkConnectionToWebProcess(const IPC::Atta
     // Grab the first pending connection reply.
     RefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
 
-#if OS(DARWIN)
-    reply->send(IPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND));
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     reply->send(connectionIdentifier);
+#elif OS(DARWIN)
+    reply->send(IPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND));
 #else
     notImplemented();
 #endif
index 3f85b4c..02741e5 100644 (file)
@@ -155,10 +155,10 @@ void PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch()
     while (!m_pendingConnectionReplies.isEmpty()) {
         RefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
 
-#if OS(DARWIN)
-        reply->send(IPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND), false);
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
         reply->send(IPC::Attachment(), false);
+#elif OS(DARWIN)
+        reply->send(IPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND), false);
 #else
         notImplemented();
 #endif
@@ -269,10 +269,10 @@ void PluginProcessProxy::didCreateWebProcessConnection(const IPC::Attachment& co
     // Grab the first pending connection reply.
     RefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
 
-#if OS(DARWIN)
-    reply->send(IPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND), supportsAsynchronousPluginInitialization);
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     reply->send(connectionIdentifier, supportsAsynchronousPluginInitialization);
+#elif OS(DARWIN)
+    reply->send(IPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND), supportsAsynchronousPluginInitialization);
 #else
     notImplemented();
 #endif
index 29e31b5..4afd106 100644 (file)
@@ -36,7 +36,7 @@
 #include "WebProcess.h"
 #include "WebProcessProxyMessages.h"
 
-#if OS(DARWIN)
+#if OS(DARWIN) && !USE(UNIX_DOMAIN_SOCKETS)
 #include "MachPort.h"
 #endif
 
@@ -74,10 +74,10 @@ PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnect
                                                      Messages::WebProcessProxy::GetPluginProcessConnection::Reply(encodedConnectionIdentifier, supportsAsynchronousInitialization), 0))
         return 0;
 
-#if OS(DARWIN)
-    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     IPC::Connection::Identifier connectionIdentifier = encodedConnectionIdentifier.releaseFileDescriptor();
+#elif OS(DARWIN)
+    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
 #endif
     if (IPC::Connection::identifierIsNull(connectionIdentifier))
         return nullptr;
index b2dd6b0..7337ac4 100644 (file)
@@ -72,16 +72,16 @@ WebInspector::~WebInspector()
 // Called from WebInspectorClient
 void WebInspector::openFrontendConnection(bool underTest)
 {
-#if OS(DARWIN)
+#if USE(UNIX_DOMAIN_SOCKETS)
+    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
+    IPC::Connection::Identifier connectionIdentifier(socketPair.server);
+    IPC::Attachment connectionClientPort(socketPair.client);
+#elif OS(DARWIN)
     mach_port_t listeningPort;
     mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort);
 
     IPC::Connection::Identifier connectionIdentifier(listeningPort);
     IPC::Attachment connectionClientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND);
-#elif USE(UNIX_DOMAIN_SOCKETS)
-    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
-    IPC::Connection::Identifier connectionIdentifier(socketPair.server);
-    IPC::Attachment connectionClientPort(socketPair.client);
 #else
     notImplemented();
     return;
index 83306a6..341838a 100644 (file)
@@ -54,10 +54,10 @@ WebInspectorUI::WebInspectorUI(WebPage& page)
 
 void WebInspectorUI::establishConnection(IPC::Attachment encodedConnectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest)
 {
-#if OS(DARWIN)
-    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.releaseFileDescriptor());
+#elif OS(DARWIN)
+    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
 #else
     notImplemented();
     return;
index e2d23b5..ede5414 100644 (file)
@@ -409,10 +409,10 @@ void WebProcess::ensureNetworkProcessConnection()
         Messages::WebProcessProxy::GetNetworkProcessConnection::Reply(encodedConnectionIdentifier), 0))
         return;
 
-#if OS(DARWIN)
-    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     IPC::Connection::Identifier connectionIdentifier = encodedConnectionIdentifier.releaseFileDescriptor();
+#elif OS(DARWIN)
+    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
 #else
     ASSERT_NOT_REACHED();
 #endif
@@ -1092,10 +1092,10 @@ void WebProcess::ensureWebToDatabaseProcessConnection()
         Messages::WebProcessProxy::GetDatabaseProcessConnection::Reply(encodedConnectionIdentifier), 0))
         return;
 
-#if OS(DARWIN)
-    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
-#elif USE(UNIX_DOMAIN_SOCKETS)
+#if USE(UNIX_DOMAIN_SOCKETS)
     IPC::Connection::Identifier connectionIdentifier = encodedConnectionIdentifier.releaseFileDescriptor();
+#elif OS(DARWIN)
+    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
 #else
     ASSERT_NOT_REACHED();
 #endif
index 9360193..c40b8b0 100644 (file)
@@ -1,3 +1,15 @@
+2015-11-01  Philip Chimento  <philip.chimento@gmail.com>
+
+        [GTK] Fix combinations of PLATFORM(GTK) and OS(DARWIN)
+        https://bugs.webkit.org/show_bug.cgi?id=144560
+
+        Reviewed by Darin Adler.
+
+        * PlatformGTK.cmake: Added. This adds Zone.cpp to the PlatformGTK
+        build, on Darwin only. Since there was previously nothing for the
+        build system to do that was specific to the GTK platform in
+        bmalloc, we need to create this file.
+
 2015-10-29  Geoffrey Garen  <ggaren@apple.com>
 
         bmalloc: AsyncTask should handle destruction
diff --git a/Source/bmalloc/PlatformGTK.cmake b/Source/bmalloc/PlatformGTK.cmake
new file mode 100644 (file)
index 0000000..d551010
--- /dev/null
@@ -0,0 +1,5 @@
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+    list(APPEND bmalloc_SOURCES
+        bmalloc/Zone.cpp
+    )
+endif ()