Changeset 160308 in webkit
- Timestamp:
- Dec 9, 2013 4:28:44 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r160307 r160308 1 2013-12-09 Sergio Villar Senin <svillar@igalia.com> 2 3 [WK2] Add UNIX_DOMAIN_SOCKETS specific bits for supporting NetworkProcess 4 https://bugs.webkit.org/show_bug.cgi?id=110093 5 6 Reviewed by Martin Robinson. 7 8 Original patch by Balazs Kelemen <kbalazs@webkit.org>. 9 10 Adds the UNIX specific bits to support connections to the 11 NetworkProcess. Since the process of creating the pair of sockets 12 is exactly the same as in the PluginProcess, I've decided to 13 refactor it in ConnectionUnix::createPlatformConnection(). This 14 can be reused later to create a cross-platform solution and remove 15 all the ifdefs (see bug 110978). 16 17 * NetworkProcess/NetworkProcess.cpp: 18 (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): 19 * Platform/CoreIPC/Connection.h: 20 * Platform/CoreIPC/unix/ConnectionUnix.cpp: 21 (CoreIPC::Connection::createPlatformConnection): 22 * PluginProcess/PluginProcess.cpp: 23 (WebKit::PluginProcess::createWebProcessConnection): 24 * UIProcess/Network/NetworkProcessProxy.cpp: 25 (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch): 26 (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess): 27 * WebProcess/WebProcess.cpp: 28 (WebKit::WebProcess::ensureNetworkProcessConnection): 29 1 30 2013-12-09 Kwang Yul Seo <skyul@company100.net> 2 31 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
r160290 r160308 200 200 CoreIPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND); 201 201 parentProcessConnection()->send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientPort), 0); 202 #elif USE(UNIX_DOMAIN_SOCKETS) 203 CoreIPC::Connection::SocketPair socketPair = CoreIPC::Connection::createPlatformConnection(); 204 205 RefPtr<NetworkConnectionToWebProcess> connection = NetworkConnectionToWebProcess::create(socketPair.server); 206 m_webProcessConnections.append(connection.release()); 207 208 CoreIPC::Attachment clientSocket(socketPair.client); 209 parentProcessConnection()->send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientSocket), 0); 202 210 #else 203 211 notImplemented(); -
trunk/Source/WebKit2/Platform/CoreIPC/Connection.h
r159727 r160308 117 117 typedef int Identifier; 118 118 static bool identifierIsNull(Identifier identifier) { return !identifier; } 119 120 struct SocketPair { 121 int client; 122 int server; 123 }; 124 125 static Connection::SocketPair createPlatformConnection(); 119 126 #endif 120 127 -
trunk/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp
r160162 r160308 44 44 #endif 45 45 46 #ifdef SOCK_SEQPACKET 47 #define SOCKET_TYPE SOCK_SEQPACKET 48 #else 49 #if PLATFORM(GTK) 50 #define SOCKET_TYPE SOCK_STREAM 51 #else 52 #define SOCKET_TYPE SOCK_DGRAM 53 #endif 54 #endif // SOCK_SEQPACKET 55 46 56 namespace CoreIPC { 47 57 … … 507 517 } 508 518 519 Connection::SocketPair Connection::createPlatformConnection() 520 { 521 int sockets[2]; 522 RELEASE_ASSERT(socketpair(AF_UNIX, SOCKET_TYPE, 0, sockets) != -1); 523 524 // Don't expose the child socket to the parent process. 525 while (fcntl(sockets[1], F_SETFD, FD_CLOEXEC) == -1) 526 RELEASE_ASSERT(errno != EINTR); 527 528 // Don't expose the parent socket to potential future children. 529 while (fcntl(sockets[0], F_SETFD, FD_CLOEXEC) == -1) 530 RELEASE_ASSERT(errno != EINTR); 531 532 SocketPair socketPair = { sockets[0], sockets[1] }; 533 return socketPair; 534 } 535 509 536 } // namespace CoreIPC -
trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp
r159248 r160308 45 45 #endif 46 46 47 #if USE(UNIX_DOMAIN_SOCKETS)48 #include <errno.h>49 #include <fcntl.h>50 #include <sys/resource.h>51 #include <sys/socket.h>52 #include <unistd.h>53 #include <wtf/UniStdExtras.h>54 55 #ifdef SOCK_SEQPACKET56 #define SOCKET_TYPE SOCK_SEQPACKET57 #else58 #if PLATFORM(GTK)59 #define SOCKET_TYPE SOCK_STREAM60 #else61 #define SOCKET_TYPE SOCK_DGRAM62 #endif63 #endif // SOCK_SEQPACKET64 #endif // USE(UNIX_DOMAIN_SOCKETS)65 66 47 using namespace WebCore; 67 48 … … 184 165 parentProcessConnection()->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientPort, m_supportsAsynchronousPluginInitialization), 0); 185 166 #elif USE(UNIX_DOMAIN_SOCKETS) 186 int sockets[2]; 187 if (socketpair(AF_UNIX, SOCKET_TYPE, 0, sockets) == -1) { 188 ASSERT_NOT_REACHED(); 189 return; 190 } 191 192 // Don't expose the plugin process socket to the web process. 193 while (fcntl(sockets[1], F_SETFD, FD_CLOEXEC) == -1) { 194 if (errno != EINTR) { 195 ASSERT_NOT_REACHED(); 196 closeWithRetry(sockets[0]); 197 closeWithRetry(sockets[1]); 198 return; 199 } 200 } 201 202 // Don't expose the web process socket to possible future web processes. 203 while (fcntl(sockets[0], F_SETFD, FD_CLOEXEC) == -1) { 204 if (errno != EINTR) { 205 ASSERT_NOT_REACHED(); 206 closeWithRetry(sockets[0]); 207 closeWithRetry(sockets[1]); 208 return; 209 } 210 } 211 212 RefPtr<WebProcessConnection> connection = WebProcessConnection::create(sockets[1]); 167 CoreIPC::Connection::SocketPair socketPair = CoreIPC::Connection::createPlatformConnection(); 168 169 RefPtr<WebProcessConnection> connection = WebProcessConnection::create(socketPair.server); 213 170 m_webProcessConnections.append(connection.release()); 214 171 215 CoreIPC::Attachment clientSocket(socket s[0]);172 CoreIPC::Attachment clientSocket(socketPair.client); 216 173 parentProcessConnection()->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientSocket, m_supportsAsynchronousPluginInitialization), 0); 217 174 #else -
trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp
r160290 r160308 112 112 #if PLATFORM(MAC) 113 113 reply->send(CoreIPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND)); 114 #elif USE(UNIX_DOMAIN_SOCKETS) 115 reply->send(CoreIPC::Attachment()); 114 116 #else 115 117 notImplemented(); … … 162 164 #if PLATFORM(MAC) 163 165 reply->send(CoreIPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND)); 166 #elif USE(UNIX_DOMAIN_SOCKETS) 167 reply->send(connectionIdentifier); 164 168 #else 165 169 notImplemented(); -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r160136 r160308 373 373 #if PLATFORM(MAC) 374 374 CoreIPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port()); 375 if (CoreIPC::Connection::identifierIsNull(connectionIdentifier))376 return;375 #elif USE(UNIX_DOMAIN_SOCKETS) 376 CoreIPC::Connection::Identifier connectionIdentifier = encodedConnectionIdentifier.releaseFileDescriptor(); 377 377 #else 378 378 ASSERT_NOT_REACHED(); 379 379 #endif 380 if (CoreIPC::Connection::identifierIsNull(connectionIdentifier)) 381 return; 380 382 m_networkProcessConnection = NetworkProcessConnection::create(connectionIdentifier); 381 383 }
Note: See TracChangeset
for help on using the changeset viewer.