Commit 973282ea authored by andersca@apple.com's avatar andersca@apple.com

2011-05-02 Anders Carlsson <andersca@apple.com>

        Reviewed by Sam Weinig.

        The web process locks up when the plug-in process crashes
        https://bugs.webkit.org/show_bug.cgi?id=59999
        <rdar://problem/8889303>

        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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@85573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 47e2f427
2011-05-02 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
The web process locks up when the plug-in process crashes
https://bugs.webkit.org/show_bug.cgi?id=59999
<rdar://problem/8889303>
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 <andersca@apple.com>
Try to fix Windows build.
......
......@@ -550,6 +550,11 @@ void Connection::processIncomingMessage(MessageID messageID, PassOwnPtr<Argument
enqueueIncomingMessage(incomingMessage);
}
void Connection::postConnectionDidCloseOnConnectionWorkQueue()
{
m_connectionQueue.scheduleWork(WorkItem::create(this, &Connection::connectionDidClose));
}
void Connection::connectionDidClose()
{
// The connection is now invalid.
......
......@@ -147,6 +147,8 @@ public:
void setDefaultSyncMessageTimeout(double);
void postConnectionDidCloseOnConnectionWorkQueue();
static const int DefaultTimeout = 0;
static const int NoTimeout = -1;
......
......@@ -75,6 +75,13 @@ PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnect
RefPtr<PluginProcessConnection> 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)
......@@ -29,11 +29,18 @@
#if ENABLE(PLUGIN_PROCESS)
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
#include <wtf/Threading.h>
#include <wtf/Vector.h>
#include <wtf/text/StringHash.h>
// 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<RefPtr<PluginProcessConnection> > m_pluginProcessConnections;
Mutex m_pathsAndConnectionsMutex;
HashMap<String, RefPtr<CoreIPC::Connection> > m_pathsAndConnections;
};
}
......
......@@ -796,7 +796,7 @@ void WebProcess::clearPluginSiteData(const Vector<String>& pluginPaths, const Ve
#if ENABLE(PLUGIN_PROCESS)
void WebProcess::pluginProcessCrashed(const String& pluginPath)
{
// FIXME: Implement.
m_pluginProcessConnectionManager.pluginProcessCrashed(pluginPath);
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment