diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 557a5e8c6c85d698fe4dbb0029996ada9d8d0dc1..c2e9ae663e80c9ffd9c830b851cf79ae216e8709 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,26 @@ +2011-05-02 Anders Carlsson + + Reviewed by Sam Weinig. + + The web process locks up when the plug-in process crashes + https://bugs.webkit.org/show_bug.cgi?id=59999 + + + Add a hash map from plug-in paths to CoreIPC connections to PluginProcessConnectionManager. + Add PluginProcessConnectionManager::pluginProcessCrashed and make it look up the corresponding + CoreIPC connection and call postConnectionDidCloseOnConnectionWorkQueue on it. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::postConnectionDidCloseOnConnectionWorkQueue): + * Platform/CoreIPC/Connection.h: + * WebProcess/Plugins/PluginProcessConnectionManager.cpp: + (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): + (WebKit::PluginProcessConnectionManager::removePluginProcessConnection): + (WebKit::PluginProcessConnectionManager::pluginProcessCrashed): + * WebProcess/Plugins/PluginProcessConnectionManager.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::pluginProcessCrashed): + 2011-05-02 Anders Carlsson Try to fix Windows build. diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.cpp b/Source/WebKit2/Platform/CoreIPC/Connection.cpp index e9571e133d9e2879fa871ba9685e5c97c3542bcd..26b0d7c84279e1cfee21730bac1a8287cbbb1d9e 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.cpp +++ b/Source/WebKit2/Platform/CoreIPC/Connection.cpp @@ -550,6 +550,11 @@ void Connection::processIncomingMessage(MessageID messageID, PassOwnPtr pluginProcessConnection = PluginProcessConnection::create(this, pluginPath, connectionIdentifier); m_pluginProcessConnections.append(pluginProcessConnection); + { + MutexLocker locker(m_pathsAndConnectionsMutex); + ASSERT(!m_pathsAndConnections.contains(pluginProcessConnection->pluginPath())); + + m_pathsAndConnections.set(pluginPath, pluginProcessConnection->connection()); + } + return pluginProcessConnection.get(); } @@ -83,9 +90,29 @@ void PluginProcessConnectionManager::removePluginProcessConnection(PluginProcess size_t vectorIndex = m_pluginProcessConnections.find(pluginProcessConnection); ASSERT(vectorIndex != notFound); + { + MutexLocker locker(m_pathsAndConnectionsMutex); + ASSERT(m_pathsAndConnections.contains(pluginProcessConnection->pluginPath())); + + m_pathsAndConnections.remove(pluginProcessConnection->pluginPath()); + } + m_pluginProcessConnections.remove(vectorIndex); } +void PluginProcessConnectionManager::pluginProcessCrashed(const String& pluginPath) +{ + MutexLocker locker(m_pathsAndConnectionsMutex); + CoreIPC::Connection* connection = m_pathsAndConnections.get(pluginPath).get(); + + // It's OK for connection to be null here; it will happen if this web process doesn't know + // anything about the plug-in process. + if (!connection) + return; + + connection->postConnectionDidCloseOnConnectionWorkQueue(); +} + } // namespace WebKit #endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h index 86fa7e00ea77476e350dfe4de0f483a24000d250..45515cdf14d62b4c744212b37c02071780fe68ab 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h @@ -29,11 +29,18 @@ #if ENABLE(PLUGIN_PROCESS) #include +#include #include +#include #include +#include // Manages plug-in process connections for the given web process. +namespace CoreIPC { + class Connection; +} + namespace WebKit { class PluginProcessConnection; @@ -47,8 +54,14 @@ public: PluginProcessConnection* getPluginProcessConnection(const String& pluginPath); void removePluginProcessConnection(PluginProcessConnection*); + // Called on the web process connection work queue. + void pluginProcessCrashed(const String& pluginPath); + private: Vector > m_pluginProcessConnections; + + Mutex m_pathsAndConnectionsMutex; + HashMap > m_pathsAndConnections; }; } diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp index 1d316e3fe245f2c3119701b893e71727bd364150..f018f50827728d38716c35269256a30a8949394a 100644 --- a/Source/WebKit2/WebProcess/WebProcess.cpp +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -796,7 +796,7 @@ void WebProcess::clearPluginSiteData(const Vector& pluginPaths, const Ve #if ENABLE(PLUGIN_PROCESS) void WebProcess::pluginProcessCrashed(const String& pluginPath) { - // FIXME: Implement. + m_pluginProcessConnectionManager.pluginProcessCrashed(pluginPath); } #endif