Changeset 185839 in webkit
- Timestamp:
- Jun 22, 2015, 12:52:51 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 15 edited
-
ChangeLog (modified) (1 diff)
-
DatabaseProcess/DatabaseToWebProcessConnection.cpp (modified) (1 diff)
-
NetworkProcess/NetworkConnectionToWebProcess.cpp (modified) (1 diff)
-
Platform/IPC/Connection.cpp (modified) (13 diffs)
-
Platform/IPC/Connection.h (modified) (4 diffs)
-
Platform/IPC/mac/ConnectionMac.mm (modified) (1 diff)
-
PluginProcess/WebProcessConnection.cpp (modified) (1 diff)
-
Shared/ChildProcess.cpp (modified) (1 diff)
-
Shared/ChildProcessProxy.cpp (modified) (1 diff)
-
UIProcess/Plugins/PluginProcessProxy.cpp (modified) (1 diff)
-
WebProcess/Databases/WebToDatabaseProcessConnection.cpp (modified) (1 diff)
-
WebProcess/Network/NetworkProcessConnection.cpp (modified) (1 diff)
-
WebProcess/Plugins/PluginProcessConnection.cpp (modified) (1 diff)
-
WebProcess/WebPage/WebInspector.cpp (modified) (1 diff)
-
WebProcess/WebPage/WebInspectorUI.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r185837 r185839 1 2015-06-22 Anders Carlsson <andersca@apple.com> 2 3 Remove m_clientRunLoop from IPC::Connection 4 https://bugs.webkit.org/show_bug.cgi?id=146212 5 6 Reviewed by Sam Weinig. 7 8 We only ever create connections whose messages are dispatched to the main run loop, so we can 9 vastly simplify the code by only allowing messages to be dispatched there. 10 11 * DatabaseProcess/DatabaseToWebProcessConnection.cpp: 12 (WebKit::DatabaseToWebProcessConnection::DatabaseToWebProcessConnection): 13 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 14 (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess): 15 * Platform/IPC/Connection.cpp: 16 (IPC::Connection::createServerConnection): 17 (IPC::Connection::createClientConnection): 18 (IPC::Connection::Connection): 19 (IPC::Connection::addWorkQueueMessageReceiver): 20 (IPC::Connection::removeWorkQueueMessageReceiver): 21 (IPC::Connection::waitForMessage): 22 (IPC::Connection::sendSyncMessage): 23 (IPC::Connection::sendSyncMessageFromSecondaryThread): 24 (IPC::Connection::processIncomingMessage): 25 (IPC::Connection::connectionDidClose): 26 (IPC::Connection::dispatchDidReceiveInvalidMessage): 27 (IPC::Connection::enqueueIncomingMessage): 28 (IPC::Connection::wakeUpRunLoop): 29 * Platform/IPC/Connection.h: 30 * Platform/IPC/mac/ConnectionMac.mm: 31 (IPC::Connection::receiveSourceEventHandler): 32 * PluginProcess/WebProcessConnection.cpp: 33 (WebKit::WebProcessConnection::WebProcessConnection): 34 * Shared/ChildProcess.cpp: 35 (WebKit::ChildProcess::initialize): 36 * Shared/ChildProcessProxy.cpp: 37 (WebKit::ChildProcessProxy::didFinishLaunching): 38 * UIProcess/Plugins/PluginProcessProxy.cpp: 39 (WebKit::PluginProcessProxy::didFinishLaunching): 40 * WebProcess/Databases/WebToDatabaseProcessConnection.cpp: 41 (WebKit::WebToDatabaseProcessConnection::WebToDatabaseProcessConnection): 42 * WebProcess/Network/NetworkProcessConnection.cpp: 43 (WebKit::NetworkProcessConnection::NetworkProcessConnection): 44 * WebProcess/Plugins/PluginProcessConnection.cpp: 45 (WebKit::PluginProcessConnection::PluginProcessConnection): 46 * WebProcess/WebPage/WebInspector.cpp: 47 (WebKit::WebInspector::createInspectorPage): 48 * WebProcess/WebPage/WebInspectorUI.cpp: 49 (WebKit::WebInspectorUI::establishConnection): 50 1 51 2015-06-22 Anders Carlsson <andersca@apple.com> 2 52 -
trunk/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp
r185637 r185839 43 43 DatabaseToWebProcessConnection::DatabaseToWebProcessConnection(IPC::Connection::Identifier connectionIdentifier) 44 44 { 45 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this , RunLoop::main());45 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this); 46 46 m_connection->setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(true); 47 47 m_connection->open(); -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp
r185637 r185839 55 55 NetworkConnectionToWebProcess::NetworkConnectionToWebProcess(IPC::Connection::Identifier connectionIdentifier) 56 56 { 57 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this , RunLoop::main());57 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this); 58 58 m_connection->open(); 59 59 } -
trunk/Source/WebKit2/Platform/IPC/Connection.cpp
r182980 r185839 226 226 } 227 227 228 Ref<Connection> Connection::createServerConnection(Identifier identifier, Client& client , RunLoop& clientRunLoop)229 { 230 return adoptRef(*new Connection(identifier, true, client , clientRunLoop));231 } 232 233 Ref<Connection> Connection::createClientConnection(Identifier identifier, Client& client , RunLoop& clientRunLoop)234 { 235 return adoptRef(*new Connection(identifier, false, client , clientRunLoop));236 } 237 238 Connection::Connection(Identifier identifier, bool isServer, Client& client , RunLoop& clientRunLoop)228 Ref<Connection> Connection::createServerConnection(Identifier identifier, Client& client) 229 { 230 return adoptRef(*new Connection(identifier, true, client)); 231 } 232 233 Ref<Connection> Connection::createClientConnection(Identifier identifier, Client& client) 234 { 235 return adoptRef(*new Connection(identifier, false, client)); 236 } 237 238 Connection::Connection(Identifier identifier, bool isServer, Client& client) 239 239 : m_client(&client) 240 240 , m_isServer(isServer) … … 245 245 , m_isConnected(false) 246 246 , m_connectionQueue(WorkQueue::create("com.apple.IPC.ReceiveQueue")) 247 , m_clientRunLoop(clientRunLoop)248 247 , m_inSendSyncCount(0) 249 248 , m_inDispatchMessageCount(0) … … 251 250 , m_didReceiveInvalidMessage(false) 252 251 , m_waitingForMessage(nullptr) 253 , m_syncMessageState(SyncMessageState::getOrCreate( clientRunLoop))252 , m_syncMessageState(SyncMessageState::getOrCreate(RunLoop::main())) 254 253 , m_shouldWaitForSyncReplies(true) 255 254 { 256 ASSERT( m_client);255 ASSERT(RunLoop::isMain()); 257 256 258 257 platformInitialize(identifier); … … 285 284 void Connection::addWorkQueueMessageReceiver(StringReference messageReceiverName, WorkQueue* workQueue, WorkQueueMessageReceiver* workQueueMessageReceiver) 286 285 { 287 ASSERT( &RunLoop::current() == &m_clientRunLoop);286 ASSERT(RunLoop::isMain()); 288 287 289 288 RefPtr<Connection> connection(this); … … 297 296 void Connection::removeWorkQueueMessageReceiver(StringReference messageReceiverName) 298 297 { 299 ASSERT( &RunLoop::current() == &m_clientRunLoop);298 ASSERT(RunLoop::isMain()); 300 299 301 300 RefPtr<Connection> connection(this); … … 417 416 std::unique_ptr<MessageDecoder> Connection::waitForMessage(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, std::chrono::milliseconds timeout, unsigned waitForMessageFlags) 418 417 { 419 ASSERT( &m_clientRunLoop == &RunLoop::current());418 ASSERT(RunLoop::isMain()); 420 419 421 420 bool hasIncomingSynchronousMessage = false; … … 481 480 std::unique_ptr<MessageDecoder> Connection::sendSyncMessage(uint64_t syncRequestID, std::unique_ptr<MessageEncoder> encoder, std::chrono::milliseconds timeout, unsigned syncSendFlags) 482 481 { 483 if ( &RunLoop::current() != &m_clientRunLoop) {482 if (!RunLoop::isMain()) { 484 483 // No flags are supported for synchronous messages sent from secondary threads. 485 484 ASSERT(!syncSendFlags); … … 534 533 std::unique_ptr<MessageDecoder> Connection::sendSyncMessageFromSecondaryThread(uint64_t syncRequestID, std::unique_ptr<MessageEncoder> encoder, std::chrono::milliseconds timeout) 535 534 { 536 ASSERT( &RunLoop::current() != &m_clientRunLoop);535 ASSERT(!RunLoop::isMain()); 537 536 538 537 if (!isValid()) … … 679 678 StringCapture capturedMessageName(messageName.isEmpty() ? "<unknown message>" : String(messageName.data(), messageName.size())); 680 679 681 m_clientRunLoop.dispatch([protectedThis, capturedMessageReceiverName, capturedMessageName] {680 RunLoop::main().dispatch([protectedThis, capturedMessageReceiverName, capturedMessageName] { 682 681 protectedThis->dispatchDidReceiveInvalidMessage(capturedMessageReceiverName.string().utf8(), capturedMessageName.string().utf8()); 683 682 }); … … 767 766 768 767 RefPtr<Connection> connection(this); 769 m_clientRunLoop.dispatch([connection] {768 RunLoop::main().dispatch([connection] { 770 769 // If the connection has been explicitly invalidated before dispatchConnectionDidClose was called, 771 770 // then the client will be null here. … … 837 836 void Connection::dispatchDidReceiveInvalidMessage(const CString& messageReceiverNameString, const CString& messageNameString) 838 837 { 839 ASSERT( &RunLoop::current() == &m_clientRunLoop);838 ASSERT(RunLoop::isMain()); 840 839 841 840 if (!m_client) … … 861 860 862 861 RefPtr<Connection> protectedThis(this); 863 m_clientRunLoop.dispatch([protectedThis] {862 RunLoop::main().dispatch([protectedThis] { 864 863 protectedThis->dispatchOneMessage(); 865 864 }); … … 924 923 void Connection::wakeUpRunLoop() 925 924 { 926 m_clientRunLoop.wakeUp();925 RunLoop::main().wakeUp(); 927 926 } 928 927 -
trunk/Source/WebKit2/Platform/IPC/Connection.h
r183176 r185839 52 52 #endif 53 53 54 namespace WTF {55 class RunLoop;56 }57 58 54 namespace IPC { 59 55 … … 145 141 #endif 146 142 147 static Ref<Connection> createServerConnection(Identifier, Client& , WTF::RunLoop& clientRunLoop);148 static Ref<Connection> createClientConnection(Identifier, Client& , WTF::RunLoop& clientRunLoop);143 static Ref<Connection> createServerConnection(Identifier, Client&); 144 static Ref<Connection> createClientConnection(Identifier, Client&); 149 145 ~Connection(); 150 146 … … 206 202 207 203 private: 208 Connection(Identifier, bool isServer, Client& , WTF::RunLoop& clientRunLoop);204 Connection(Identifier, bool isServer, Client&); 209 205 void platformInitialize(Identifier); 210 206 void platformInvalidate(); … … 250 246 bool m_isConnected; 251 247 Ref<WorkQueue> m_connectionQueue; 252 WTF::RunLoop& m_clientRunLoop;253 248 254 249 HashMap<StringReference, std::pair<RefPtr<WorkQueue>, RefPtr<WorkQueueMessageReceiver>>> m_workQueueMessageReceivers; -
trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm
r182086 r185839 515 515 StringReference messageName = decoder->messageName(); 516 516 StringCapture capturedMessageName(String(messageName.data(), messageName.size())); 517 m_clientRunLoop.dispatch([protectedThis, capturedMessageReceiverName, capturedMessageName] {517 RunLoop::main().dispatch([protectedThis, capturedMessageReceiverName, capturedMessageName] { 518 518 protectedThis->dispatchDidReceiveInvalidMessage(capturedMessageReceiverName.string().utf8(), capturedMessageName.string().utf8()); 519 519 }); -
trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp
r185637 r185839 61 61 WebProcessConnection::WebProcessConnection(IPC::Connection::Identifier connectionIdentifier) 62 62 { 63 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this , RunLoop::main());63 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this); 64 64 m_npRemoteObjectMap = NPRemoteObjectMap::create(m_connection.get()); 65 65 -
trunk/Source/WebKit2/Shared/ChildProcess.cpp
r184503 r185839 68 68 initializeSandbox(parameters, sandboxParameters); 69 69 70 m_connection = IPC::Connection::createClientConnection(parameters.connectionIdentifier, *this , RunLoop::main());70 m_connection = IPC::Connection::createClientConnection(parameters.connectionIdentifier, *this); 71 71 m_connection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue); 72 72 initializeConnection(m_connection.get()); -
trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp
r184514 r185839 135 135 ASSERT(!m_connection); 136 136 137 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this , RunLoop::main());137 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this); 138 138 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000 139 139 m_connection->setShouldCloseConnectionOnMachExceptions(); -
trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
r185463 r185839 214 214 } 215 215 216 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this , RunLoop::main());216 m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this); 217 217 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000 218 218 m_connection->setShouldCloseConnectionOnMachExceptions(); -
trunk/Source/WebKit2/WebProcess/Databases/WebToDatabaseProcessConnection.cpp
r179409 r185839 42 42 WebToDatabaseProcessConnection::WebToDatabaseProcessConnection(IPC::Connection::Identifier connectionIdentifier) 43 43 { 44 m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this , RunLoop::main());44 m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this); 45 45 m_connection->open(); 46 46 } -
trunk/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp
r179489 r185839 46 46 NetworkProcessConnection::NetworkProcessConnection(IPC::Connection::Identifier connectionIdentifier) 47 47 { 48 m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this , RunLoop::main());48 m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this); 49 49 m_connection->open(); 50 50 } -
trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
r177924 r185839 49 49 , m_audioHardwareActivity(WebCore::AudioHardwareActivityType::Unknown) 50 50 { 51 m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this , RunLoop::main());51 m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this); 52 52 53 53 m_npRemoteObjectMap = NPRemoteObjectMap::create(m_connection.get()); -
trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
r185111 r185839 93 93 #endif 94 94 95 m_frontendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this , RunLoop::main());95 m_frontendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this); 96 96 m_frontendConnection->open(); 97 97 -
trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp
r184291 r185839 82 82 m_page->corePage()->inspectorController().setInspectorFrontendClient(this); 83 83 84 m_backendConnection = IPC::Connection::createClientConnection(connectionIdentifier, *this , RunLoop::main());84 m_backendConnection = IPC::Connection::createClientConnection(connectionIdentifier, *this); 85 85 m_backendConnection->open(); 86 86 }
Note:
See TracChangeset
for help on using the changeset viewer.