[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 13:52:13 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit d3f3d108dad6d3079471a07d993579289b8890b5
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 28 17:30:34 2010 +0000

    Improve plug-in process lifecycle handling
    https://bugs.webkit.org/show_bug.cgi?id=46734
    
    Reviewed by Adam Roben.
    
    * PluginProcess/WebProcessConnection.cpp:
    (WebKit::WebProcessConnection::destroyPlugin):
    Destroy and delete the plug-in.
    
    (WebKit::WebProcessConnection::didClose):
    Our web process crashed, go through and delete all plug-in instances.
    
    * UIProcess/Plugins/PluginProcessProxy.cpp:
    (WebKit::PluginProcessProxy::didClose):
    The plug-in process crashed. Go through all pending replies and send them so the
    web processes won't be blocked waiting for a reply.
    
    (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
    We need to remove the pending reply connection once we've sent the reply.
    
    * WebProcess/Plugins/PluginProcessConnection.cpp:
    (WebKit::PluginProcessConnection::didClose):
    The plug-in process crashed. Iterate over all proxies and let them know that the plug-in
    process has crashed.
    
    * WebProcess/Plugins/PluginProxy.cpp:
    (WebKit::PluginProxy::pluginProcessCrashed):
    Tell our controller that the plug-in process crashed.
    
    (WebKit::PluginProxy::destroy):
    Null out the controller.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68534 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 659d13b..8d14783 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,40 @@
 
         Reviewed by Adam Roben.
 
+        Improve plug-in process lifecycle handling
+        https://bugs.webkit.org/show_bug.cgi?id=46734
+
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::destroyPlugin):
+        Destroy and delete the plug-in.
+
+        (WebKit::WebProcessConnection::didClose):
+        Our web process crashed, go through and delete all plug-in instances.
+
+        * UIProcess/Plugins/PluginProcessProxy.cpp:
+        (WebKit::PluginProcessProxy::didClose):
+        The plug-in process crashed. Go through all pending replies and send them so the
+        web processes won't be blocked waiting for a reply.
+
+        (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
+        We need to remove the pending reply connection once we've sent the reply.
+
+        * WebProcess/Plugins/PluginProcessConnection.cpp:
+        (WebKit::PluginProcessConnection::didClose):
+        The plug-in process crashed. Iterate over all proxies and let them know that the plug-in
+        process has crashed.
+
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::pluginProcessCrashed):
+        Tell our controller that the plug-in process crashed.
+
+        (WebKit::PluginProxy::destroy):
+        Null out the controller.
+
+2010-09-28  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Adam Roben.
+
         Implement PluginControllerProxy::initialize and have it create a plug-in
         https://bugs.webkit.org/show_bug.cgi?id=46731
 
diff --git a/WebKit2/PluginProcess/WebProcessConnection.cpp b/WebKit2/PluginProcess/WebProcessConnection.cpp
index b97cedc..3bab303 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.cpp
+++ b/WebKit2/PluginProcess/WebProcessConnection.cpp
@@ -57,6 +57,14 @@ void WebProcessConnection::addPluginControllerProxy(PassOwnPtr<PluginControllerP
     m_pluginControllers.set(pluginInstanceID, pluginController.leakPtr());
 }
 
+void WebProcessConnection::destroyPlugin(PluginControllerProxy* pluginController)
+{
+    pluginController->destroy();
+    
+    // This will delete the plug-in controller proxy object.
+    removePluginControllerProxy(pluginController);
+}
+
 void WebProcessConnection::removePluginControllerProxy(PluginControllerProxy* pluginController)
 {
     {
@@ -89,7 +97,13 @@ CoreIPC::SyncReplyMode WebProcessConnection::didReceiveSyncMessage(CoreIPC::Conn
 
 void WebProcessConnection::didClose(CoreIPC::Connection*)
 {
-    // FIXME: Implement.
+    // The web process crashed. Destroy all the plug-in controllers. Destroying the last plug-in controller
+    // will cause the web process connection itself to be destroyed.
+    Vector<PluginControllerProxy*> pluginControllers;
+    copyValuesToVector(m_pluginControllers, pluginControllers);
+
+    for (size_t i = 0; i < pluginControllers.size(); ++i)
+        destroyPlugin(pluginControllers[i]);
 }
 
 void WebProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID)
diff --git a/WebKit2/PluginProcess/WebProcessConnection.h b/WebKit2/PluginProcess/WebProcessConnection.h
index a8600c1..051d17c 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.h
+++ b/WebKit2/PluginProcess/WebProcessConnection.h
@@ -51,6 +51,8 @@ private:
     void addPluginControllerProxy(PassOwnPtr<PluginControllerProxy>);
     void removePluginControllerProxy(PluginControllerProxy*);
 
+    void destroyPlugin(PluginControllerProxy*);
+
     // CoreIPC::Connection::Client
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     virtual CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
diff --git a/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
index 931ab91..ddc430d 100644
--- a/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
+++ b/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
@@ -81,6 +81,17 @@ void PluginProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, Core
 
 void PluginProcessProxy::didClose(CoreIPC::Connection*)
 {
+    // The plug-in process must have crashed or exited, send any pending sync replies we might have.
+    while (!m_pendingConnectionReplies.isEmpty()) {
+        RefPtr<WebProcessProxy> replyWebProcessProxy = m_pendingConnectionReplies.first().first.release();
+        CoreIPC::ArgumentEncoder* reply = m_pendingConnectionReplies.first().second;
+        m_pendingConnectionReplies.removeFirst();
+
+        // FIXME: This is Mac specific.
+        reply->encode(CoreIPC::MachPort(0, MACH_MSG_TYPE_MOVE_SEND));
+        replyWebProcessProxy->connection()->sendSyncReply(reply);
+    }
+
     // Tell the plug-in process manager to forget about this plug-in process proxy.
     m_pluginProcessManager->removePluginProcessProxy(this);
     delete this;
@@ -114,7 +125,8 @@ void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::MachPort&
     // Grab the first pending connection reply.
     RefPtr<WebProcessProxy> replyWebProcessProxy = m_pendingConnectionReplies.first().first.release();
     CoreIPC::ArgumentEncoder* reply = m_pendingConnectionReplies.first().second;
-    
+    m_pendingConnectionReplies.removeFirst();
+
     // FIXME: This is Mac specific.
     reply->encode(CoreIPC::MachPort(machPort.port(), MACH_MSG_TYPE_MOVE_SEND));
     replyWebProcessProxy->connection()->sendSyncReply(reply);
diff --git a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
index 411d6aa..d905a1e 100644
--- a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
@@ -75,7 +75,13 @@ void PluginProcessConnection::didReceiveMessage(CoreIPC::Connection* connection,
 
 void PluginProcessConnection::didClose(CoreIPC::Connection*)
 {
-    // FIXME: Implement.
+    // The plug-in process must have crashed.
+    for (HashMap<uint64_t, PluginProxy*>::const_iterator it = m_plugins.begin().values(), end = m_plugins.end().values(); it != end; ++it) {
+        PluginProxy* pluginProxy = (*it);
+
+        pluginProxy->pluginProcessCrashed();
+    }
+    
 }
 
 void PluginProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID)
diff --git a/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
index 00119ec..b60dd6c 100644
--- a/WebKit2/WebProcess/Plugins/PluginProxy.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
@@ -28,6 +28,7 @@
 #include "PluginProxy.h"
 
 #include "NotImplemented.h"
+#include "PluginController.h"
 #include "PluginProcessConnection.h"
 #include "WebProcessConnectionMessages.h"
 
@@ -61,6 +62,12 @@ PluginProxy::~PluginProxy()
     m_connection->removePluginProxy(this);
 }
 
+void PluginProxy::pluginProcessCrashed()
+{
+    if (m_pluginController)
+        m_pluginController->pluginProcessCrashed();
+}
+
 bool PluginProxy::initialize(PluginController* pluginController, const Parameters& parameters)
 {
     ASSERT(!m_pluginController);
@@ -85,6 +92,8 @@ bool PluginProxy::initialize(PluginController* pluginController, const Parameter
 
 void PluginProxy::destroy()
 {
+    m_pluginController = 0;
+
     notImplemented();
 }
 
diff --git a/WebKit2/WebProcess/Plugins/PluginProxy.h b/WebKit2/WebProcess/Plugins/PluginProxy.h
index 343c05c..646f515 100644
--- a/WebKit2/WebProcess/Plugins/PluginProxy.h
+++ b/WebKit2/WebProcess/Plugins/PluginProxy.h
@@ -41,6 +41,7 @@ public:
     ~PluginProxy();
 
     uint64_t pluginInstanceID() const { return m_pluginInstanceID; }
+    void pluginProcessCrashed();
 
 private:
     explicit PluginProxy(PassRefPtr<PluginProcessConnection>);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list