Diff
Modified: trunk/Source/WebKit2/ChangeLog (185838 => 185839)
--- trunk/Source/WebKit2/ChangeLog 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/ChangeLog 2015-06-22 19:52:51 UTC (rev 185839)
@@ -1,5 +1,55 @@
2015-06-22 Anders Carlsson <ander...@apple.com>
+ Remove m_clientRunLoop from IPC::Connection
+ https://bugs.webkit.org/show_bug.cgi?id=146212
+
+ Reviewed by Sam Weinig.
+
+ We only ever create connections whose messages are dispatched to the main run loop, so we can
+ vastly simplify the code by only allowing messages to be dispatched there.
+
+ * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
+ (WebKit::DatabaseToWebProcessConnection::DatabaseToWebProcessConnection):
+ * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+ (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
+ * Platform/IPC/Connection.cpp:
+ (IPC::Connection::createServerConnection):
+ (IPC::Connection::createClientConnection):
+ (IPC::Connection::Connection):
+ (IPC::Connection::addWorkQueueMessageReceiver):
+ (IPC::Connection::removeWorkQueueMessageReceiver):
+ (IPC::Connection::waitForMessage):
+ (IPC::Connection::sendSyncMessage):
+ (IPC::Connection::sendSyncMessageFromSecondaryThread):
+ (IPC::Connection::processIncomingMessage):
+ (IPC::Connection::connectionDidClose):
+ (IPC::Connection::dispatchDidReceiveInvalidMessage):
+ (IPC::Connection::enqueueIncomingMessage):
+ (IPC::Connection::wakeUpRunLoop):
+ * Platform/IPC/Connection.h:
+ * Platform/IPC/mac/ConnectionMac.mm:
+ (IPC::Connection::receiveSourceEventHandler):
+ * PluginProcess/WebProcessConnection.cpp:
+ (WebKit::WebProcessConnection::WebProcessConnection):
+ * Shared/ChildProcess.cpp:
+ (WebKit::ChildProcess::initialize):
+ * Shared/ChildProcessProxy.cpp:
+ (WebKit::ChildProcessProxy::didFinishLaunching):
+ * UIProcess/Plugins/PluginProcessProxy.cpp:
+ (WebKit::PluginProcessProxy::didFinishLaunching):
+ * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
+ (WebKit::WebToDatabaseProcessConnection::WebToDatabaseProcessConnection):
+ * WebProcess/Network/NetworkProcessConnection.cpp:
+ (WebKit::NetworkProcessConnection::NetworkProcessConnection):
+ * WebProcess/Plugins/PluginProcessConnection.cpp:
+ (WebKit::PluginProcessConnection::PluginProcessConnection):
+ * WebProcess/WebPage/WebInspector.cpp:
+ (WebKit::WebInspector::createInspectorPage):
+ * WebProcess/WebPage/WebInspectorUI.cpp:
+ (WebKit::WebInspectorUI::establishConnection):
+
+2015-06-22 Anders Carlsson <ander...@apple.com>
+
Crashes in hit testing under WebPage::acceptsFirstMouse() while handling sync message in plug-in teardown
https://bugs.webkit.org/show_bug.cgi?id=146211
rdar://problem/17180615
Modified: trunk/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp (185838 => 185839)
--- trunk/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -42,7 +42,7 @@
DatabaseToWebProcessConnection::DatabaseToWebProcessConnection(IPC::Connection::Identifier connectionIdentifier)
{
- m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this, RunLoop::main());
+ m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
m_connection->setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(true);
m_connection->open();
}
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (185838 => 185839)
--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -54,7 +54,7 @@
NetworkConnectionToWebProcess::NetworkConnectionToWebProcess(IPC::Connection::Identifier connectionIdentifier)
{
- m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this, RunLoop::main());
+ m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
m_connection->open();
}
Modified: trunk/Source/WebKit2/Platform/IPC/Connection.cpp (185838 => 185839)
--- trunk/Source/WebKit2/Platform/IPC/Connection.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -225,17 +225,17 @@
dispatchMessages(&connection);
}
-Ref<Connection> Connection::createServerConnection(Identifier identifier, Client& client, RunLoop& clientRunLoop)
+Ref<Connection> Connection::createServerConnection(Identifier identifier, Client& client)
{
- return adoptRef(*new Connection(identifier, true, client, clientRunLoop));
+ return adoptRef(*new Connection(identifier, true, client));
}
-Ref<Connection> Connection::createClientConnection(Identifier identifier, Client& client, RunLoop& clientRunLoop)
+Ref<Connection> Connection::createClientConnection(Identifier identifier, Client& client)
{
- return adoptRef(*new Connection(identifier, false, client, clientRunLoop));
+ return adoptRef(*new Connection(identifier, false, client));
}
-Connection::Connection(Identifier identifier, bool isServer, Client& client, RunLoop& clientRunLoop)
+Connection::Connection(Identifier identifier, bool isServer, Client& client)
: m_client(&client)
, m_isServer(isServer)
, m_syncRequestID(0)
@@ -244,16 +244,15 @@
, m_didCloseOnConnectionWorkQueueCallback(0)
, m_isConnected(false)
, m_connectionQueue(WorkQueue::create("com.apple.IPC.ReceiveQueue"))
- , m_clientRunLoop(clientRunLoop)
, m_inSendSyncCount(0)
, m_inDispatchMessageCount(0)
, m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount(0)
, m_didReceiveInvalidMessage(false)
, m_waitingForMessage(nullptr)
- , m_syncMessageState(SyncMessageState::getOrCreate(clientRunLoop))
+ , m_syncMessageState(SyncMessageState::getOrCreate(RunLoop::main()))
, m_shouldWaitForSyncReplies(true)
{
- ASSERT(m_client);
+ ASSERT(RunLoop::isMain());
platformInitialize(identifier);
@@ -284,7 +283,7 @@
void Connection::addWorkQueueMessageReceiver(StringReference messageReceiverName, WorkQueue* workQueue, WorkQueueMessageReceiver* workQueueMessageReceiver)
{
- ASSERT(&RunLoop::current() == &m_clientRunLoop);
+ ASSERT(RunLoop::isMain());
RefPtr<Connection> connection(this);
m_connectionQueue->dispatch([connection, messageReceiverName, workQueue, workQueueMessageReceiver] {
@@ -296,7 +295,7 @@
void Connection::removeWorkQueueMessageReceiver(StringReference messageReceiverName)
{
- ASSERT(&RunLoop::current() == &m_clientRunLoop);
+ ASSERT(RunLoop::isMain());
RefPtr<Connection> connection(this);
m_connectionQueue->dispatch([connection, messageReceiverName] {
@@ -416,7 +415,7 @@
std::unique_ptr<MessageDecoder> Connection::waitForMessage(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, std::chrono::milliseconds timeout, unsigned waitForMessageFlags)
{
- ASSERT(&m_clientRunLoop == &RunLoop::current());
+ ASSERT(RunLoop::isMain());
bool hasIncomingSynchronousMessage = false;
@@ -480,7 +479,7 @@
std::unique_ptr<MessageDecoder> Connection::sendSyncMessage(uint64_t syncRequestID, std::unique_ptr<MessageEncoder> encoder, std::chrono::milliseconds timeout, unsigned syncSendFlags)
{
- if (&RunLoop::current() != &m_clientRunLoop) {
+ if (!RunLoop::isMain()) {
// No flags are supported for synchronous messages sent from secondary threads.
ASSERT(!syncSendFlags);
return sendSyncMessageFromSecondaryThread(syncRequestID, WTF::move(encoder), timeout);
@@ -533,7 +532,7 @@
std::unique_ptr<MessageDecoder> Connection::sendSyncMessageFromSecondaryThread(uint64_t syncRequestID, std::unique_ptr<MessageEncoder> encoder, std::chrono::milliseconds timeout)
{
- ASSERT(&RunLoop::current() != &m_clientRunLoop);
+ ASSERT(!RunLoop::isMain());
if (!isValid())
return nullptr;
@@ -678,7 +677,7 @@
StringReference messageName = message->messageName();
StringCapture capturedMessageName(messageName.isEmpty() ? "<unknown message>" : String(messageName.data(), messageName.size()));
- m_clientRunLoop.dispatch([protectedThis, capturedMessageReceiverName, capturedMessageName] {
+ RunLoop::main().dispatch([protectedThis, capturedMessageReceiverName, capturedMessageName] {
protectedThis->dispatchDidReceiveInvalidMessage(capturedMessageReceiverName.string().utf8(), capturedMessageName.string().utf8());
});
return;
@@ -766,7 +765,7 @@
m_didCloseOnConnectionWorkQueueCallback(this);
RefPtr<Connection> connection(this);
- m_clientRunLoop.dispatch([connection] {
+ RunLoop::main().dispatch([connection] {
// If the connection has been explicitly invalidated before dispatchConnectionDidClose was called,
// then the client will be null here.
if (!connection->m_client)
@@ -836,7 +835,7 @@
void Connection::dispatchDidReceiveInvalidMessage(const CString& messageReceiverNameString, const CString& messageNameString)
{
- ASSERT(&RunLoop::current() == &m_clientRunLoop);
+ ASSERT(RunLoop::isMain());
if (!m_client)
return;
@@ -860,7 +859,7 @@
}
RefPtr<Connection> protectedThis(this);
- m_clientRunLoop.dispatch([protectedThis] {
+ RunLoop::main().dispatch([protectedThis] {
protectedThis->dispatchOneMessage();
});
}
@@ -923,7 +922,7 @@
void Connection::wakeUpRunLoop()
{
- m_clientRunLoop.wakeUp();
+ RunLoop::main().wakeUp();
}
} // namespace IPC
Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (185838 => 185839)
--- trunk/Source/WebKit2/Platform/IPC/Connection.h 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h 2015-06-22 19:52:51 UTC (rev 185839)
@@ -51,10 +51,6 @@
#include "PlatformProcessIdentifier.h"
#endif
-namespace WTF {
-class RunLoop;
-}
-
namespace IPC {
struct WaitForMessageState;
@@ -144,8 +140,8 @@
static Connection::SocketPair createPlatformConnection(unsigned options = SetCloexecOnClient | SetCloexecOnServer);
#endif
- static Ref<Connection> createServerConnection(Identifier, Client&, WTF::RunLoop& clientRunLoop);
- static Ref<Connection> createClientConnection(Identifier, Client&, WTF::RunLoop& clientRunLoop);
+ static Ref<Connection> createServerConnection(Identifier, Client&);
+ static Ref<Connection> createClientConnection(Identifier, Client&);
~Connection();
Client* client() const { return m_client; }
@@ -205,7 +201,7 @@
#endif
private:
- Connection(Identifier, bool isServer, Client&, WTF::RunLoop& clientRunLoop);
+ Connection(Identifier, bool isServer, Client&);
void platformInitialize(Identifier);
void platformInvalidate();
@@ -249,7 +245,6 @@
bool m_isConnected;
Ref<WorkQueue> m_connectionQueue;
- WTF::RunLoop& m_clientRunLoop;
HashMap<StringReference, std::pair<RefPtr<WorkQueue>, RefPtr<WorkQueueMessageReceiver>>> m_workQueueMessageReceivers;
Modified: trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm (185838 => 185839)
--- trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm 2015-06-22 19:52:51 UTC (rev 185839)
@@ -514,7 +514,7 @@
StringCapture capturedMessageReceiverName(String(messageReceiverName.data(), messageReceiverName.size()));
StringReference messageName = decoder->messageName();
StringCapture capturedMessageName(String(messageName.data(), messageName.size()));
- m_clientRunLoop.dispatch([protectedThis, capturedMessageReceiverName, capturedMessageName] {
+ RunLoop::main().dispatch([protectedThis, capturedMessageReceiverName, capturedMessageName] {
protectedThis->dispatchDidReceiveInvalidMessage(capturedMessageReceiverName.string().utf8(), capturedMessageName.string().utf8());
});
return;
Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp (185838 => 185839)
--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -60,7 +60,7 @@
WebProcessConnection::WebProcessConnection(IPC::Connection::Identifier connectionIdentifier)
{
- m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this, RunLoop::main());
+ m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
m_npRemoteObjectMap = NPRemoteObjectMap::create(m_connection.get());
m_connection->setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(true);
Modified: trunk/Source/WebKit2/Shared/ChildProcess.cpp (185838 => 185839)
--- trunk/Source/WebKit2/Shared/ChildProcess.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/Shared/ChildProcess.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -67,7 +67,7 @@
SandboxInitializationParameters sandboxParameters;
initializeSandbox(parameters, sandboxParameters);
- m_connection = IPC::Connection::createClientConnection(parameters.connectionIdentifier, *this, RunLoop::main());
+ m_connection = IPC::Connection::createClientConnection(parameters.connectionIdentifier, *this);
m_connection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue);
initializeConnection(m_connection.get());
m_connection->open();
Modified: trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp (185838 => 185839)
--- trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -134,7 +134,7 @@
{
ASSERT(!m_connection);
- m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this, RunLoop::main());
+ m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
m_connection->setShouldCloseConnectionOnMachExceptions();
#endif
Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp (185838 => 185839)
--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -213,7 +213,7 @@
return;
}
- m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this, RunLoop::main());
+ m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
m_connection->setShouldCloseConnectionOnMachExceptions();
#endif
Modified: trunk/Source/WebKit2/WebProcess/Databases/WebToDatabaseProcessConnection.cpp (185838 => 185839)
--- trunk/Source/WebKit2/WebProcess/Databases/WebToDatabaseProcessConnection.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/WebProcess/Databases/WebToDatabaseProcessConnection.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -41,7 +41,7 @@
WebToDatabaseProcessConnection::WebToDatabaseProcessConnection(IPC::Connection::Identifier connectionIdentifier)
{
- m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this, RunLoop::main());
+ m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this);
m_connection->open();
}
Modified: trunk/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp (185838 => 185839)
--- trunk/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -45,7 +45,7 @@
NetworkProcessConnection::NetworkProcessConnection(IPC::Connection::Identifier connectionIdentifier)
{
- m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this, RunLoop::main());
+ m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this);
m_connection->open();
}
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp (185838 => 185839)
--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -48,7 +48,7 @@
, m_supportsAsynchronousPluginInitialization(supportsAsynchronousPluginInitialization)
, m_audioHardwareActivity(WebCore::AudioHardwareActivityType::Unknown)
{
- m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this, RunLoop::main());
+ m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this);
m_npRemoteObjectMap = NPRemoteObjectMap::create(m_connection.get());
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp (185838 => 185839)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -92,7 +92,7 @@
return;
#endif
- m_frontendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this, RunLoop::main());
+ m_frontendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
m_frontendConnection->open();
WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::CreateInspectorPage(connectionClientPort, canAttachWindow(), underTest), m_page->pageID());
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp (185838 => 185839)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp 2015-06-22 19:35:19 UTC (rev 185838)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp 2015-06-22 19:52:51 UTC (rev 185839)
@@ -81,7 +81,7 @@
m_page->corePage()->inspectorController().setInspectorFrontendClient(this);
- m_backendConnection = IPC::Connection::createClientConnection(connectionIdentifier, *this, RunLoop::main());
+ m_backendConnection = IPC::Connection::createClientConnection(connectionIdentifier, *this);
m_backendConnection->open();
}