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


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

    * Platform/CoreIPC/Connection.h:
    (CoreIPC::Connection::sendSync):
    Add new sendSync overload that takes a message struct.
    
    Reviewed by Sam Weinig.
    
    * PluginProcess/WebProcessConnection.cpp:
    (WebKit::WebProcessConnection::didReceiveSyncMessage):
    Call didReceiveSyncWebProcessConnectionMessage.
    
    * WebProcess/Plugins/PluginProcessConnection.cpp:
    (WebKit::PluginProcessConnection::addPluginProxy):
    Add the plug-in proxy to the map.
    
    (WebKit::PluginProcessConnection::removePluginProxy):
    Remove the plug-in proxy from the map. If the map is empty, disconnect from the
    plug-in process.
    
    * WebProcess/Plugins/PluginProxy.cpp:
    (WebKit::generatePluginInstanceID):
    Generate a unique plug-in instance ID.
    
    (WebKit::PluginProxy::PluginProxy):
    Add the plug-in proxy to the map.
    
    (WebKit::PluginProxy::~PluginProxy):
    Remove the plug-in proxy from the map.
    
    (WebKit::PluginProxy::initialize):
    Ask the plug-in process to create a plug-in.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68452 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index d49a6ab..1dcd5c2 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,36 @@
+2010-09-27  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        * Platform/CoreIPC/Connection.h:
+        (CoreIPC::Connection::sendSync):
+        Add new sendSync overload that takes a message struct.
+
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::didReceiveSyncMessage):
+        Call didReceiveSyncWebProcessConnectionMessage.
+        
+        * WebProcess/Plugins/PluginProcessConnection.cpp:
+        (WebKit::PluginProcessConnection::addPluginProxy):
+        Add the plug-in proxy to the map.
+
+        (WebKit::PluginProcessConnection::removePluginProxy):
+        Remove the plug-in proxy from the map. If the map is empty, disconnect from the
+        plug-in process.
+
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::generatePluginInstanceID):
+        Generate a unique plug-in instance ID.
+
+        (WebKit::PluginProxy::PluginProxy):
+        Add the plug-in proxy to the map.
+        
+        (WebKit::PluginProxy::~PluginProxy):
+        Remove the plug-in proxy from the map.
+
+        (WebKit::PluginProxy::initialize):
+        Ask the plug-in process to create a plug-in.
+
 2010-09-27  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit2/Platform/CoreIPC/Connection.h b/WebKit2/Platform/CoreIPC/Connection.h
index eeaa5a7..9b2519b 100644
--- a/WebKit2/Platform/CoreIPC/Connection.h
+++ b/WebKit2/Platform/CoreIPC/Connection.h
@@ -100,8 +100,11 @@ public:
     template<typename T> bool send(const T& message, uint64_t destinationID);
 
     static const unsigned long long NoTimeout = 10000000000ULL;
+    // FIXME: This variant of send is deprecated, all clients should move to the overload that takes a message.
     template<typename E, typename T, typename U> bool sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout);
 
+    template<typename T> bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout);
+    
     template<typename E> PassOwnPtr<ArgumentDecoder> waitFor(E messageID, uint64_t destinationID, double timeout);
 
     bool sendMessage(MessageID, PassOwnPtr<ArgumentEncoder>);
@@ -252,6 +255,27 @@ inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& a
     return replyDecoder->decode(const_cast<U&>(reply));
 }
 
+template<typename T> bool Connection::sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout)
+{
+    OwnPtr<ArgumentEncoder> argumentEncoder(new ArgumentEncoder(destinationID));
+    
+    uint64_t syncRequestID = ++m_syncRequestID;
+
+    // Encode the sync request ID.
+    argumentEncoder->encode(syncRequestID);
+    
+    // Encode the rest of the input arguments.
+    argumentEncoder->encode(message);
+
+    // Now send the message and wait for a reply.
+    OwnPtr<ArgumentDecoder> replyDecoder = sendSyncMessage(MessageID(T::messageID, MessageID::SyncMessage), syncRequestID, argumentEncoder.release(), timeout);
+    if (!replyDecoder)
+        return false;
+
+    // Decode the reply.
+    return replyDecoder->decode(const_cast<typename T::Reply&>(reply));
+}
+
 template<typename E> inline PassOwnPtr<ArgumentDecoder> Connection::waitFor(E messageID, uint64_t destinationID, double timeout)
 {
     return waitForMessage(MessageID(messageID), destinationID, timeout);
diff --git a/WebKit2/PluginProcess/WebProcessConnection.cpp b/WebKit2/PluginProcess/WebProcessConnection.cpp
index 2532a40..b13f8b3 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.cpp
+++ b/WebKit2/PluginProcess/WebProcessConnection.cpp
@@ -53,8 +53,7 @@ void WebProcessConnection::didReceiveMessage(CoreIPC::Connection* connection, Co
 
 CoreIPC::SyncReplyMode WebProcessConnection::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
 {
-    // FIXME: Implement.
-    return CoreIPC::AutomaticReply;
+    return didReceiveSyncWebProcessConnectionMessage(connection, messageID, arguments, reply);
 }
 
 void WebProcessConnection::didClose(CoreIPC::Connection*)
diff --git a/WebKit2/WebKit2Prefix.h b/WebKit2/WebKit2Prefix.h
index 5811fa3..9fddc99 100644
--- a/WebKit2/WebKit2Prefix.h
+++ b/WebKit2/WebKit2Prefix.h
@@ -44,7 +44,7 @@
 #endif
 
 // FIXME: Enable once this works well enough.
-#define ENABLE_PLUGIN_PROCESS 0
+#define ENABLE_PLUGIN_PROCESS 1
 
 #import <CoreGraphics/CoreGraphics.h>
 
diff --git a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
index cdc572e..411d6aa 100644
--- a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
@@ -27,6 +27,8 @@
 
 #include "PluginProcessConnection.h"
 
+#include "PluginProcessConnectionManager.h"
+#include "PluginProxy.h"
 #include "WebProcess.h"
 
 namespace WebKit {
@@ -43,6 +45,29 @@ PluginProcessConnection::~PluginProcessConnection()
 {
 }
 
+void PluginProcessConnection::addPluginProxy(PluginProxy* plugin)
+{
+    ASSERT(!m_plugins.contains(plugin->pluginInstanceID()));
+    m_plugins.set(plugin->pluginInstanceID(), plugin);
+}
+
+void PluginProcessConnection::removePluginProxy(PluginProxy* plugin)
+{
+    ASSERT(m_plugins.contains(plugin->pluginInstanceID()));
+    m_plugins.remove(plugin->pluginInstanceID());
+
+    if (!m_plugins.isEmpty())
+        return;
+
+    // We have no more plug-ins, invalidate the connection to the plug-in process.
+    ASSERT(m_connection);
+    m_connection->invalidate();
+    m_connection = 0;
+
+    // This will cause us to be deleted.
+    m_pluginProcessConnectionManager->removePluginProcessConnection(this);
+}
+
 void PluginProcessConnection::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
     // FIXME: Implement.
diff --git a/WebKit2/WebProcess/Plugins/PluginProcessConnection.h b/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
index 0481632..68b2cee 100644
--- a/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
+++ b/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
@@ -38,8 +38,8 @@
 
 namespace WebKit {
 
-class PluginInstanceProxy;
 class PluginProcessConnectionManager;
+class PluginProxy;
     
 class PluginProcessConnection : public RefCounted<PluginProcessConnection>, CoreIPC::Connection::Client {
 public:
@@ -53,6 +53,9 @@ public:
 
     CoreIPC::Connection* connection() const { return m_connection.get(); }
 
+    void addPluginProxy(PluginProxy*);
+    void removePluginProxy(PluginProxy*);
+
 private:
     PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier);
 
@@ -66,6 +69,10 @@ private:
 
     // The connection from the web process to the plug-in process.
     RefPtr<CoreIPC::Connection> m_connection;
+
+    // The plug-ins. We use a weak reference to the plug-in proxies because the plug-in view holds the strong reference.
+    HashMap<uint64_t, PluginProxy*> m_plugins;
+
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
index c51eeec..00119ec 100644
--- a/WebKit2/WebProcess/Plugins/PluginProxy.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
@@ -29,11 +29,18 @@
 
 #include "NotImplemented.h"
 #include "PluginProcessConnection.h"
+#include "WebProcessConnectionMessages.h"
 
 using namespace WebCore;
 
 namespace WebKit {
 
+static uint64_t generatePluginInstanceID()
+{
+    static uint64_t uniquePluginInstanceID;
+    return ++uniquePluginInstanceID;
+}
+
 PassRefPtr<PluginProxy> PluginProxy::create(PassRefPtr<PluginProcessConnection> connection)
 {
     return adoptRef(new PluginProxy(connection));
@@ -41,17 +48,39 @@ PassRefPtr<PluginProxy> PluginProxy::create(PassRefPtr<PluginProcessConnection>
 
 PluginProxy::PluginProxy(PassRefPtr<PluginProcessConnection> connection)
     : m_connection(connection)
+    , m_pluginInstanceID(generatePluginInstanceID())
+    , m_pluginController(0)
+    , m_isStarted(false)
+
 {
+    m_connection->addPluginProxy(this);
 }
 
 PluginProxy::~PluginProxy()
 {
+    m_connection->removePluginProxy(this);
 }
 
-bool PluginProxy::initialize(PluginController*, const Parameters&)
+bool PluginProxy::initialize(PluginController* pluginController, const Parameters& parameters)
 {
-    notImplemented();
-    return false;
+    ASSERT(!m_pluginController);
+    ASSERT(pluginController);
+
+    m_pluginController = pluginController;
+
+    // Ask the plug-in process to create a plug-in.
+    bool result = false;
+
+    if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(m_pluginInstanceID, parameters),
+                                              Messages::WebProcessConnection::CreatePlugin::Reply(result),
+                                              0, CoreIPC::Connection::NoTimeout))
+        return false;
+
+    if (!result)
+        return false;
+
+    m_isStarted = true;
+    return true;
 }
 
 void PluginProxy::destroy()
diff --git a/WebKit2/WebProcess/Plugins/PluginProxy.h b/WebKit2/WebProcess/Plugins/PluginProxy.h
index 87c4c8e..343c05c 100644
--- a/WebKit2/WebProcess/Plugins/PluginProxy.h
+++ b/WebKit2/WebProcess/Plugins/PluginProxy.h
@@ -40,6 +40,8 @@ public:
     static PassRefPtr<PluginProxy> create(PassRefPtr<PluginProcessConnection>);
     ~PluginProxy();
 
+    uint64_t pluginInstanceID() const { return m_pluginInstanceID; }
+
 private:
     explicit PluginProxy(PassRefPtr<PluginProcessConnection>);
 
@@ -80,7 +82,12 @@ private:
     // CoreIPC::Connection::MessageReceiver
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
-    PassRefPtr<PluginProcessConnection> m_connection;
+    RefPtr<PluginProcessConnection> m_connection;
+    uint64_t m_pluginInstanceID;
+
+    PluginController* m_pluginController;
+
+    bool m_isStarted;
 };
 
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list