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


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

    Start stubbing out NPClass functions in NPObjectProxy
    https://bugs.webkit.org/show_bug.cgi?id=48778
    
    Reviewed by Adam Roben.
    
    * PluginProcess/PluginControllerProxy.cpp:
    (WebKit::PluginControllerProxy::windowScriptNPObject):
    getOrCreateNPObjectProxy is now createNPObjectProxy.
    
    * Shared/Plugins/NPObjectProxy.cpp:
    (WebKit::NPObjectProxy::create):
    Allocate and initialize an NPObjectProxy object.
    
    (WebKit::NPObjectProxy::NPObjectProxy):
    Initialize m_npObjectID to 0.
    
    (WebKit::NPObjectProxy::isNPObjectProxy):
    Check the class.
    
    (WebKit::NPObjectProxy::initialize):
    Set m_npObjectID.
    
    (WebKit::NPObjectProxy::npClass):
    Return the NPClass with all functions filled in.
    
    (WebKit::NPObjectProxy::NP_Allocate):
    Create a new NPObjectProxy object.
    
    (WebKit::NPObjectProxy::NP_Deallocate):
    Deallocate the NPObjectProxy object.
    
    (WebKit::NPObjectProxy::NP_HasMethod):
    (WebKit::NPObjectProxy::NP_Invoke):
    (WebKit::NPObjectProxy::NP_InvokeDefault):
    (WebKit::NPObjectProxy::NP_HasProperty):
    (WebKit::NPObjectProxy::NP_GetProperty):
    (WebKit::NPObjectProxy::NP_SetProperty):
    (WebKit::NPObjectProxy::NP_RemoveProperty):
    (WebKit::NPObjectProxy::NP_Enumerate):
    (WebKit::NPObjectProxy::NP_Construct):
    Add stubs.
    
    * Shared/Plugins/NPRemoteObjectMap.cpp:
    (WebKit::NPRemoteObjectMap::createNPObjectProxy):
    * Shared/Plugins/NPRemoteObjectMap.h:
    Rename getOrCreateNPObjectProxy to createNPObjectProxy.
    
    * WebProcess/Plugins/Netscape/NPJSObject.cpp:
    (WebKit::NPJSObject::NP_Allocate):
    Remove unused parameter.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71054 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 988f3bd..a7bb894 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,59 @@
 
         Reviewed by Adam Roben.
 
+        Start stubbing out NPClass functions in NPObjectProxy
+        https://bugs.webkit.org/show_bug.cgi?id=48778
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::windowScriptNPObject):
+        getOrCreateNPObjectProxy is now createNPObjectProxy.
+
+        * Shared/Plugins/NPObjectProxy.cpp:
+        (WebKit::NPObjectProxy::create):
+        Allocate and initialize an NPObjectProxy object.
+
+        (WebKit::NPObjectProxy::NPObjectProxy):
+        Initialize m_npObjectID to 0.
+
+        (WebKit::NPObjectProxy::isNPObjectProxy):
+        Check the class.
+
+        (WebKit::NPObjectProxy::initialize):
+        Set m_npObjectID.
+
+        (WebKit::NPObjectProxy::npClass):
+        Return the NPClass with all functions filled in.
+
+        (WebKit::NPObjectProxy::NP_Allocate):
+        Create a new NPObjectProxy object.
+
+        (WebKit::NPObjectProxy::NP_Deallocate):
+        Deallocate the NPObjectProxy object.
+
+        (WebKit::NPObjectProxy::NP_HasMethod):
+        (WebKit::NPObjectProxy::NP_Invoke):
+        (WebKit::NPObjectProxy::NP_InvokeDefault):
+        (WebKit::NPObjectProxy::NP_HasProperty):
+        (WebKit::NPObjectProxy::NP_GetProperty):
+        (WebKit::NPObjectProxy::NP_SetProperty):
+        (WebKit::NPObjectProxy::NP_RemoveProperty):
+        (WebKit::NPObjectProxy::NP_Enumerate):
+        (WebKit::NPObjectProxy::NP_Construct):
+        Add stubs.
+
+        * Shared/Plugins/NPRemoteObjectMap.cpp:
+        (WebKit::NPRemoteObjectMap::createNPObjectProxy):
+        * Shared/Plugins/NPRemoteObjectMap.h:
+        Rename getOrCreateNPObjectProxy to createNPObjectProxy.
+
+        * WebProcess/Plugins/Netscape/NPJSObject.cpp:
+        (WebKit::NPJSObject::NP_Allocate):
+        Remove unused parameter.
+
+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
 
diff --git a/WebKit2/PluginProcess/PluginControllerProxy.cpp b/WebKit2/PluginProcess/PluginControllerProxy.cpp
index 34a95e3..02f37d5 100644
--- a/WebKit2/PluginProcess/PluginControllerProxy.cpp
+++ b/WebKit2/PluginProcess/PluginControllerProxy.cpp
@@ -170,7 +170,7 @@ NPObject* PluginControllerProxy::windowScriptNPObject()
     if (!windowScriptNPObjectID)
         return 0;
 
-    return m_connection->npRemoteObjectMap().getOrCreateNPObjectProxy(windowScriptNPObjectID);
+    return m_connection->npRemoteObjectMap().createNPObjectProxy(windowScriptNPObjectID);
 }
 
 NPObject* PluginControllerProxy::pluginElementNPObject()
diff --git a/WebKit2/Shared/Plugins/NPObjectProxy.cpp b/WebKit2/Shared/Plugins/NPObjectProxy.cpp
index f2df8cc..7ae4e26 100644
--- a/WebKit2/Shared/Plugins/NPObjectProxy.cpp
+++ b/WebKit2/Shared/Plugins/NPObjectProxy.cpp
@@ -23,13 +23,25 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if ENABLE(PLUGIN_PROCESS)
+
 #include "NPObjectProxy.h"
 
-#if ENABLE(PLUGIN_PROCESS)
+#include "NotImplemented.h"
+#include "NPRuntimeUtilities.h"
 
 namespace WebKit {
 
+NPObjectProxy* NPObjectProxy::create(uint64_t npObjectID)
+{
+    NPObjectProxy* npObjectProxy = toNPObjectProxy(createNPObject(0, npClass()));
+    npObjectProxy->initialize(npObjectID);
+
+    return npObjectProxy;
+}
+
 NPObjectProxy::NPObjectProxy()
+    : m_npObjectID(0)
 {
 }
 
@@ -37,6 +49,105 @@ NPObjectProxy::~NPObjectProxy()
 {
 }
 
+bool NPObjectProxy::isNPObjectProxy(NPObject* npObject)
+{
+    return npObject->_class == npClass();
+}
+    
+void NPObjectProxy::initialize(uint64_t npObjectID)
+{
+    ASSERT(!m_npObjectID);
+    m_npObjectID = npObjectID;
+}
+
+NPClass* NPObjectProxy::npClass()
+{
+    static NPClass npClass = {
+        NP_CLASS_STRUCT_VERSION,
+        NP_Allocate,
+        NP_Deallocate,
+        0,
+        NP_HasMethod,
+        NP_Invoke,
+        NP_InvokeDefault,
+        NP_HasProperty,
+        NP_GetProperty,
+        NP_SetProperty,
+        NP_RemoveProperty,
+        NP_Enumerate,
+        NP_Construct
+    };
+
+    return &npClass;
+}
+
+NPObject* NPObjectProxy::NP_Allocate(NPP npp, NPClass*)
+{
+    ASSERT_UNUSED(npp, !npp);
+
+    return new NPObjectProxy;
+}
+
+void NPObjectProxy::NP_Deallocate(NPObject* npObject)
+{
+    NPObjectProxy* npObjectProxy = toNPObjectProxy(npObject);
+    delete npObjectProxy;
+}
+
+bool NPObjectProxy::NP_HasMethod(NPObject*, NPIdentifier methodName)
+{
+    notImplemented();
+    return false;
+}
+
+bool NPObjectProxy::NP_Invoke(NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+{
+    notImplemented();
+    return false;
+}
+
+bool NPObjectProxy::NP_InvokeDefault(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+{
+    notImplemented();
+    return false;
+}
+
+bool NPObjectProxy::NP_HasProperty(NPObject*, NPIdentifier propertyName)
+{
+    notImplemented();
+    return false;
+}
+
+bool NPObjectProxy::NP_GetProperty(NPObject*, NPIdentifier propertyName, NPVariant* result)
+{
+    notImplemented();
+    return false;
+}
+
+bool NPObjectProxy::NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value)
+{
+    notImplemented();
+    return false;
+}
+
+bool NPObjectProxy::NP_RemoveProperty(NPObject*, NPIdentifier propertyName)
+{
+    notImplemented();
+    return false;
+}
+
+bool NPObjectProxy::NP_Enumerate(NPObject*, NPIdentifier** identifiers, uint32_t* identifierCount)
+{
+    notImplemented();
+    return false;
+}
+
+bool NPObjectProxy::NP_Construct(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+{
+    notImplemented();
+    return false;
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)
diff --git a/WebKit2/Shared/Plugins/NPObjectProxy.h b/WebKit2/Shared/Plugins/NPObjectProxy.h
index a234ef0..f20999d 100644
--- a/WebKit2/Shared/Plugins/NPObjectProxy.h
+++ b/WebKit2/Shared/Plugins/NPObjectProxy.h
@@ -36,9 +36,37 @@ namespace WebKit {
 class NPObjectProxy : public NPObject {
     WTF_MAKE_NONCOPYABLE(NPObjectProxy);
 
+public:
+    static NPObjectProxy* create(uint64_t npObjectID);
+
+    static bool isNPObjectProxy(NPObject*);
+    
+    static NPObjectProxy* toNPObjectProxy(NPObject* npObject)
+    {
+        ASSERT(isNPObjectProxy(npObject));
+        return static_cast<NPObjectProxy*>(npObject);
+    }
+    
 private:
     NPObjectProxy();
     ~NPObjectProxy();
+
+    void initialize(uint64_t npObjectID);
+
+    static NPClass* npClass();
+    static NPObject* NP_Allocate(NPP, NPClass*);
+    static void NP_Deallocate(NPObject*);
+    static bool NP_HasMethod(NPObject*, NPIdentifier methodName);
+    static bool NP_Invoke(NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
+    static bool NP_InvokeDefault(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
+    static bool NP_HasProperty(NPObject*, NPIdentifier propertyName);
+    static bool NP_GetProperty(NPObject*, NPIdentifier propertyName, NPVariant* result);
+    static bool NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value);
+    static bool NP_RemoveProperty(NPObject*, NPIdentifier propertyName);
+    static bool NP_Enumerate(NPObject*, NPIdentifier** identifiers, uint32_t* identifierCount);
+    static bool NP_Construct(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
+
+    uint64_t m_npObjectID;
 };
     
 } // namespace WebKit
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
index d32bd83..c52708e 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
@@ -28,6 +28,7 @@
 #include "NPRemoteObjectMap.h"
 
 #include "NPObjectMessageReceiver.h"
+#include "NPObjectProxy.h"
 #include <wtf/OwnPtr.h>
 
 namespace WebKit {
@@ -43,10 +44,9 @@ NPRemoteObjectMap::NPRemoteObjectMap(CoreIPC::Connection* connection)
 {
 }
 
-NPObjectProxy* NPRemoteObjectMap::getOrCreateNPObjectProxy(uint64_t remoteObjectID)
+NPObjectProxy* NPRemoteObjectMap::createNPObjectProxy(uint64_t remoteObjectID)
 {
-    // FIXME: Implement.
-    return 0;
+    return NPObjectProxy::create(remoteObjectID);
 }
 
 uint64_t NPRemoteObjectMap::registerNPObject(NPObject* npObject)
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
index fd461e6..8197ddc 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
@@ -48,7 +48,7 @@ public:
     explicit NPRemoteObjectMap(CoreIPC::Connection*);
 
     // Creates an NPObjectProxy wrapper for the remote object with the given remote object ID.
-    NPObjectProxy* getOrCreateNPObjectProxy(uint64_t remoteObjectID);
+    NPObjectProxy* createNPObjectProxy(uint64_t remoteObjectID);
 
     // Expose the given NPObject as a remote object. Returns the objectID.
     uint64_t registerNPObject(NPObject*);
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp b/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
index deedf7b..f420bd1 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
@@ -323,7 +323,7 @@ NPClass* NPJSObject::npClass()
     return &npClass;
 }
     
-NPObject* NPJSObject::NP_Allocate(NPP npp, NPClass* npClass)
+NPObject* NPJSObject::NP_Allocate(NPP npp, NPClass*)
 {
     ASSERT_UNUSED(npp, !npp);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list