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


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

    Respond to NP_GetProperty by sending a GetProperty message
    https://bugs.webkit.org/show_bug.cgi?id=48797
    
    Reviewed by John Sullivan.
    
    * Platform/CoreIPC/HandleMessage.h:
    (CoreIPC::callMemberFunction):
    Add new sync message overload.
    
    * PluginProcess/WebProcessConnection.cpp:
    (WebKit::WebProcessConnection::didReceiveSyncMessage):
    If the message class is MessageClassNPObjectMessageReceiver, pass it to the NPRemoteObjectMap.
    
    * Shared/Plugins/NPIdentifierData.cpp:
    * Shared/Plugins/NPIdentifierData.h:
    Add NPIdentifierData, a CoreIPC representation of an NPIdentifier.
    
    * Shared/Plugins/NPObjectMessageReceiver.cpp:
    (WebKit::NPObjectMessageReceiver::getProperty):
    Add stub.
    
    * Shared/Plugins/NPObjectMessageReceiver.messages.in:
    Add GetProperty.
    
    * Shared/Plugins/NPObjectProxy.cpp:
    (WebKit::NPObjectProxy::create):
    (WebKit::NPObjectProxy::NPObjectProxy):
    (WebKit::NPObjectProxy::initialize):
    NPObjectProxy now takes an NPRemoteObjectMap in its create function.
    
    (WebKit::NPObjectProxy::getProperty):
    Send a GetProperty message.
    
    (WebKit::NPObjectProxy::NP_GetProperty):
    Call getProperty.
    
    * Shared/Plugins/NPRemoteObjectMap.cpp:
    (WebKit::NPRemoteObjectMap::createNPObjectProxy):
    Pass the NPRemoteObjectMap.
    
    (WebKit::NPRemoteObjectMap::didReceiveSyncMessage):
    Find the right message receiver and dispatch the message to it.
    
    * Shared/Plugins/NPVariantData.cpp:
    * Shared/Plugins/NPVariantData.h:
    Add NPVariantData, which will be a CoreIPC representation of an NPVariant.
    
    * WebKit2.xcodeproj/project.pbxproj:
    Add new files.
    
    * WebProcess/Plugins/PluginProcessConnection.cpp:
    (WebKit::PluginProcessConnection::didReceiveSyncMessage):
    If the message class is MessageClassNPObjectMessageReceiver, pass it to the NPRemoteObjectMap.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71075 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 3f704a3..b68b4dd 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -9,6 +9,71 @@
 
 2010-11-01  Anders Carlsson  <andersca at apple.com>
 
+        Reviewed by John Sullivan.
+
+        Respond to NP_GetProperty by sending a GetProperty message
+        https://bugs.webkit.org/show_bug.cgi?id=48797
+
+        * Platform/CoreIPC/HandleMessage.h:
+        (CoreIPC::callMemberFunction):
+        Add new sync message overload.
+
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::didReceiveSyncMessage):
+        If the message class is MessageClassNPObjectMessageReceiver, pass it to the NPRemoteObjectMap.
+
+        * Shared/Plugins/NPIdentifierData.cpp:
+        * Shared/Plugins/NPIdentifierData.h:
+        Add NPIdentifierData, a CoreIPC representation of an NPIdentifier.
+
+        * Shared/Plugins/NPObjectMessageReceiver.cpp:
+        (WebKit::NPObjectMessageReceiver::getProperty):
+        Add stub.
+
+        * Shared/Plugins/NPObjectMessageReceiver.messages.in:
+        Add GetProperty.
+
+        * Shared/Plugins/NPObjectProxy.cpp:
+        (WebKit::NPObjectProxy::create):
+        (WebKit::NPObjectProxy::NPObjectProxy):
+        (WebKit::NPObjectProxy::initialize):
+        NPObjectProxy now takes an NPRemoteObjectMap in its create function.
+
+        (WebKit::NPObjectProxy::getProperty):
+        Send a GetProperty message.
+
+        (WebKit::NPObjectProxy::NP_GetProperty):
+        Call getProperty.
+
+        * Shared/Plugins/NPRemoteObjectMap.cpp:
+        (WebKit::NPRemoteObjectMap::createNPObjectProxy):
+        Pass the NPRemoteObjectMap.
+
+        (WebKit::NPRemoteObjectMap::didReceiveSyncMessage):
+        Find the right message receiver and dispatch the message to it.
+
+        * Shared/Plugins/NPVariantData.cpp:
+        * Shared/Plugins/NPVariantData.h:
+        Add NPVariantData, which will be a CoreIPC representation of an NPVariant.
+        
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * WebProcess/Plugins/PluginProcessConnection.cpp:
+        (WebKit::PluginProcessConnection::didReceiveSyncMessage):
+        If the message class is MessageClassNPObjectMessageReceiver, pass it to the NPRemoteObjectMap.
+
+2010-11-01  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Add ArgumentCoder specialization for WTF::CString
+        https://bugs.webkit.org/show_bug.cgi?id=48796
+
+        * Platform/CoreIPC/ArgumentCoders.h:
+
+2010-11-01  Anders Carlsson  <andersca at apple.com>
+
         Fix build.
 
         * WebKit2.xcodeproj/project.pbxproj:
diff --git a/WebKit2/Platform/CoreIPC/HandleMessage.h b/WebKit2/Platform/CoreIPC/HandleMessage.h
index 3a564fb..27e9864 100644
--- a/WebKit2/Platform/CoreIPC/HandleMessage.h
+++ b/WebKit2/Platform/CoreIPC/HandleMessage.h
@@ -85,6 +85,12 @@ void callMemberFunction(const Arguments1<P1>& args, Arguments1<R1>& replyArgs, C
     (object->*function)(args.argument1, replyArgs.argument1);
 }
 
+template<typename C, typename MF, typename P1, typename R1, typename R2>
+void callMemberFunction(const Arguments1<P1>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function)
+{
+    (object->*function)(args.argument1, replyArgs.argument1, replyArgs.argument2);
+}
+
 template<typename C, typename MF, typename P1, typename P2>
 void callMemberFunction(const Arguments2<P1, P2>& args, Arguments0&, C* object, MF function)
 {
diff --git a/WebKit2/PluginProcess/WebProcessConnection.cpp b/WebKit2/PluginProcess/WebProcessConnection.cpp
index 06a4f72..21a850d 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.cpp
+++ b/WebKit2/PluginProcess/WebProcessConnection.cpp
@@ -99,10 +99,15 @@ void WebProcessConnection::didReceiveMessage(CoreIPC::Connection* connection, Co
 
 CoreIPC::SyncReplyMode WebProcessConnection::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
 {
-    if (!arguments->destinationID())
+    uint64_t destinationID = arguments->destinationID();
+
+    if (!destinationID)
         return didReceiveSyncWebProcessConnectionMessage(connection, messageID, arguments, reply);
-    
-    if (PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(arguments->destinationID()))
+
+    if (messageID.is<CoreIPC::MessageClassNPObjectMessageReceiver>())
+        return m_npRemoteObjectMap.didReceiveSyncMessage(connection, messageID, arguments, reply);
+
+    if (PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(destinationID))
         return pluginControllerProxy->didReceiveSyncPluginControllerProxyMessage(connection, messageID, arguments, reply);
 
     return CoreIPC::AutomaticReply;
diff --git a/WebKit2/Shared/Plugins/NPIdentifierData.cpp b/WebKit2/Shared/Plugins/NPIdentifierData.cpp
new file mode 100644
index 0000000..2fe2127
--- /dev/null
+++ b/WebKit2/Shared/Plugins/NPIdentifierData.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(PLUGIN_PROCESS)
+
+#include "NPIdentifierData.h"
+
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+#include "NotImplemented.h"
+#include "WebCoreArgumentCoders.h"
+#include <WebCore/IdentifierRep.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+NPIdentifierData::NPIdentifierData()
+    : m_isString(false)
+    , m_number(0)
+{
+}
+
+
+NPIdentifierData NPIdentifierData::fromNPIdentifier(NPIdentifier npIdentifier)
+{
+    NPIdentifierData npIdentifierData;
+
+    IdentifierRep* identifierRep = static_cast<IdentifierRep*>(npIdentifier);
+    npIdentifierData.m_isString = identifierRep->isString();
+
+    if (npIdentifierData.m_isString)
+        npIdentifierData.m_string = identifierRep->string();
+    else
+        npIdentifierData.m_number = identifierRep->number();
+
+    return npIdentifierData;
+}
+
+void NPIdentifierData::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+    encoder->encode(m_isString);
+    if (m_isString)
+        encoder->encode(m_string);
+    else
+        encoder->encodeInt32(m_number);
+}
+
+bool NPIdentifierData::decode(CoreIPC::ArgumentDecoder* decoder, NPIdentifierData& result)
+{
+    if (!decoder->decode(result.m_isString))
+        return false;
+        
+    if (result.m_isString)
+        return decoder->decode(result.m_string);
+
+    return decoder->decodeInt32(result.m_number);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(PLUGIN_PROCESS)
diff --git a/WebKit2/Shared/Plugins/NPIdentifierData.h b/WebKit2/Shared/Plugins/NPIdentifierData.h
new file mode 100644
index 0000000..637ea46
--- /dev/null
+++ b/WebKit2/Shared/Plugins/NPIdentifierData.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NPIdentifierData_h
+#define NPIdentifierData_h
+
+#if ENABLE(PLUGIN_PROCESS)
+
+#include <WebCore/npruntime.h>
+#include <wtf/text/CString.h>
+
+namespace CoreIPC {
+    class ArgumentDecoder;
+    class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+// The CoreIPC representation of an NPIdentifier.
+
+class NPIdentifierData {
+public:
+    NPIdentifierData();
+    
+    static NPIdentifierData fromNPIdentifier(NPIdentifier);
+
+    void encode(CoreIPC::ArgumentEncoder*) const;
+    static bool decode(CoreIPC::ArgumentDecoder*, NPIdentifierData&);
+
+private:
+    bool m_isString;
+    CString m_string;
+    int m_number;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(PLUGIN_PROCESS)
+    
+#endif // NPIdentifierData_h
diff --git a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
index a9fc042..85775a1 100644
--- a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
+++ b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
@@ -27,6 +27,7 @@
 
 #include "NPObjectMessageReceiver.h"
 
+#include "NPIdentifierData.h"
 #include "NPRuntimeUtilities.h"
 #include "NotImplemented.h"
 
@@ -53,6 +54,12 @@ void NPObjectMessageReceiver::deallocate()
     notImplemented();
 }
 
+void NPObjectMessageReceiver::getProperty(const NPIdentifierData& propertyNameData, bool& returnValue, NPVariantData& result)
+{
+    notImplemented();
+    returnValue = false;
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)
diff --git a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h
index d6aa4b4..7d813a1 100644
--- a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h
+++ b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h
@@ -35,19 +35,24 @@
 
 namespace WebKit {
 
+class NPIdentifierData;
+class NPVariantData;
+
 class NPObjectMessageReceiver {
     WTF_MAKE_NONCOPYABLE(NPObjectMessageReceiver);
 
 public:
     static PassOwnPtr<NPObjectMessageReceiver> create(NPObject* npObject);
     ~NPObjectMessageReceiver();
+
+    CoreIPC::SyncReplyMode didReceiveSyncNPObjectMessageReceiverMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
     
 private:
     explicit NPObjectMessageReceiver(NPObject* npObject);
 
     // Message handlers.
-    CoreIPC::SyncReplyMode didReceiveSyncNPObjectMessageReceiverMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
     void deallocate();
+    void getProperty(const NPIdentifierData&, bool& returnValue, NPVariantData& result);
 
     NPObject* m_npObject;
 };
diff --git a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.messages.in b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.messages.in
index 2a458f3..158fcab 100644
--- a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.messages.in
+++ b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.messages.in
@@ -25,6 +25,9 @@
 messages -> NPObjectMessageReceiver {
     # Deallocate the NPObject.
     Deallocate() -> ()
+
+    # Get the given property.
+    GetProperty(WebKit::NPIdentifierData propertyName) -> (bool returnValue, WebKit::NPVariantData result)
 }
 
 #endif
diff --git a/WebKit2/Shared/Plugins/NPObjectProxy.cpp b/WebKit2/Shared/Plugins/NPObjectProxy.cpp
index 7ae4e26..f655f8f 100644
--- a/WebKit2/Shared/Plugins/NPObjectProxy.cpp
+++ b/WebKit2/Shared/Plugins/NPObjectProxy.cpp
@@ -27,21 +27,27 @@
 
 #include "NPObjectProxy.h"
 
-#include "NotImplemented.h"
+#include "Connection.h"
+#include "NPIdentifierData.h"
+#include "NPObjectMessageReceiverMessages.h"
+#include "NPRemoteObjectMap.h"
 #include "NPRuntimeUtilities.h"
+#include "NPVariantData.h"
+#include "NotImplemented.h"
 
 namespace WebKit {
 
-NPObjectProxy* NPObjectProxy::create(uint64_t npObjectID)
+NPObjectProxy* NPObjectProxy::create(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID)
 {
     NPObjectProxy* npObjectProxy = toNPObjectProxy(createNPObject(0, npClass()));
-    npObjectProxy->initialize(npObjectID);
+    npObjectProxy->initialize(npRemoteObjectMap, npObjectID);
 
     return npObjectProxy;
 }
 
 NPObjectProxy::NPObjectProxy()
-    : m_npObjectID(0)
+    : m_npRemoteObjectMap(0)
+    , m_npObjectID(0)
 {
 }
 
@@ -54,12 +60,35 @@ bool NPObjectProxy::isNPObjectProxy(NPObject* npObject)
     return npObject->_class == npClass();
 }
     
-void NPObjectProxy::initialize(uint64_t npObjectID)
+void NPObjectProxy::initialize(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID)
 {
+    ASSERT(!m_npRemoteObjectMap);
     ASSERT(!m_npObjectID);
+
+    ASSERT(npRemoteObjectMap);
+    ASSERT(npObjectID);
+
+    m_npRemoteObjectMap = npRemoteObjectMap;
     m_npObjectID = npObjectID;
 }
 
+bool NPObjectProxy::getProperty(NPIdentifier propertyName, NPVariant* result)
+{
+    if (!m_npRemoteObjectMap)
+        return false;
+
+    NPIdentifierData propertyNameData = NPIdentifierData::fromNPIdentifier(propertyName);
+
+    bool returnValue = false;
+    NPVariantData resultData;
+    
+    if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::GetProperty(propertyNameData), Messages::NPObjectMessageReceiver::GetProperty::Reply(returnValue, resultData), m_npObjectID))
+        return false;
+
+    notImplemented();    
+    return false;
+}
+
 NPClass* NPObjectProxy::npClass()
 {
     static NPClass npClass = {
@@ -118,10 +147,9 @@ bool NPObjectProxy::NP_HasProperty(NPObject*, NPIdentifier propertyName)
     return false;
 }
 
-bool NPObjectProxy::NP_GetProperty(NPObject*, NPIdentifier propertyName, NPVariant* result)
+bool NPObjectProxy::NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
 {
-    notImplemented();
-    return false;
+    return toNPObjectProxy(npObject)->getProperty(propertyName, result);
 }
 
 bool NPObjectProxy::NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value)
diff --git a/WebKit2/Shared/Plugins/NPObjectProxy.h b/WebKit2/Shared/Plugins/NPObjectProxy.h
index f20999d..a793ee0 100644
--- a/WebKit2/Shared/Plugins/NPObjectProxy.h
+++ b/WebKit2/Shared/Plugins/NPObjectProxy.h
@@ -33,11 +33,13 @@
 
 namespace WebKit {
 
+class NPRemoteObjectMap;
+
 class NPObjectProxy : public NPObject {
     WTF_MAKE_NONCOPYABLE(NPObjectProxy);
 
 public:
-    static NPObjectProxy* create(uint64_t npObjectID);
+    static NPObjectProxy* create(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID);
 
     static bool isNPObjectProxy(NPObject*);
     
@@ -51,7 +53,9 @@ private:
     NPObjectProxy();
     ~NPObjectProxy();
 
-    void initialize(uint64_t npObjectID);
+    void initialize(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID);
+
+    bool getProperty(NPIdentifier propertyName, NPVariant* result);
 
     static NPClass* npClass();
     static NPObject* NP_Allocate(NPP, NPClass*);
@@ -66,6 +70,7 @@ private:
     static bool NP_Enumerate(NPObject*, NPIdentifier** identifiers, uint32_t* identifierCount);
     static bool NP_Construct(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
 
+    NPRemoteObjectMap* m_npRemoteObjectMap;
     uint64_t m_npObjectID;
 };
     
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
index c52708e..66c794a 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
@@ -46,7 +46,7 @@ NPRemoteObjectMap::NPRemoteObjectMap(CoreIPC::Connection* connection)
 
 NPObjectProxy* NPRemoteObjectMap::createNPObjectProxy(uint64_t remoteObjectID)
 {
-    return NPObjectProxy::create(remoteObjectID);
+    return NPObjectProxy::create(this, remoteObjectID);
 }
 
 uint64_t NPRemoteObjectMap::registerNPObject(NPObject* npObject)
@@ -57,6 +57,15 @@ uint64_t NPRemoteObjectMap::registerNPObject(NPObject* npObject)
     return npObjectID;
 }
 
+CoreIPC::SyncReplyMode NPRemoteObjectMap::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
+{
+    NPObjectMessageReceiver* messageReceiver = m_registeredNPObjects.get(arguments->destinationID());
+    if (!messageReceiver)
+        return CoreIPC::AutomaticReply;
+
+    return messageReceiver->didReceiveSyncNPObjectMessageReceiverMessage(connection, messageID, arguments, reply);
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
index 8197ddc..469376a 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
@@ -28,14 +28,11 @@
 
 #if ENABLE(PLUGIN_PROCESS)
 
+#include "Connection.h"
 #include <WebCore/npruntime.h>
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
 
-namespace CoreIPC {
-    class Connection;
-}
-
 namespace WebKit {
 
 class NPObjectMessageReceiver;
@@ -53,6 +50,10 @@ public:
     // Expose the given NPObject as a remote object. Returns the objectID.
     uint64_t registerNPObject(NPObject*);
 
+    CoreIPC::Connection* connection() const { return m_connection; }
+
+    CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply);
+
 private:
     CoreIPC::Connection* m_connection;
 
diff --git a/WebKit2/Shared/Plugins/NPVariantData.cpp b/WebKit2/Shared/Plugins/NPVariantData.cpp
new file mode 100644
index 0000000..f0b1d48
--- /dev/null
+++ b/WebKit2/Shared/Plugins/NPVariantData.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(PLUGIN_PROCESS)
+
+#include "NPVariantData.h"
+
+#include "NotImplemented.h"
+
+namespace WebKit {
+
+void NPVariantData::encode(CoreIPC::ArgumentEncoder*) const
+{
+    notImplemented();
+}
+
+bool NPVariantData::decode(CoreIPC::ArgumentDecoder*, NPVariantData&)
+{
+    notImplemented();
+    return false;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(PLUGIN_PROCESS)
diff --git a/WebKit2/Shared/Plugins/NPVariantData.h b/WebKit2/Shared/Plugins/NPVariantData.h
new file mode 100644
index 0000000..734ae97
--- /dev/null
+++ b/WebKit2/Shared/Plugins/NPVariantData.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NPVariantData_h
+#define NPVariantData_h
+
+#if ENABLE(PLUGIN_PROCESS)
+
+namespace CoreIPC {
+    class ArgumentDecoder;
+    class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+// The CoreIPC representation of an NPVariant.
+
+class NPVariantData {
+public:
+    void encode(CoreIPC::ArgumentEncoder*) const;
+    static bool decode(CoreIPC::ArgumentDecoder*, NPVariantData&);
+    
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(PLUGIN_PROCESS)
+    
+#endif // NPVariantData_h
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 262b0be..ca10292 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -89,6 +89,10 @@
 		1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA251127A0E4F0050E709 /* NPRemoteObjectMap.h */; };
 		1A2D8439127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D8437127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp */; };
 		1A2D843A127F65D5001EB962 /* NPObjectMessageReceiverMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D8438127F65D5001EB962 /* NPObjectMessageReceiverMessages.h */; };
+		1A2D848B127F6A49001EB962 /* NPIdentifierData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D8489127F6A49001EB962 /* NPIdentifierData.h */; };
+		1A2D848C127F6A49001EB962 /* NPIdentifierData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D848A127F6A49001EB962 /* NPIdentifierData.cpp */; };
+		1A2D84A3127F6AD1001EB962 /* NPVariantData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D84A1127F6AD1001EB962 /* NPVariantData.h */; };
+		1A2D84A4127F6AD1001EB962 /* NPVariantData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D84A2127F6AD1001EB962 /* NPVariantData.cpp */; };
 		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 */; };
@@ -597,6 +601,10 @@
 		1A2D8411127F64E8001EB962 /* NPObjectMessageReceiver.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NPObjectMessageReceiver.messages.in; sourceTree = "<group>"; };
 		1A2D8437127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPObjectMessageReceiverMessageReceiver.cpp; sourceTree = "<group>"; };
 		1A2D8438127F65D5001EB962 /* NPObjectMessageReceiverMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPObjectMessageReceiverMessages.h; sourceTree = "<group>"; };
+		1A2D8489127F6A49001EB962 /* NPIdentifierData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPIdentifierData.h; sourceTree = "<group>"; };
+		1A2D848A127F6A49001EB962 /* NPIdentifierData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPIdentifierData.cpp; sourceTree = "<group>"; };
+		1A2D84A1127F6AD1001EB962 /* NPVariantData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPVariantData.h; sourceTree = "<group>"; };
+		1A2D84A2127F6AD1001EB962 /* NPVariantData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPVariantData.cpp; sourceTree = "<group>"; };
 		1A30066C1110F4F70031937C /* ResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResponsivenessTimer.h; sourceTree = "<group>"; };
 		1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectionMac.cpp; sourceTree = "<group>"; };
 		1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFindClient.cpp; sourceTree = "<group>"; };
@@ -1347,6 +1355,8 @@
 		1AAE058C1279DCD400852418 /* Plugins */ = {
 			isa = PBXGroup;
 			children = (
+				1A2D848A127F6A49001EB962 /* NPIdentifierData.cpp */,
+				1A2D8489127F6A49001EB962 /* NPIdentifierData.h */,
 				1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */,
 				1A1FA35B127A45BF0050E709 /* NPObjectMessageReceiver.h */,
 				1A2D8411127F64E8001EB962 /* NPObjectMessageReceiver.messages.in */,
@@ -1354,6 +1364,8 @@
 				1A1FA283127A13BC0050E709 /* NPObjectProxy.h */,
 				1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */,
 				1A1FA251127A0E4F0050E709 /* NPRemoteObjectMap.h */,
+				1A2D84A2127F6AD1001EB962 /* NPVariantData.cpp */,
+				1A2D84A1127F6AD1001EB962 /* NPVariantData.h */,
 			);
 			path = Plugins;
 			sourceTree = "<group>";
@@ -2257,6 +2269,8 @@
 				1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */,
 				1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */,
 				1A2D843A127F65D5001EB962 /* NPObjectMessageReceiverMessages.h in Headers */,
+				1A2D848B127F6A49001EB962 /* NPIdentifierData.h in Headers */,
+				1A2D84A3127F6AD1001EB962 /* NPVariantData.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2592,6 +2606,8 @@
 				1A2D82A6127F4EAB001EB962 /* NPObjectProxy.cpp in Sources */,
 				1A2D82A8127F4EAB001EB962 /* NPRemoteObjectMap.cpp in Sources */,
 				1A2D8439127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp in Sources */,
+				1A2D848C127F6A49001EB962 /* NPIdentifierData.cpp in Sources */,
+				1A2D84A4127F6AD1001EB962 /* NPVariantData.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
index 13ba2d7..3818aa5 100644
--- a/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
@@ -82,9 +82,12 @@ 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);
+
     if (PluginProxy* pluginProxy = m_plugins.get(arguments->destinationID()))
         return pluginProxy->didReceiveSyncPluginProxyMessage(connection, messageID, arguments, reply);
-    
+
     ASSERT_NOT_REACHED();
     return CoreIPC::AutomaticReply;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list