[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 15:21:41 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 65406d98a3e1d46fb5b4b1bfcbd392ddf05bf446
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 2 00:12:48 2010 +0000

    Make NPRemoteObjectMap a ref counted object
    https://bugs.webkit.org/show_bug.cgi?id=48808
    
    Reviewed by Oliver Hunt.
    
    * PluginProcess/PluginControllerProxy.cpp:
    (WebKit::PluginControllerProxy::windowScriptNPObject):
    * PluginProcess/WebProcessConnection.cpp:
    (WebKit::WebProcessConnection::WebProcessConnection):
    (WebKit::WebProcessConnection::didReceiveSyncMessage):
    * PluginProcess/WebProcessConnection.h:
    (WebKit::WebProcessConnection::npRemoteObjectMap):
    * Shared/Plugins/NPRemoteObjectMap.cpp:
    (WebKit::NPRemoteObjectMap::create):
    (WebKit::NPRemoteObjectMap::~NPRemoteObjectMap):
    (WebKit::NPRemoteObjectMap::createNPObjectProxy):
    * Shared/Plugins/NPRemoteObjectMap.h:
    * WebProcess/Plugins/PluginProcessConnection.cpp:
    (WebKit::PluginProcessConnection::PluginProcessConnection):
    (WebKit::PluginProcessConnection::didReceiveSyncMessage):
    * WebProcess/Plugins/PluginProcessConnection.h:
    (WebKit::PluginProcessConnection::npRemoteObjectMap):
    * WebProcess/Plugins/PluginProxy.cpp:
    (WebKit::PluginProxy::getWindowScriptNPObject):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71081 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index f3d49af..11acb6d 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,32 @@
 2010-11-01  Anders Carlsson  <andersca at apple.com>
 
+        Reviewed by Oliver Hunt.
+
+        Make NPRemoteObjectMap a ref counted object
+        https://bugs.webkit.org/show_bug.cgi?id=48808
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::windowScriptNPObject):
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::WebProcessConnection):
+        (WebKit::WebProcessConnection::didReceiveSyncMessage):
+        * PluginProcess/WebProcessConnection.h:
+        (WebKit::WebProcessConnection::npRemoteObjectMap):
+        * Shared/Plugins/NPRemoteObjectMap.cpp:
+        (WebKit::NPRemoteObjectMap::create):
+        (WebKit::NPRemoteObjectMap::~NPRemoteObjectMap):
+        (WebKit::NPRemoteObjectMap::createNPObjectProxy):
+        * Shared/Plugins/NPRemoteObjectMap.h:
+        * WebProcess/Plugins/PluginProcessConnection.cpp:
+        (WebKit::PluginProcessConnection::PluginProcessConnection):
+        (WebKit::PluginProcessConnection::didReceiveSyncMessage):
+        * WebProcess/Plugins/PluginProcessConnection.h:
+        (WebKit::PluginProcessConnection::npRemoteObjectMap):
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::getWindowScriptNPObject):
+
+2010-11-01  Anders Carlsson  <andersca at apple.com>
+
         Reviewed by John Sullivan.
 
         Respond to NP_GetProperty by sending a GetProperty message
diff --git a/WebKit2/PluginProcess/PluginControllerProxy.cpp b/WebKit2/PluginProcess/PluginControllerProxy.cpp
index 02f37d5..83fe195 100644
--- a/WebKit2/PluginProcess/PluginControllerProxy.cpp
+++ b/WebKit2/PluginProcess/PluginControllerProxy.cpp
@@ -29,7 +29,7 @@
 
 #include "BackingStore.h"
 #include "DataReference.h"
-#include "NPObjectProxy.h"
+#include "NPRemoteObjectMap.h"
 #include "NetscapePlugin.h"
 #include "NotImplemented.h"
 #include "PluginProcess.h"
@@ -170,7 +170,7 @@ NPObject* PluginControllerProxy::windowScriptNPObject()
     if (!windowScriptNPObjectID)
         return 0;
 
-    return m_connection->npRemoteObjectMap().createNPObjectProxy(windowScriptNPObjectID);
+    return m_connection->npRemoteObjectMap()->createNPObjectProxy(windowScriptNPObjectID);
 }
 
 NPObject* PluginControllerProxy::pluginElementNPObject()
diff --git a/WebKit2/PluginProcess/WebProcessConnection.cpp b/WebKit2/PluginProcess/WebProcessConnection.cpp
index 21a850d..2502891 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.cpp
+++ b/WebKit2/PluginProcess/WebProcessConnection.cpp
@@ -27,6 +27,7 @@
 
 #include "WebProcessConnection.h"
 
+#include "NPRemoteObjectMap.h"
 #include "PluginControllerProxy.h"
 #include "PluginProcess.h"
 #include "RunLoop.h"
@@ -44,9 +45,10 @@ WebProcessConnection::~WebProcessConnection()
 }
     
 WebProcessConnection::WebProcessConnection(CoreIPC::Connection::Identifier connectionIdentifier)
-    : m_connection(CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main()))
-    , m_npRemoteObjectMap(m_connection.get())
 {
+    m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main());
+    m_npRemoteObjectMap = NPRemoteObjectMap::create(m_connection.get());
+
     m_connection->open();
 }
 
@@ -105,7 +107,7 @@ CoreIPC::SyncReplyMode WebProcessConnection::didReceiveSyncMessage(CoreIPC::Conn
         return didReceiveSyncWebProcessConnectionMessage(connection, messageID, arguments, reply);
 
     if (messageID.is<CoreIPC::MessageClassNPObjectMessageReceiver>())
-        return m_npRemoteObjectMap.didReceiveSyncMessage(connection, messageID, arguments, reply);
+        return m_npRemoteObjectMap->didReceiveSyncMessage(connection, messageID, arguments, reply);
 
     if (PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(destinationID))
         return pluginControllerProxy->didReceiveSyncPluginControllerProxyMessage(connection, messageID, arguments, reply);
diff --git a/WebKit2/PluginProcess/WebProcessConnection.h b/WebKit2/PluginProcess/WebProcessConnection.h
index ea75bfe..8555435 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.h
+++ b/WebKit2/PluginProcess/WebProcessConnection.h
@@ -29,12 +29,12 @@
 #if ENABLE(PLUGIN_PROCESS)
 
 #include "Connection.h"
-#include "NPRemoteObjectMap.h"
 #include "Plugin.h"
 #include <wtf/RefCounted.h>
 
 namespace WebKit {
 
+class NPRemoteObjectMap;
 class PluginControllerProxy;
     
 // A connection from a plug-in process to a web process.
@@ -46,7 +46,7 @@ public:
 
     CoreIPC::Connection* connection() const { return m_connection.get(); }
 
-    NPRemoteObjectMap& npRemoteObjectMap() { return m_npRemoteObjectMap; }
+    NPRemoteObjectMap* npRemoteObjectMap() const { return m_npRemoteObjectMap.get(); }
 
 private:
     WebProcessConnection(CoreIPC::Connection::Identifier);
@@ -70,7 +70,7 @@ private:
     RefPtr<CoreIPC::Connection> m_connection;
 
     HashMap<uint64_t, PluginControllerProxy*> m_pluginControllers;
-    NPRemoteObjectMap m_npRemoteObjectMap;
+    RefPtr<NPRemoteObjectMap> m_npRemoteObjectMap;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
index 66c794a..fadc713 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
@@ -38,13 +38,22 @@ static uint64_t generateNPObjectID()
     static uint64_t generateNPObjectID;
     return ++generateNPObjectID;
 }
-    
+
+PassRefPtr<NPRemoteObjectMap> NPRemoteObjectMap::create(CoreIPC::Connection* connection)
+{
+    return adoptRef(new NPRemoteObjectMap(connection));
+}
+
 NPRemoteObjectMap::NPRemoteObjectMap(CoreIPC::Connection* connection)
     : m_connection(connection)
 {
 }
 
-NPObjectProxy* NPRemoteObjectMap::createNPObjectProxy(uint64_t remoteObjectID)
+NPRemoteObjectMap::~NPRemoteObjectMap()
+{
+}
+
+NPObject* NPRemoteObjectMap::createNPObjectProxy(uint64_t remoteObjectID)
 {
     return NPObjectProxy::create(this, remoteObjectID);
 }
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
index 469376a..f0bf42a 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
@@ -31,21 +31,20 @@
 #include "Connection.h"
 #include <WebCore/npruntime.h>
 #include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
+#include <wtf/RefCounted.h>
 
 namespace WebKit {
 
 class NPObjectMessageReceiver;
 class NPObjectProxy;
 
-class NPRemoteObjectMap {
-    WTF_MAKE_NONCOPYABLE(NPRemoteObjectMap);
-
+class NPRemoteObjectMap : public RefCounted<NPRemoteObjectMap> {
 public:
-    explicit NPRemoteObjectMap(CoreIPC::Connection*);
+    static PassRefPtr<NPRemoteObjectMap> create(CoreIPC::Connection*);
+    ~NPRemoteObjectMap();
 
     // Creates an NPObjectProxy wrapper for the remote object with the given remote object ID.
-    NPObjectProxy* createNPObjectProxy(uint64_t remoteObjectID);
+    NPObject* createNPObjectProxy(uint64_t remoteObjectID);
 
     // Expose the given NPObject as a remote object. Returns the objectID.
     uint64_t registerNPObject(NPObject*);
@@ -55,6 +54,7 @@ public:
     CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply);
 
 private:
+    explicit NPRemoteObjectMap(CoreIPC::Connection*);
     CoreIPC::Connection* m_connection;
 
     // A map of NPObjectMessageReceiver classes, wrapping objects that we export to the
diff --git a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
index 3818aa5..013bc16 100644
--- a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
@@ -27,6 +27,7 @@
 
 #include "PluginProcessConnection.h"
 
+#include "NPRemoteObjectMap.h"
 #include "PluginProcessConnectionManager.h"
 #include "PluginProxy.h"
 #include "WebProcess.h"
@@ -36,9 +37,10 @@ namespace WebKit {
 PluginProcessConnection::PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier)
     : m_pluginProcessConnectionManager(pluginProcessConnectionManager)
     , m_pluginPath(pluginPath)
-    , m_connection(CoreIPC::Connection::createClientConnection(connectionIdentifier, this, WebProcess::shared().runLoop()))
-    , m_npRemoteObjectMap(m_connection.get())
 {
+    m_connection = CoreIPC::Connection::createClientConnection(connectionIdentifier, this, WebProcess::shared().runLoop());
+    m_npRemoteObjectMap = NPRemoteObjectMap::create(m_connection.get());
+
     m_connection->open();
 }
 
@@ -83,7 +85,7 @@ void PluginProcessConnection::didReceiveMessage(CoreIPC::Connection* connection,
 CoreIPC::SyncReplyMode PluginProcessConnection::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
 {
     if (messageID.is<CoreIPC::MessageClassNPObjectMessageReceiver>())
-        return m_npRemoteObjectMap.didReceiveSyncMessage(connection, messageID, arguments, reply);
+        return m_npRemoteObjectMap->didReceiveSyncMessage(connection, messageID, arguments, reply);
 
     if (PluginProxy* pluginProxy = m_plugins.get(arguments->destinationID()))
         return pluginProxy->didReceiveSyncPluginProxyMessage(connection, messageID, arguments, reply);
diff --git a/WebKit2/WebProcess/Plugins/PluginProcessConnection.h b/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
index a9a5c62..76e2315 100644
--- a/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
+++ b/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
@@ -29,7 +29,6 @@
 #if ENABLE(PLUGIN_PROCESS)
 
 #include "Connection.h"
-#include "NPRemoteObjectMap.h"
 #include "Plugin.h"
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -38,6 +37,7 @@
 
 namespace WebKit {
 
+class NPRemoteObjectMap;
 class PluginProcessConnectionManager;
 class PluginProxy;
     
@@ -56,7 +56,7 @@ public:
     void addPluginProxy(PluginProxy*);
     void removePluginProxy(PluginProxy*);
 
-    NPRemoteObjectMap& npRemoteObjectMap() { return m_npRemoteObjectMap; }
+    NPRemoteObjectMap* npRemoteObjectMap() const { return m_npRemoteObjectMap.get(); }
 
 private:
     PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier);
@@ -76,7 +76,7 @@ private:
     // 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;
 
-    NPRemoteObjectMap m_npRemoteObjectMap;
+    RefPtr<NPRemoteObjectMap> m_npRemoteObjectMap;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
index 3def6f8..fa1b3da 100644
--- a/WebKit2/WebProcess/Plugins/PluginProxy.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
@@ -29,6 +29,7 @@
 
 #include "BackingStore.h"
 #include "DataReference.h"
+#include "NPRemoteObjectMap.h"
 #include "NPRuntimeUtilities.h"
 #include "NotImplemented.h"
 #include "PluginController.h"
@@ -354,7 +355,7 @@ void PluginProxy::getWindowScriptNPObject(uint64_t& windowScriptNPObjectID)
         return;
     }
 
-    windowScriptNPObjectID = m_connection->npRemoteObjectMap().registerNPObject(windowScriptNPObject);
+    windowScriptNPObjectID = m_connection->npRemoteObjectMap()->registerNPObject(windowScriptNPObject);
     releaseNPObject(windowScriptNPObject);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list