[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:32 UTC 2010


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

    Implement PluginProxy::destroy
    https://bugs.webkit.org/show_bug.cgi?id=46737
    
    Reviewed by Adam Roben.
    
    * Platform/CoreIPC/HandleMessage.h:
    (CoreIPC::handleMessage):
    Add overload for a sync message with one in parameter and no out parameters.
    
    * PluginProcess/WebProcessConnection.cpp:
    (WebKit::WebProcessConnection::destroyPluginControllerProxy):
    Rename this to avoid conflicts with the destroyPlugin message handler.
    
    (WebKit::WebProcessConnection::destroyPlugin):
    Call destroyPluginControllerProxy.
    
    * PluginProcess/WebProcessConnection.messages.in:
    Add DestroyPlugin message.
    
    * WebProcess/Plugins/PluginProcessConnection.cpp:
    (WebKit::PluginProcessConnection::didClose):
    
    * WebProcess/Plugins/PluginProxy.cpp:
    (WebKit::PluginProxy::PluginProxy):
    (WebKit::PluginProxy::~PluginProxy):
    Don't add and/the plug-in proxy from the map in the constructor/destructor. Instead,
    do it in initialize/destroy, since otherwise we could be calling pluginProcessCrashed on a
    PluginController that had already been freed.
    
    (WebKit::PluginProxy::initialize):
    (WebKit::PluginProxy::destroy):
    send the DestroyPlugin message.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68545 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index b9e3ed6..f30d49d 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -91,6 +91,41 @@
 
         Reviewed by Adam Roben.
 
+        Implement PluginProxy::destroy
+        https://bugs.webkit.org/show_bug.cgi?id=46737
+
+        * Platform/CoreIPC/HandleMessage.h:
+        (CoreIPC::handleMessage):
+        Add overload for a sync message with one in parameter and no out parameters.
+
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::destroyPluginControllerProxy):
+        Rename this to avoid conflicts with the destroyPlugin message handler.
+
+        (WebKit::WebProcessConnection::destroyPlugin):
+        Call destroyPluginControllerProxy.
+
+        * PluginProcess/WebProcessConnection.messages.in:
+        Add DestroyPlugin message.
+
+        * WebProcess/Plugins/PluginProcessConnection.cpp:
+        (WebKit::PluginProcessConnection::didClose):
+        
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::PluginProxy):
+        (WebKit::PluginProxy::~PluginProxy):
+        Don't add and/the plug-in proxy from the map in the constructor/destructor. Instead,
+        do it in initialize/destroy, since otherwise we could be calling pluginProcessCrashed on a
+        PluginController that had already been freed.
+
+        (WebKit::PluginProxy::initialize):
+        (WebKit::PluginProxy::destroy):
+        send the DestroyPlugin message.
+
+2010-09-28  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Adam Roben.
+
         Improve plug-in process lifecycle handling
         https://bugs.webkit.org/show_bug.cgi?id=46734
 
diff --git a/WebKit2/Platform/CoreIPC/HandleMessage.h b/WebKit2/Platform/CoreIPC/HandleMessage.h
index a521df3..8209dbd 100644
--- a/WebKit2/Platform/CoreIPC/HandleMessage.h
+++ b/WebKit2/Platform/CoreIPC/HandleMessage.h
@@ -48,6 +48,16 @@ void handleMessage(ArgumentDecoder* arguments, C* object, void (C::*function)(P1
     (object->*function)(firstArgument, secondArgument, thirdArgument);
 }
 
+template<typename T, typename C, typename P1>
+void handleMessage(ArgumentDecoder* arguments, ArgumentEncoder* reply, C* object, void (C::*function)(P1))
+{
+    typename RemoveReference<typename T::FirstArgumentType>::Type firstArgument;
+    if (!arguments->decode(firstArgument))
+        return;
+
+    (object->*function)(firstArgument);
+}
+
 template<typename T, typename C, typename P1, typename P2, typename R1>
 void handleMessage(ArgumentDecoder* arguments, ArgumentEncoder* reply, C* object, void (C::*function)(P1, P2, R1&))
 {
diff --git a/WebKit2/PluginProcess/WebProcessConnection.cpp b/WebKit2/PluginProcess/WebProcessConnection.cpp
index 3bab303..076a2b6 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.cpp
+++ b/WebKit2/PluginProcess/WebProcessConnection.cpp
@@ -57,7 +57,7 @@ void WebProcessConnection::addPluginControllerProxy(PassOwnPtr<PluginControllerP
     m_pluginControllers.set(pluginInstanceID, pluginController.leakPtr());
 }
 
-void WebProcessConnection::destroyPlugin(PluginControllerProxy* pluginController)
+void WebProcessConnection::destroyPluginControllerProxy(PluginControllerProxy* pluginController)
 {
     pluginController->destroy();
     
@@ -103,7 +103,15 @@ void WebProcessConnection::didClose(CoreIPC::Connection*)
     copyValuesToVector(m_pluginControllers, pluginControllers);
 
     for (size_t i = 0; i < pluginControllers.size(); ++i)
-        destroyPlugin(pluginControllers[i]);
+        destroyPluginControllerProxy(pluginControllers[i]);
+}
+
+void WebProcessConnection::destroyPlugin(uint64_t pluginInstanceID)
+{
+    PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(pluginInstanceID);
+    ASSERT(pluginControllerProxy);
+
+    destroyPluginControllerProxy(pluginControllerProxy);
 }
 
 void WebProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID)
diff --git a/WebKit2/PluginProcess/WebProcessConnection.h b/WebKit2/PluginProcess/WebProcessConnection.h
index 051d17c..c2e5cd5 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.h
+++ b/WebKit2/PluginProcess/WebProcessConnection.h
@@ -51,7 +51,7 @@ private:
     void addPluginControllerProxy(PassOwnPtr<PluginControllerProxy>);
     void removePluginControllerProxy(PluginControllerProxy*);
 
-    void destroyPlugin(PluginControllerProxy*);
+    void destroyPluginControllerProxy(PluginControllerProxy*);
 
     // CoreIPC::Connection::Client
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
@@ -62,6 +62,7 @@ private:
     // Message handlers.
     CoreIPC::SyncReplyMode didReceiveSyncWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
     void createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters&, bool& result);
+    void destroyPlugin(uint64_t pluginInstanceID);
 
     RefPtr<CoreIPC::Connection> m_connection;
 
diff --git a/WebKit2/PluginProcess/WebProcessConnection.messages.in b/WebKit2/PluginProcess/WebProcessConnection.messages.in
index 5c6e52b..9c8217c 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.messages.in
+++ b/WebKit2/PluginProcess/WebProcessConnection.messages.in
@@ -25,6 +25,9 @@
 messages -> WebProcessConnection {
     # Creates a plug-in instance with the given instance ID.
     CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters) -> (bool result)
+
+    # Destroys the plug-in instance with the given instance ID.
+    DestroyPlugin(uint64_t pluginInstanceID) -> ()
 }
 
 #endif
diff --git a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
index d905a1e..5c9ec1e 100644
--- a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
@@ -76,7 +76,7 @@ void PluginProcessConnection::didReceiveMessage(CoreIPC::Connection* connection,
 void PluginProcessConnection::didClose(CoreIPC::Connection*)
 {
     // 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) {
+    for (HashMap<uint64_t, PluginProxy*>::const_iterator::Values it = m_plugins.begin().values(), end = m_plugins.end().values(); it != end; ++it) {
         PluginProxy* pluginProxy = (*it);
 
         pluginProxy->pluginProcessCrashed();
diff --git a/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
index b60dd6c..2541ea7 100644
--- a/WebKit2/WebProcess/Plugins/PluginProxy.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
@@ -54,12 +54,10 @@ PluginProxy::PluginProxy(PassRefPtr<PluginProcessConnection> connection)
     , m_isStarted(false)
 
 {
-    m_connection->addPluginProxy(this);
 }
 
 PluginProxy::~PluginProxy()
 {
-    m_connection->removePluginProxy(this);
 }
 
 void PluginProxy::pluginProcessCrashed()
@@ -87,14 +85,21 @@ bool PluginProxy::initialize(PluginController* pluginController, const Parameter
         return false;
 
     m_isStarted = true;
+    m_connection->addPluginProxy(this);
+
     return true;
 }
 
 void PluginProxy::destroy()
 {
-    m_pluginController = 0;
+    ASSERT(m_isStarted);
 
-    notImplemented();
+    m_connection->connection()->sendSync(Messages::WebProcessConnection::DestroyPlugin(m_pluginInstanceID),
+                                         Messages::WebProcessConnection::DestroyPlugin::Reply(),
+                                         0, CoreIPC::Connection::NoTimeout);
+
+    m_isStarted = false;
+    m_connection->removePluginProxy(this);
 }
 
 void PluginProxy::paint(GraphicsContext*, const IntRect& dirtyRect)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list