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


The following commit has been merged in the debian/experimental branch:
commit e85730369978257573833961f7b9a4b13e134065
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 1 20:47:43 2010 +0000

    Both the WebProcessConnection and PluginProcessConnection should have NPRemoteObjectMaps
    https://bugs.webkit.org/show_bug.cgi?id=48775
    
    Reviewed by Adam Roben.
    
    * PluginProcess/PluginControllerProxy.cpp:
    (WebKit::PluginControllerProxy::windowScriptNPObject):
    Ask for an NPObjectProxy for the window script NPObject.
    
    * PluginProcess/WebProcessConnection.cpp:
    (WebKit::WebProcessConnection::WebProcessConnection):
    Initialize m_npRemoteObjectMap.
    
    * Shared/Plugins/NPObjectMessageReceiver.cpp:
    (WebKit::NPObjectMessageReceiver::create):
    Add a create member function that takes an NPObject.
    
    (WebKit::NPObjectMessageReceiver::NPObjectMessageReceiver):
    Retain the NPObject.
    
    (WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver):
    Release the NPObject.
    
    * Shared/Plugins/NPRemoteObjectMap.cpp:
    (WebKit::generateNPObjectID):
    Generate a unique 64-bit NPObject ID.
    
    (WebKit::NPRemoteObjectMap::getOrCreateNPObjectProxy):
    Add stub.
    
    (WebKit::NPRemoteObjectMap::registerNPObject):
    Create a NPObjectMessageReceiver and add it to the map.
    
    * WebKit2.xcodeproj/project.pbxproj:
    Set the correct target for NPRuntime related files.
    
    * WebProcess/Plugins/PluginProcessConnection.cpp:
    (WebKit::PluginProcessConnection::PluginProcessConnection):
    Initialize m_npRemoteObjectMap
    
    * WebProcess/Plugins/PluginProxy.cpp:
    (WebKit::PluginProxy::getWindowScriptNPObject):
    Ask the real plug-in controller for the window script NPObject and register it.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71051 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 0da0bad..988f3bd 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,49 @@
+2010-11-01  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Adam Roben.
+
+        Both the WebProcessConnection and PluginProcessConnection should have NPRemoteObjectMaps
+        https://bugs.webkit.org/show_bug.cgi?id=48775
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::windowScriptNPObject):
+        Ask for an NPObjectProxy for the window script NPObject.
+
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::WebProcessConnection):
+        Initialize m_npRemoteObjectMap.
+
+        * Shared/Plugins/NPObjectMessageReceiver.cpp:
+        (WebKit::NPObjectMessageReceiver::create):
+        Add a create member function that takes an NPObject.
+
+        (WebKit::NPObjectMessageReceiver::NPObjectMessageReceiver):
+        Retain the NPObject.
+
+        (WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver):
+        Release the NPObject.
+
+        * Shared/Plugins/NPRemoteObjectMap.cpp:
+        (WebKit::generateNPObjectID):
+        Generate a unique 64-bit NPObject ID.
+
+        (WebKit::NPRemoteObjectMap::getOrCreateNPObjectProxy):
+        Add stub.
+
+        (WebKit::NPRemoteObjectMap::registerNPObject):
+        Create a NPObjectMessageReceiver and add it to the map.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Set the correct target for NPRuntime related files.
+
+        * WebProcess/Plugins/PluginProcessConnection.cpp:
+        (WebKit::PluginProcessConnection::PluginProcessConnection):
+        Initialize m_npRemoteObjectMap
+
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::getWindowScriptNPObject):
+        Ask the real plug-in controller for the window script NPObject and register it.
+
 2010-11-01  John Sullivan  <sullivan at apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit2/PluginProcess/PluginControllerProxy.cpp b/WebKit2/PluginProcess/PluginControllerProxy.cpp
index f780e19..34a95e3 100644
--- a/WebKit2/PluginProcess/PluginControllerProxy.cpp
+++ b/WebKit2/PluginProcess/PluginControllerProxy.cpp
@@ -29,6 +29,7 @@
 
 #include "BackingStore.h"
 #include "DataReference.h"
+#include "NPObjectProxy.h"
 #include "NetscapePlugin.h"
 #include "NotImplemented.h"
 #include "PluginProcess.h"
@@ -169,9 +170,7 @@ NPObject* PluginControllerProxy::windowScriptNPObject()
     if (!windowScriptNPObjectID)
         return 0;
 
-    // FIXME: Do something with the windowScriptNPObjectID.
-    notImplemented();
-    return 0;
+    return m_connection->npRemoteObjectMap().getOrCreateNPObjectProxy(windowScriptNPObjectID);
 }
 
 NPObject* PluginControllerProxy::pluginElementNPObject()
diff --git a/WebKit2/PluginProcess/WebProcessConnection.cpp b/WebKit2/PluginProcess/WebProcessConnection.cpp
index 3b7601d..06a4f72 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.cpp
+++ b/WebKit2/PluginProcess/WebProcessConnection.cpp
@@ -44,8 +44,9 @@ 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_connection->open();
 }
 
diff --git a/WebKit2/PluginProcess/WebProcessConnection.h b/WebKit2/PluginProcess/WebProcessConnection.h
index 3b3e1c9..ea75bfe 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.h
+++ b/WebKit2/PluginProcess/WebProcessConnection.h
@@ -29,6 +29,7 @@
 #if ENABLE(PLUGIN_PROCESS)
 
 #include "Connection.h"
+#include "NPRemoteObjectMap.h"
 #include "Plugin.h"
 #include <wtf/RefCounted.h>
 
@@ -45,6 +46,8 @@ public:
 
     CoreIPC::Connection* connection() const { return m_connection.get(); }
 
+    NPRemoteObjectMap& npRemoteObjectMap() { return m_npRemoteObjectMap; }
+
 private:
     WebProcessConnection(CoreIPC::Connection::Identifier);
 
@@ -67,7 +70,7 @@ private:
     RefPtr<CoreIPC::Connection> m_connection;
 
     HashMap<uint64_t, PluginControllerProxy*> m_pluginControllers;
-
+    NPRemoteObjectMap m_npRemoteObjectMap;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
index 89b638b..933c6d8 100644
--- a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
+++ b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
@@ -23,18 +23,28 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if ENABLE(PLUGIN_PROCESS)
+
 #include "NPObjectMessageReceiver.h"
 
-#if ENABLE(PLUGIN_PROCESS)
+#include "NPRuntimeUtilities.h"
 
 namespace WebKit {
 
-NPObjectMessageReceiver::NPObjectMessageReceiver()
+PassOwnPtr<NPObjectMessageReceiver> NPObjectMessageReceiver::create(NPObject* npObject)
+{
+    return adoptPtr(new NPObjectMessageReceiver(npObject));
+}
+
+NPObjectMessageReceiver::NPObjectMessageReceiver(NPObject* npObject)
+    : m_npObject(npObject)
 {
+    retainNPObject(m_npObject);
 }
 
 NPObjectMessageReceiver::~NPObjectMessageReceiver()
 {
+    releaseNPObject(m_npObject);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h
index 8558191..1bca047 100644
--- a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h
+++ b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h
@@ -28,16 +28,23 @@
 
 #if ENABLE(PLUGIN_PROCESS)
 
+#include <WebCore/npruntime.h>
 #include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
 
 namespace WebKit {
 
 class NPObjectMessageReceiver {
     WTF_MAKE_NONCOPYABLE(NPObjectMessageReceiver);
 
-private:
-    NPObjectMessageReceiver();
+public:
+    static PassOwnPtr<NPObjectMessageReceiver> create(NPObject* npObject);
     ~NPObjectMessageReceiver();
+    
+private:
+    explicit NPObjectMessageReceiver(NPObject* npObject);
+
+    NPObject* m_npObject;
 };
     
 } // namespace WebKit
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
index f2d7605..d32bd83 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
@@ -27,13 +27,36 @@
 
 #include "NPRemoteObjectMap.h"
 
+#include "NPObjectMessageReceiver.h"
+#include <wtf/OwnPtr.h>
+
 namespace WebKit {
 
+static uint64_t generateNPObjectID()
+{
+    static uint64_t generateNPObjectID;
+    return ++generateNPObjectID;
+}
+    
 NPRemoteObjectMap::NPRemoteObjectMap(CoreIPC::Connection* connection)
     : m_connection(connection)
 {
 }
 
+NPObjectProxy* NPRemoteObjectMap::getOrCreateNPObjectProxy(uint64_t remoteObjectID)
+{
+    // FIXME: Implement.
+    return 0;
+}
+
+uint64_t NPRemoteObjectMap::registerNPObject(NPObject* npObject)
+{
+    uint64_t npObjectID = generateNPObjectID();
+    m_registeredNPObjects.set(npObjectID, NPObjectMessageReceiver::create(npObject).leakPtr());
+
+    return npObjectID;
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
index 1106328..fd461e6 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
@@ -28,6 +28,8 @@
 
 #if ENABLE(PLUGIN_PROCESS)
 
+#include <WebCore/npruntime.h>
+#include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
 
 namespace CoreIPC {
@@ -36,14 +38,27 @@ namespace CoreIPC {
 
 namespace WebKit {
 
+class NPObjectMessageReceiver;
+class NPObjectProxy;
+
 class NPRemoteObjectMap {
     WTF_MAKE_NONCOPYABLE(NPRemoteObjectMap);
 
 public:
     explicit NPRemoteObjectMap(CoreIPC::Connection*);
 
+    // Creates an NPObjectProxy wrapper for the remote object with the given remote object ID.
+    NPObjectProxy* getOrCreateNPObjectProxy(uint64_t remoteObjectID);
+
+    // Expose the given NPObject as a remote object. Returns the objectID.
+    uint64_t registerNPObject(NPObject*);
+
 private:
     CoreIPC::Connection* m_connection;
+
+    // A map of NPObjectMessageReceiver classes, wrapping objects that we export to the
+    // other end of the connection.
+    HashMap<uint64_t, NPObjectMessageReceiver*> m_registeredNPObjects;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 7c5a495..2afac01 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -71,7 +71,6 @@
 		1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A119A94127B796200A9ECB1 /* MessageSender.h */; };
 		1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; };
 		1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C648611F415B700553C19 /* WebContextMac.mm */; };
-		1A1FA253127A0E4F0050E709 /* NPRemoteObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */; };
 		1A1FA285127A13BC0050E709 /* NPObjectProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA284127A13BC0050E709 /* NPObjectProxy.cpp */; };
 		1A1FA35D127A45BF0050E709 /* NPObjectMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */; };
 		1A2161B011F37664008AD0F5 /* NPRuntimeObjectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2161AE11F37664008AD0F5 /* NPRuntimeObjectMap.h */; };
@@ -82,6 +81,12 @@
 		1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24B5F111F531E800C38269 /* MachUtilities.h */; };
 		1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24BED3120894D100FBB059 /* SharedMemory.h */; };
 		1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */; };
+		1A2D82A4127F4EAB001EB962 /* NPObjectMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */; };
+		1A2D82A5127F4EAB001EB962 /* NPObjectMessageReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA35B127A45BF0050E709 /* NPObjectMessageReceiver.h */; };
+		1A2D82A6127F4EAB001EB962 /* NPObjectProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA284127A13BC0050E709 /* NPObjectProxy.cpp */; };
+		1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA283127A13BC0050E709 /* NPObjectProxy.h */; };
+		1A2D82A8127F4EAB001EB962 /* NPRemoteObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */; };
+		1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA251127A0E4F0050E709 /* NPRemoteObjectMap.h */; };
 		1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */; };
 		1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */; };
 		1A3DD1FD125E59F3004515E6 /* WebFindClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */; };
@@ -2240,6 +2245,9 @@
 				51ACBBA0127A8F2C00D203B9 /* WebContextMenuProxyMac.h in Headers */,
 				1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */,
 				51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */,
+				1A2D82A5127F4EAB001EB962 /* NPObjectMessageReceiver.h in Headers */,
+				1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */,
+				1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2353,7 +2361,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				1A6FA31111E3921E00DB1371 /* MainMac.cpp in Sources */,
-				1A1FA253127A0E4F0050E709 /* NPRemoteObjectMap.cpp in Sources */,
 				1A1FA285127A13BC0050E709 /* NPObjectProxy.cpp in Sources */,
 				1A1FA35D127A45BF0050E709 /* NPObjectMessageReceiver.cpp in Sources */,
 			);
@@ -2572,6 +2579,9 @@
 				C0337DDD127A521C008FF4F4 /* WebPlatformTouchPoint.cpp in Sources */,
 				51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */,
 				51A84CE3127F386B00CA6EA4 /* WebContextMenuProxy.cpp in Sources */,
+				1A2D82A4127F4EAB001EB962 /* NPObjectMessageReceiver.cpp in Sources */,
+				1A2D82A6127F4EAB001EB962 /* NPObjectProxy.cpp in Sources */,
+				1A2D82A8127F4EAB001EB962 /* NPRemoteObjectMap.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
index cb4facd..13ba2d7 100644
--- a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
@@ -36,8 +36,9 @@ 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_connection->open();
 }
 
@@ -96,7 +97,6 @@ void PluginProcessConnection::didClose(CoreIPC::Connection*)
 
         pluginProxy->pluginProcessCrashed();
     }
-    
 }
 
 void PluginProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID)
diff --git a/WebKit2/WebProcess/Plugins/PluginProcessConnection.h b/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
index 2d2ef06..a9a5c62 100644
--- a/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
+++ b/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
@@ -29,8 +29,8 @@
 #if ENABLE(PLUGIN_PROCESS)
 
 #include "Connection.h"
+#include "NPRemoteObjectMap.h"
 #include "Plugin.h"
-
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
@@ -56,6 +56,8 @@ public:
     void addPluginProxy(PluginProxy*);
     void removePluginProxy(PluginProxy*);
 
+    NPRemoteObjectMap& npRemoteObjectMap() { return m_npRemoteObjectMap; }
+
 private:
     PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier);
 
@@ -74,6 +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;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
index b1ec3e4..3def6f8 100644
--- a/WebKit2/WebProcess/Plugins/PluginProxy.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
@@ -29,6 +29,7 @@
 
 #include "BackingStore.h"
 #include "DataReference.h"
+#include "NPRuntimeUtilities.h"
 #include "NotImplemented.h"
 #include "PluginController.h"
 #include "PluginControllerProxyMessages.h"
@@ -347,8 +348,14 @@ void PluginProxy::setCookiesForURL(const String& urlString, const String& cookie
 
 void PluginProxy::getWindowScriptNPObject(uint64_t& windowScriptNPObjectID)
 {
-    // FIXME: Actually get the window script object here.
-    windowScriptNPObjectID = 0;
+    NPObject* windowScriptNPObject = m_pluginController->windowScriptNPObject();
+    if (!windowScriptNPObject) {
+        windowScriptNPObjectID = 0;
+        return;
+    }
+
+    windowScriptNPObjectID = m_connection->npRemoteObjectMap().registerNPObject(windowScriptNPObject);
+    releaseNPObject(windowScriptNPObject);
 }
 
 void PluginProxy::update(const IntRect& paintedRect)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list