WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-110978-20131004160342.patch (text/plain), 33.24 KB, created by
Csaba Osztrogonác
on 2013-10-04 07:03:28 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Csaba Osztrogonác
Created:
2013-10-04 07:03:28 PDT
Size:
33.24 KB
patch
obsolete
>Subversion Revision: 156886 >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 3bb619fb6be6ba401d8cd7c1ead60ba44d771833..bb931d6123c33cd1913a738a39f55c89df2db937 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,103 @@ >+2013-10-04 Csaba Osztrogonác <ossy@webkit.org> >+ >+ [WK2] Refactoring: unify IPC connection creation - get rid of ifdef hell >+ https://bugs.webkit.org/show_bug.cgi?id=110978 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Original patch by Balazs Kelemen <kbalazs@webkit.org> and Kwang Yul Seo <skyul@company100.net>. >+ >+ Get rid of platform ifdefs dealing with IPC connection setup. Introduce >+ Connection::createPlatformConnection and Connection::ConnectionDescriptor to >+ contain the platform specific logic of creating an IPC channel, and extend >+ Attachment to hide the details of exchaning IPC endpoints across processes. >+ The patch also unifies some specifics about the way we handle unix domain sockets. >+ >+ The following things were fixed by Csaba Osztrogonác: >+ - Remove the SharedWorkerProcess change, because it doesn't exist at all after r156277. >+ - Resolve a trivial conflict in ProcessLauncherEfl.cpp after r156063. >+ - Resolve a trivial conflict in Source/WebKit2/Platform/CoreIPC/Connection.h after r156508. >+ - Remove Windows related changes after r156508. >+ - Remove Qt related changes >+ - Resolve trivial conflicts in ArgumentDecoder.h and ArgumentEncoder.h. >+ - Remove obsolete change in ProcessLauncherGtk.cpp >+ >+ * NetworkProcess/NetworkProcess.cpp: >+ (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): >+ Get rid of platform specific logic in favor of the new interface. >+ >+ * Platform/CoreIPC/ArgumentDecoder.cpp: >+ * Platform/CoreIPC/ArgumentDecoder.h: >+ * Platform/CoreIPC/ArgumentEncoder.cpp: >+ * Platform/CoreIPC/ArgumentEncoder.h: >+ Including Attachment.h in Argument[Encoder/Decoder].h would cause >+ a circular dependency now, so I changed it to forward declaration >+ and add includes where it is used. >+ * Platform/CoreIPC/Attachment.cpp: >+ (CoreIPC::messageDisposition): >+ (CoreIPC::Attachment::Attachment): >+ (CoreIPC::Attachment::nullConnection): >+ (CoreIPC::Attachment::connectionIdentifier): >+ * Platform/CoreIPC/Attachment.h: >+ (CoreIPC::Attachment::Attachment): >+ >+ * Platform/CoreIPC/Connection.h: >+ (CoreIPC::Connection::identifierIsNull): It was simply wrong. >+ The invalid file descriptor is -1 and not 0. >+ (CoreIPC::Connection::ConnectionDescriptor::ConnectionDescriptor): >+ Very basic platform abstraction of an IPC channel. >+ * Platform/CoreIPC/MessageDecoder.cpp: >+ * Platform/CoreIPC/MessageEncoder.cpp: >+ >+ * Platform/CoreIPC/mac/ConnectionMac.cpp: >+ (CoreIPC::Connection::ConnectionDescriptor::serverIdentifier): >+ (CoreIPC::Connection::ConnectionDescriptor::clientIdentifier): >+ These are the same on Mac. >+ (CoreIPC::Connection::createPlatformConnection): >+ Creates the OS specific IPC channel. >+ >+ * Platform/CoreIPC/unix/AttachmentUnix.cpp: >+ (CoreIPC::Attachment::Attachment): >+ (CoreIPC::Attachment::nullConnection): >+ (CoreIPC::Attachment::connectionIdentifier): >+ ConnectionRequirement is not respected here since the concept of moving socket rights >+ across proesses is handled via control messages in ConnectionUnix.cpp. >+ >+ * Platform/CoreIPC/unix/ConnectionUnix.cpp: >+ (CoreIPC::Connection::ConnectionDescriptor::serverIdentifier): >+ (CoreIPC::Connection::ConnectionDescriptor::clientIdentifier): >+ (CoreIPC::Connection::createPlatformConnection): >+ Common implementation for socket creation. I turned error handling to RELEASE_ASSERT's >+ since errors was never handled anyway and there is no good way to do. >+ >+ * PluginProcess/PluginProcess.cpp: >+ (WebKit::PluginProcess::createWebProcessConnection): >+ Change platform specific logic in favor of the new interface. >+ >+ * UIProcess/Launcher/efl/ProcessLauncherEfl.cpp: >+ (WebKit::ProcessLauncher::launchProcess): >+ Use the new interface. Removed the close call from the child side >+ of the fork because FD_CLOEXEC handles that automatically. >+ >+ * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp: >+ (WebKit::childSetupFunction): Removed the close call since FD_CLOEXEC handles that. >+ (WebKit::ProcessLauncher::launchProcess): Use the new interface. >+ >+ * UIProcess/Network/NetworkProcessProxy.cpp: >+ (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch): >+ (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess): >+ Use the new interface. >+ * UIProcess/Plugins/PluginProcessProxy.cpp: >+ (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch): >+ (WebKit::PluginProcessProxy::didCreateWebProcessConnection): >+ Use the new interface. >+ * WebProcess/Plugins/PluginProcessConnectionManager.cpp: >+ (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): >+ Use the new interface. >+ * WebProcess/WebProcess.cpp: >+ (WebKit::WebProcess::ensureNetworkProcessConnection): >+ Use the new interface. >+ > 2013-10-03 Mark Rowe <mrowe@apple.com> > > REGRESSION (r155787): WebKitTestRunner rebuilds from scratch when doing an incremental build >diff --git a/Source/WebKit2/NetworkProcess/NetworkProcess.cpp b/Source/WebKit2/NetworkProcess/NetworkProcess.cpp >index 4449e1735c90d41b7127b0b9679bec39968592f1..acaa076f5361b2164cfd062e6132e24a0ee3fa90 100644 >--- a/Source/WebKit2/NetworkProcess/NetworkProcess.cpp >+++ b/Source/WebKit2/NetworkProcess/NetworkProcess.cpp >@@ -188,20 +188,14 @@ void NetworkProcess::initializeConnection(CoreIPC::Connection* connection) > > void NetworkProcess::createNetworkConnectionToWebProcess() > { >-#if PLATFORM(MAC) >- // Create the listening port. >- mach_port_t listeningPort; >- mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); >+ using namespace CoreIPC; > >- // Create a listening connection. >- RefPtr<NetworkConnectionToWebProcess> connection = NetworkConnectionToWebProcess::create(CoreIPC::Connection::Identifier(listeningPort)); >+ Connection::ConnectionDescriptor descriptor = Connection::createPlatformConnection(); >+ RefPtr<NetworkConnectionToWebProcess> connection = NetworkConnectionToWebProcess::create(descriptor.serverIdentifier()); > m_webProcessConnections.append(connection.release()); > >- CoreIPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND); >+ Attachment clientPort(descriptor.clientIdentifier(), Attachment::AcquireSendRight); > parentProcessConnection()->send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientPort), 0); >-#else >- notImplemented(); >-#endif > } > > void NetworkProcess::ensurePrivateBrowsingSession() >diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp >index 6d5507821494500a017925f87f6acece65ebdbf8..37122b8aab02190d503bf8eab4a961f7a547fe5b 100644 >--- a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp >+++ b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp >@@ -26,6 +26,7 @@ > #include "config.h" > #include "ArgumentDecoder.h" > >+#include "Attachment.h" > #include "DataReference.h" > #include <stdio.h> > >diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h >index bde55ed4af98c27b6d453034802a174bc6b7d6fb..79294a22c06b6a15517095c947da6be81c5d4bb8 100644 >--- a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h >+++ b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h >@@ -27,11 +27,11 @@ > #define ArgumentDecoder_h > > #include "ArgumentCoder.h" >-#include "Attachment.h" > #include <wtf/Vector.h> > > namespace CoreIPC { > >+class Attachment; > class DataReference; > > class ArgumentDecoder { >diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp >index 777536ffa7d466242fe26cbd1b0121977929e266..e055efa8925b96b6db711b74dcf3ed8e3811e0a8 100644 >--- a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp >+++ b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp >@@ -26,6 +26,7 @@ > #include "config.h" > #include "ArgumentEncoder.h" > >+#include "Attachment.h" > #include "DataReference.h" > #include <algorithm> > #include <stdio.h> >diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h >index 047c35d7630d5c7fce2212095a190a0edaf0990e..a089b04364d7694cdf6b5a2209175192fbc1ff79 100644 >--- a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h >+++ b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h >@@ -27,12 +27,12 @@ > #define ArgumentEncoder_h > > #include "ArgumentCoder.h" >-#include "Attachment.h" > #include <wtf/Vector.h> > > namespace CoreIPC { > > class ArgumentEncoder; >+class Attachment; > class DataReference; > > class ArgumentEncoder { >diff --git a/Source/WebKit2/Platform/CoreIPC/Attachment.cpp b/Source/WebKit2/Platform/CoreIPC/Attachment.cpp >index 5d19bad17f16b0ac81b0ff83aa4680f86fba97e6..0b782d14112edc3fc6e75264528eb1b9f77d278d 100644 >--- a/Source/WebKit2/Platform/CoreIPC/Attachment.cpp >+++ b/Source/WebKit2/Platform/CoreIPC/Attachment.cpp >@@ -31,12 +31,25 @@ > > namespace CoreIPC { > >-Attachment::Attachment() >- : m_type(Uninitialized) >+#if OS(DARWIN) >+static inline mach_msg_type_name_t messageDisposition(Attachment::ConnectionRequirement requirement) > { >+ if (requirement == Attachment::AcquireSendRight) >+ return MACH_MSG_TYPE_MAKE_SEND; >+ if (requirement == Attachment::ForwardSendRight) >+ return MACH_MSG_TYPE_MOVE_SEND; >+ >+ ASSERT_NOT_REACHED(); >+ return MACH_MSG_TYPE_MAKE_SEND; >+} >+ >+Attachment::Attachment(Connection::Identifier identifier, Attachment::ConnectionRequirement requirement) >+ : m_type(MachPortType) >+{ >+ m_port.port = identifier.port; >+ m_port.disposition = messageDisposition(requirement); > } > >-#if OS(DARWIN) > Attachment::Attachment(mach_port_name_t port, mach_msg_type_name_t disposition) > : m_type(MachPortType) > { >@@ -57,6 +70,16 @@ void Attachment::release() > { > m_type = Uninitialized; > } >+ >+Attachment Attachment::nullConnection(Attachment::ConnectionRequirement requirement) >+{ >+ return Attachment(MACH_PORT_NULL, messageDisposition(requirement)); >+} >+ >+Connection::Identifier Attachment::connectionIdentifier() const >+{ >+ return Connection::Identifier(port()); >+} > #endif > > void Attachment::encode(ArgumentEncoder& encoder) const >diff --git a/Source/WebKit2/Platform/CoreIPC/Attachment.h b/Source/WebKit2/Platform/CoreIPC/Attachment.h >index a5af5592d03b482866496819d5d20a4f41ac0e9f..ec936f66eecc1949aa7ec3c3483038c4e5c9abfe 100644 >--- a/Source/WebKit2/Platform/CoreIPC/Attachment.h >+++ b/Source/WebKit2/Platform/CoreIPC/Attachment.h >@@ -26,6 +26,8 @@ > #ifndef Attachment_h > #define Attachment_h > >+#include "Connection.h" >+ > #if OS(DARWIN) > #include <mach/mach_init.h> > #include <mach/mach_traps.h> >@@ -38,7 +40,9 @@ class ArgumentEncoder; > > class Attachment { > public: >- Attachment(); >+ Attachment() >+ : m_type(Uninitialized) >+ { } > > enum Type { > Uninitialized, >@@ -51,6 +55,13 @@ public: > #endif > }; > >+ enum ConnectionRequirement { >+ AcquireSendRight, >+ ForwardSendRight >+ }; >+ >+ Attachment(Connection::Identifier, ConnectionRequirement); >+ > #if OS(DARWIN) > Attachment(mach_port_name_t port, mach_msg_type_name_t disposition); > Attachment(void* address, mach_msg_size_t size, mach_msg_copy_options_t copyOptions, bool deallocate); >@@ -59,6 +70,9 @@ public: > Attachment(int fileDescriptor); > #endif > >+ static Attachment nullConnection(ConnectionRequirement); >+ >+ Connection::Identifier connectionIdentifier() const; > Type type() const { return m_type; } > > #if OS(DARWIN) >diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.h b/Source/WebKit2/Platform/CoreIPC/Connection.h >index ba800410e5d11f8592372f3b0011c7db8509b704..f83761378761cdd8747ec127cecbffba5c0477d0 100644 >--- a/Source/WebKit2/Platform/CoreIPC/Connection.h >+++ b/Source/WebKit2/Platform/CoreIPC/Connection.h >@@ -57,6 +57,8 @@ class RunLoop; > > namespace CoreIPC { > >+class Attachment; >+ > enum MessageSendFlags { > // Whether this message should be dispatched when waiting for a sync reply. > // This is the default for synchronous messages. >@@ -124,8 +126,31 @@ public: > static bool identifierIsNull(Identifier identifier) { return identifier.port == MACH_PORT_NULL; } > #elif USE(UNIX_DOMAIN_SOCKETS) > typedef int Identifier; >- static bool identifierIsNull(Identifier identifier) { return !identifier; } >+ static bool identifierIsNull(Identifier identifier) { return identifier == -1; } >+#endif >+ >+ class ConnectionDescriptor { >+ public: >+ Identifier serverIdentifier() const; >+ Identifier clientIdentifier() const; >+ private: >+ friend class Connection; >+#if OS(DARWIN) >+ ConnectionDescriptor(Identifier identifier) >+ : m_identifier(identifier) >+ { } >+ Identifier m_identifier; >+#elif USE(UNIX_DOMAIN_SOCKETS) >+ ConnectionDescriptor(Identifier serverIdentifier, Identifier clientIdentifier) >+ : m_serverIdentifier(serverIdentifier) >+ , m_clientIdentifier(clientIdentifier) >+ { } >+ Identifier m_serverIdentifier; >+ Identifier m_clientIdentifier; > #endif >+ }; >+ >+ static ConnectionDescriptor createPlatformConnection(); > > static PassRefPtr<Connection> createServerConnection(Identifier, Client*, WebCore::RunLoop* clientRunLoop); > static PassRefPtr<Connection> createClientConnection(Identifier, Client*, WebCore::RunLoop* clientRunLoop); >diff --git a/Source/WebKit2/Platform/CoreIPC/MessageDecoder.cpp b/Source/WebKit2/Platform/CoreIPC/MessageDecoder.cpp >index e6971a9e24300cf6c77d9c1687253ebcd329f3cb..08416f4cb3f56792fed5176422be671d5a44b789 100644 >--- a/Source/WebKit2/Platform/CoreIPC/MessageDecoder.cpp >+++ b/Source/WebKit2/Platform/CoreIPC/MessageDecoder.cpp >@@ -27,6 +27,7 @@ > #include "MessageDecoder.h" > > #include "ArgumentCoders.h" >+#include "Attachment.h" > #include "DataReference.h" > #include "MessageFlags.h" > #include "StringReference.h" >diff --git a/Source/WebKit2/Platform/CoreIPC/MessageEncoder.cpp b/Source/WebKit2/Platform/CoreIPC/MessageEncoder.cpp >index 11d7f6ef26ebcac6c808eb95e5b956fd69a5e374..544402e53741462670f3e924660c84c57866b745 100644 >--- a/Source/WebKit2/Platform/CoreIPC/MessageEncoder.cpp >+++ b/Source/WebKit2/Platform/CoreIPC/MessageEncoder.cpp >@@ -27,6 +27,7 @@ > #include "MessageEncoder.h" > > #include "ArgumentCoders.h" >+#include "Attachment.h" > #include "MessageFlags.h" > #include "StringReference.h" > >diff --git a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp >index ff56749a07199f260b047fc4bb5f9c5b8800afa4..fabadb1ad2b49aee93125e53aff9c875879ca236 100644 >--- a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp >+++ b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp >@@ -48,7 +48,24 @@ static const size_t inlineMessageMaxSize = 4096; > enum { > MessageBodyIsOutOfLine = 1 << 0 > }; >- >+ >+Connection::Identifier Connection::ConnectionDescriptor::serverIdentifier() const >+{ >+ return m_identifier; >+} >+ >+Connection::Identifier Connection::ConnectionDescriptor::clientIdentifier() const >+{ >+ return m_identifier; >+} >+ >+Connection::ConnectionDescriptor Connection::createPlatformConnection() >+{ >+ mach_port_t port; >+ mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port); >+ return ConnectionDescriptor(port); >+} >+ > void Connection::platformInvalidate() > { > if (!m_isConnected) >diff --git a/Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp b/Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp >index 6b770b77af01230866b288c5d4b199f002a14f79..793ac563cd72819a38e8e4913b4e50552096573b 100644 >--- a/Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp >+++ b/Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp >@@ -31,6 +31,12 @@ > > namespace CoreIPC { > >+Attachment::Attachment(Connection::Identifier identifier, ConnectionRequirement) >+ : m_type(SocketType) >+ , m_fileDescriptor(identifier) >+{ >+} >+ > Attachment::Attachment(int fileDescriptor, size_t size) > : m_type(MappedMemoryType) > , m_fileDescriptor(fileDescriptor) >@@ -51,4 +57,15 @@ void Attachment::dispose() > closeWithRetry(m_fileDescriptor); > } > >+Attachment Attachment::nullConnection(ConnectionRequirement) >+{ >+ return Attachment(-1); >+} >+ >+Connection::Identifier Attachment::connectionIdentifier() const >+{ >+ ASSERT(m_type == SocketType); >+ return fileDescriptor(); >+} >+ > } // namespace CoreIPC >diff --git a/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp b/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp >index 0e1b418e8e641e0df3717f64a45a2f52e56c635b..232a0cbfd8ade3093db0a10be0642887fd1f4892 100644 >--- a/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp >+++ b/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp >@@ -46,6 +46,13 @@ > #include <glib.h> > #endif > >+// On QNX SOCK_SEQPACKET does not work (although it is defined), see https://bugs.webkit.org/show_bug.cgi?id=95553. >+#if defined(SOCK_SEQPACKET) && !OS(QNX) >+#define SOCKET_TYPE SOCK_SEQPACKET >+#else >+#define SOCKET_TYPE SOCK_STREAM >+#endif >+ > namespace CoreIPC { > > static const size_t messageMaxSize = 4096; >@@ -55,6 +62,28 @@ enum { > MessageBodyIsOutOfLine = 1U << 31 > }; > >+Connection::Identifier Connection::ConnectionDescriptor::serverIdentifier() const >+{ >+ return m_serverIdentifier; >+} >+ >+Connection::Identifier Connection::ConnectionDescriptor::clientIdentifier() const >+{ >+ return m_clientIdentifier; >+} >+ >+Connection::ConnectionDescriptor Connection::createPlatformConnection() >+{ >+ int sockets[2]; >+ RELEASE_ASSERT(socketpair(AF_UNIX, SOCKET_TYPE, 0, sockets) != -1); >+ >+ // Avoid exposing the server socket to the child process >+ while (fcntl(sockets[0], F_SETFD, FD_CLOEXEC) == -1) >+ RELEASE_ASSERT(errno == EINTR); >+ >+ return ConnectionDescriptor(sockets[0], sockets[1]); >+} >+ > class MessageInfo { > public: > MessageInfo() { } >diff --git a/Source/WebKit2/PluginProcess/PluginProcess.cpp b/Source/WebKit2/PluginProcess/PluginProcess.cpp >index 36d1fc4a165e55b106f6a3b36574857c2cf71cfc..02a067400c4955dd8d62b0be33d0a2c0bd1b2bf8 100644 >--- a/Source/WebKit2/PluginProcess/PluginProcess.cpp >+++ b/Source/WebKit2/PluginProcess/PluginProcess.cpp >@@ -44,25 +44,6 @@ > #include <crt_externs.h> > #endif > >-#if USE(UNIX_DOMAIN_SOCKETS) >-#include <errno.h> >-#include <fcntl.h> >-#include <sys/resource.h> >-#include <sys/socket.h> >-#include <unistd.h> >-#include <wtf/UniStdExtras.h> >- >-#ifdef SOCK_SEQPACKET >-#define SOCKET_TYPE SOCK_SEQPACKET >-#else >-#if PLATFORM(GTK) >-#define SOCKET_TYPE SOCK_STREAM >-#else >-#define SOCKET_TYPE SOCK_DGRAM >-#endif >-#endif // SOCK_SEQPACKET >-#endif // USE(UNIX_DOMAIN_SOCKETS) >- > using namespace WebCore; > > namespace WebKit { >@@ -169,54 +150,16 @@ void PluginProcess::initializePluginProcess(const PluginProcessCreationParameter > > void PluginProcess::createWebProcessConnection() > { >- bool didHaveAnyWebProcessConnections = !m_webProcessConnections.isEmpty(); >+ using namespace CoreIPC; > >-#if PLATFORM(MAC) >- // Create the listening port. >- mach_port_t listeningPort; >- mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); >+ bool didHaveAnyWebProcessConnections = !m_webProcessConnections.isEmpty(); > >- // Create a listening connection. >- RefPtr<WebProcessConnection> connection = WebProcessConnection::create(CoreIPC::Connection::Identifier(listeningPort)); >+ Connection::ConnectionDescriptor descriptor = Connection::createPlatformConnection(); >+ RefPtr<WebProcessConnection> connection = WebProcessConnection::create(descriptor.serverIdentifier()); > m_webProcessConnections.append(connection.release()); > >- CoreIPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND); >+ Attachment clientPort(descriptor.clientIdentifier(), Attachment::AcquireSendRight); > parentProcessConnection()->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientPort, m_supportsAsynchronousPluginInitialization), 0); >-#elif USE(UNIX_DOMAIN_SOCKETS) >- int sockets[2]; >- if (socketpair(AF_UNIX, SOCKET_TYPE, 0, sockets) == -1) { >- ASSERT_NOT_REACHED(); >- return; >- } >- >- // Don't expose the plugin process socket to the web process. >- while (fcntl(sockets[1], F_SETFD, FD_CLOEXEC) == -1) { >- if (errno != EINTR) { >- ASSERT_NOT_REACHED(); >- closeWithRetry(sockets[0]); >- closeWithRetry(sockets[1]); >- return; >- } >- } >- >- // Don't expose the web process socket to possible future web processes. >- while (fcntl(sockets[0], F_SETFD, FD_CLOEXEC) == -1) { >- if (errno != EINTR) { >- ASSERT_NOT_REACHED(); >- closeWithRetry(sockets[0]); >- closeWithRetry(sockets[1]); >- return; >- } >- } >- >- RefPtr<WebProcessConnection> connection = WebProcessConnection::create(sockets[1]); >- m_webProcessConnections.append(connection.release()); >- >- CoreIPC::Attachment clientSocket(sockets[0]); >- parentProcessConnection()->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientSocket, m_supportsAsynchronousPluginInitialization), 0); >-#else >- notImplemented(); >-#endif > > if (NetscapePluginModule* module = netscapePluginModule()) { > if (!didHaveAnyWebProcessConnections) { >diff --git a/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp b/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp >index 3bd1ea603e3188b43c305955516f7171fea6d422..df71842c9fe50b35d96d458da2ebbfdc16676fff 100644 >--- a/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp >+++ b/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp >@@ -67,11 +67,7 @@ static Vector<std::unique_ptr<char[]>> createArgsArray(const String& prefix, con > > void ProcessLauncher::launchProcess() > { >- int sockets[2]; >- if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) < 0) { >- ASSERT_NOT_REACHED(); >- return; >- } >+ CoreIPC::Connection::ConnectionDescriptor descriptor = CoreIPC::Connection::createPlatformConnection(); > > String processCmdPrefix, executablePath, pluginPath; > switch (m_launchOptions.processType) { >@@ -98,20 +94,19 @@ void ProcessLauncher::launchProcess() > if (!m_launchOptions.processCmdPrefix.isEmpty()) > processCmdPrefix = m_launchOptions.processCmdPrefix; > #endif >- auto args = createArgsArray(processCmdPrefix, executablePath, String::number(sockets[0]), pluginPath); >+ auto args = createArgsArray(processCmdPrefix, executablePath, String::number(descriptor.clientIdentifier()), pluginPath); > > // Do not perform memory allocation in the middle of the fork() > // exec() below. FastMalloc can potentially deadlock because > // the fork() doesn't inherit the running threads. > pid_t pid = fork(); > if (!pid) { // Child process. >- close(sockets[1]); > execvp(args.data()[0].get(), reinterpret_cast<char* const*>(args.data())); > } else if (pid > 0) { // parent process; >- close(sockets[0]); >+ close(descriptor.clientIdentifier()); > m_processIdentifier = pid; > // We've finished launching the process, message back to the main run loop. >- RunLoop::main()->dispatch(bind(&ProcessLauncher::didFinishLaunchingProcess, this, pid, sockets[1])); >+ RunLoop::main()->dispatch(bind(&ProcessLauncher::didFinishLaunchingProcess, this, pid, descriptor.serverIdentifier())); > } else { > ASSERT_NOT_REACHED(); > return; >diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp >index dd80056180c10f6f9a1e99872fd1d945c557191e..49f71ee7044e2a781441a297829f91fad33ac6d1 100644 >--- a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp >+++ b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp >@@ -47,32 +47,17 @@ > #include <sys/socket.h> > #endif > >-#ifdef SOCK_SEQPACKET >-#define SOCKET_TYPE SOCK_SEQPACKET >-#else >-#define SOCKET_TYPE SOCK_STREAM >-#endif >- > using namespace WebCore; > > namespace WebKit { > > static void childSetupFunction(gpointer userData) > { >- int socket = GPOINTER_TO_INT(userData); >- close(socket); > } > > void ProcessLauncher::launchProcess() > { >- GPid pid = 0; >- >- int sockets[2]; >- if (socketpair(AF_UNIX, SOCKET_TYPE, 0, sockets) < 0) { >- g_printerr("Creation of socket failed: %s.\n", g_strerror(errno)); >- ASSERT_NOT_REACHED(); >- return; >- } >+ CoreIPC::Connection::ConnectionDescriptor descriptor = CoreIPC::Connection::createPlatformConnection(); > > String executablePath, pluginPath; > CString realExecutablePath, realPluginPath; >@@ -96,24 +81,25 @@ void ProcessLauncher::launchProcess() > } > > realExecutablePath = fileSystemRepresentation(executablePath); >- GOwnPtr<gchar> socket(g_strdup_printf("%d", sockets[0])); >+ GOwnPtr<gchar> socket(g_strdup_printf("%d", descriptor.clientIdentifier())); > char* argv[4]; > argv[0] = const_cast<char*>(realExecutablePath.data()); > argv[1] = socket.get(); > argv[2] = const_cast<char*>(realPluginPath.data()); > argv[3] = 0; > >+ GPid pid = 0; > GOwnPtr<GError> error; >- if (!g_spawn_async(0, argv, 0, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, childSetupFunction, GINT_TO_POINTER(sockets[1]), &pid, &error.outPtr())) { >+ if (!g_spawn_async(0, argv, 0, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, childSetupFunction, GINT_TO_POINTER(descriptor.serverIdentifier()), &pid, &error.outPtr())) { > g_printerr("Unable to fork a new WebProcess: %s.\n", error->message); > ASSERT_NOT_REACHED(); > } > >- close(sockets[0]); >+ close(descriptor.clientIdentifier()); > m_processIdentifier = pid; > > // We've finished launching the process, message back to the main run loop. >- RunLoop::main()->dispatch(bind(&ProcessLauncher::didFinishLaunchingProcess, this, m_processIdentifier, sockets[1])); >+ RunLoop::main()->dispatch(bind(&ProcessLauncher::didFinishLaunchingProcess, this, m_processIdentifier, descriptor.serverIdentifier())); > } > > void ProcessLauncher::terminateProcess() >diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp >index 0940db4b005380817da91e9e788c6069a2f2844f..859d276d256b9c3d1a57b9ccf0d668acc21fce46 100644 >--- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp >+++ b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp >@@ -28,6 +28,7 @@ > > #if ENABLE(NETWORK_PROCESS) > >+#include "Attachment.h" > #include "AuthenticationChallengeProxy.h" > #include "CustomProtocolManagerProxyMessages.h" > #include "DownloadProxyMessages.h" >@@ -108,12 +109,7 @@ void NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch() > // The network process must have crashed or exited, send any pending sync replies we might have. > while (!m_pendingConnectionReplies.isEmpty()) { > RefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst(); >- >-#if PLATFORM(MAC) >- reply->send(CoreIPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND)); >-#else >- notImplemented(); >-#endif >+ reply->send(CoreIPC::Attachment::nullConnection(CoreIPC::Attachment::ForwardSendRight)); > } > > // Tell the network process manager to forget about this network process proxy. This may cause us to be deleted. >@@ -152,18 +148,14 @@ void NetworkProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC > { > } > >-void NetworkProcessProxy::didCreateNetworkConnectionToWebProcess(const CoreIPC::Attachment& connectionIdentifier) >+void NetworkProcessProxy::didCreateNetworkConnectionToWebProcess(const CoreIPC::Attachment& connection) > { > ASSERT(!m_pendingConnectionReplies.isEmpty()); > > // Grab the first pending connection reply. > RefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst(); > >-#if PLATFORM(MAC) >- reply->send(CoreIPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND)); >-#else >- notImplemented(); >-#endif >+ reply->send(CoreIPC::Attachment(connection.connectionIdentifier(), CoreIPC::Attachment::ForwardSendRight)); > } > > void NetworkProcessProxy::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge& coreChallenge, uint64_t challengeID) >diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp >index 7ad172a407b2a6663d27176c93aeb0edc82a4a4a..0002f121174c5288e5d10b375fa489835b196116 100644 >--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp >+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp >@@ -28,6 +28,7 @@ > > #if ENABLE(NETSCAPE_PLUGIN_API) > >+#include "Attachment.h" > #include "PluginProcessConnectionManagerMessages.h" > #include "PluginProcessCreationParameters.h" > #include "PluginProcessManager.h" >@@ -136,14 +137,7 @@ void PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch() > // The plug-in process must have crashed or exited, send any pending sync replies we might have. > while (!m_pendingConnectionReplies.isEmpty()) { > RefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst(); >- >-#if PLATFORM(MAC) >- reply->send(CoreIPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND), false); >-#elif USE(UNIX_DOMAIN_SOCKETS) >- reply->send(CoreIPC::Attachment(), false); >-#else >- notImplemented(); >-#endif >+ reply->send(CoreIPC::Attachment::nullConnection(CoreIPC::Attachment::ForwardSendRight), false); > } > > while (!m_pendingGetSitesReplies.isEmpty()) >@@ -230,20 +224,13 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio > #endif > } > >-void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::Attachment& connectionIdentifier, bool supportsAsynchronousPluginInitialization) >+void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::Attachment& connection, bool supportsAsynchronousPluginInitialization) > { > ASSERT(!m_pendingConnectionReplies.isEmpty()); > > // Grab the first pending connection reply. > RefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst(); >- >-#if PLATFORM(MAC) >- reply->send(CoreIPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND), supportsAsynchronousPluginInitialization); >-#elif USE(UNIX_DOMAIN_SOCKETS) >- reply->send(connectionIdentifier, supportsAsynchronousPluginInitialization); >-#else >- notImplemented(); >-#endif >+ reply->send(CoreIPC::Attachment(connection.connectionIdentifier(), CoreIPC::Attachment::ForwardSendRight), supportsAsynchronousPluginInitialization); > } > > void PluginProcessProxy::didGetSitesWithData(const Vector<String>& sites, uint64_t callbackID) >diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp >index 065e77a56d44a84b059a4ef6a1255d44ce7e1e92..6e80a22546e0f6257c8e39e96b71897f428046c7 100644 >--- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp >+++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp >@@ -74,15 +74,9 @@ PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnect > Messages::WebProcessProxy::GetPluginProcessConnection::Reply(encodedConnectionIdentifier, supportsAsynchronousInitialization), 0)) > return 0; > >-#if PLATFORM(MAC) >- CoreIPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port()); >+ CoreIPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.connectionIdentifier()); > if (CoreIPC::Connection::identifierIsNull(connectionIdentifier)) > return 0; >-#elif USE(UNIX_DOMAIN_SOCKETS) >- CoreIPC::Connection::Identifier connectionIdentifier = encodedConnectionIdentifier.fileDescriptor(); >- if (connectionIdentifier == -1) >- return 0; >-#endif > > RefPtr<PluginProcessConnection> pluginProcessConnection = PluginProcessConnection::create(this, pluginProcessToken, connectionIdentifier, supportsAsynchronousInitialization); > m_pluginProcessConnections.append(pluginProcessConnection); >diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp >index bb8f2dba89457ef6974b9f615056f14527e515b8..7afb1e5bf457962458a066e0c970b5cf45f7cc6f 100644 >--- a/Source/WebKit2/WebProcess/WebProcess.cpp >+++ b/Source/WebKit2/WebProcess/WebProcess.cpp >@@ -367,13 +367,10 @@ void WebProcess::ensureNetworkProcessConnection() > Messages::WebProcessProxy::GetNetworkProcessConnection::Reply(encodedConnectionIdentifier), 0)) > return; > >-#if PLATFORM(MAC) >- CoreIPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port()); >+ CoreIPC::Connection::Identifier connectionIdentifier = encodedConnectionIdentifier.connectionIdentifier(); > if (CoreIPC::Connection::identifierIsNull(connectionIdentifier)) > return; >-#else >- ASSERT_NOT_REACHED(); >-#endif >+ > m_networkProcessConnection = NetworkProcessConnection::create(connectionIdentifier); > } > #endif // ENABLE(NETWORK_PROCESS)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 110978
:
190537
|
190734
|
190736
|
190737
|
190746
|
190948
|
191959
|
206130
|
207421
|
212706
|
212980
|
213361
|
217598
|
217605
|
230165
|
230168
|
239403
|
240920