Changeset 85573 in webkit


Ignore:
Timestamp:
May 2, 2011 6:48:32 PM (13 years ago)
Author:
andersca@apple.com
Message:

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):
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r85571 r85573  
     12011-05-02  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        The web process locks up when the plug-in process crashes
     6        https://bugs.webkit.org/show_bug.cgi?id=59999
     7        <rdar://problem/8889303>
     8
     9        Add a hash map from plug-in paths to CoreIPC connections to PluginProcessConnectionManager.
     10        Add PluginProcessConnectionManager::pluginProcessCrashed and make it look up the corresponding
     11        CoreIPC connection and call postConnectionDidCloseOnConnectionWorkQueue on it.
     12
     13        * Platform/CoreIPC/Connection.cpp:
     14        (CoreIPC::Connection::postConnectionDidCloseOnConnectionWorkQueue):
     15        * Platform/CoreIPC/Connection.h:
     16        * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
     17        (WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
     18        (WebKit::PluginProcessConnectionManager::removePluginProcessConnection):
     19        (WebKit::PluginProcessConnectionManager::pluginProcessCrashed):
     20        * WebProcess/Plugins/PluginProcessConnectionManager.h:
     21        * WebProcess/WebProcess.cpp:
     22        (WebKit::WebProcess::pluginProcessCrashed):
     23
    1242011-05-02  Anders Carlsson  <andersca@apple.com>
    225
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp

    r85515 r85573  
    551551}
    552552
     553void Connection::postConnectionDidCloseOnConnectionWorkQueue()
     554{
     555    m_connectionQueue.scheduleWork(WorkItem::create(this, &Connection::connectionDidClose));
     556}
     557
    553558void Connection::connectionDidClose()
    554559{
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.h

    r85515 r85573  
    148148    void setDefaultSyncMessageTimeout(double);
    149149
     150    void postConnectionDidCloseOnConnectionWorkQueue();
     151
    150152    static const int DefaultTimeout = 0;
    151153    static const int NoTimeout = -1;
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp

    r85566 r85573  
    7676    m_pluginProcessConnections.append(pluginProcessConnection);
    7777
     78    {
     79        MutexLocker locker(m_pathsAndConnectionsMutex);
     80        ASSERT(!m_pathsAndConnections.contains(pluginProcessConnection->pluginPath()));
     81
     82        m_pathsAndConnections.set(pluginPath, pluginProcessConnection->connection());
     83    }
     84
    7885    return pluginProcessConnection.get();
    7986}
     
    8491    ASSERT(vectorIndex != notFound);
    8592
     93    {
     94        MutexLocker locker(m_pathsAndConnectionsMutex);
     95        ASSERT(m_pathsAndConnections.contains(pluginProcessConnection->pluginPath()));
     96       
     97        m_pathsAndConnections.remove(pluginProcessConnection->pluginPath());
     98    }
     99
    86100    m_pluginProcessConnections.remove(vectorIndex);
     101}
     102
     103void PluginProcessConnectionManager::pluginProcessCrashed(const String& pluginPath)
     104{
     105    MutexLocker locker(m_pathsAndConnectionsMutex);
     106    CoreIPC::Connection* connection = m_pathsAndConnections.get(pluginPath).get();
     107
     108    // It's OK for connection to be null here; it will happen if this web process doesn't know
     109    // anything about the plug-in process.
     110    if (!connection)
     111        return;
     112
     113    connection->postConnectionDidCloseOnConnectionWorkQueue();
    87114}
    88115
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h

    r85566 r85573  
    3030
    3131#include <wtf/Forward.h>
     32#include <wtf/HashMap.h>
    3233#include <wtf/Noncopyable.h>
     34#include <wtf/Threading.h>
    3335#include <wtf/Vector.h>
     36#include <wtf/text/StringHash.h>
    3437
    3538// Manages plug-in process connections for the given web process.
     39
     40namespace CoreIPC {
     41    class Connection;
     42}
    3643
    3744namespace WebKit {
     
    4855    void removePluginProcessConnection(PluginProcessConnection*);
    4956
     57    // Called on the web process connection work queue.
     58    void pluginProcessCrashed(const String& pluginPath);
     59
    5060private:
    5161    Vector<RefPtr<PluginProcessConnection> > m_pluginProcessConnections;
     62
     63    Mutex m_pathsAndConnectionsMutex;
     64    HashMap<String, RefPtr<CoreIPC::Connection> > m_pathsAndConnections;
    5265};
    5366
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r85570 r85573  
    797797void WebProcess::pluginProcessCrashed(const String& pluginPath)
    798798{
    799     // FIXME: Implement.
     799    m_pluginProcessConnectionManager.pluginProcessCrashed(pluginPath);
    800800}
    801801#endif
Note: See TracChangeset for help on using the changeset viewer.