[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 11:18:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e5f07600ef7e81ed52f2adc66d117ea7f22a744b
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Jul 18 19:44:06 2010 +0000

    Implement more NPRuntime related NPN_ functions
    https://bugs.webkit.org/show_bug.cgi?id=42520
    
    Reviewed by Sam Weinig.
    
    * WebKit2.xcodeproj/project.pbxproj:
    * WebProcess/Plugins/NPRuntimeUtilities.cpp: Added.
    * WebProcess/Plugins/NPRuntimeUtilities.h: Added.
    Add new file with NPRuntime related utility functions.
    
    * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
    (WebKit::NPN_CreateObject):
    (WebKit::NPN_RetainObject):
    (WebKit::NPN_ReleaseObject):
    Call the corresponding NPRuntimeUtilities functions.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63630 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index ee4bcc5..90f0fd2 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,23 @@
 2010-07-18  Anders Carlsson  <andersca at apple.com>
 
+        Reviewed by Sam Weinig.
+
+        Implement more NPRuntime related NPN_ functions
+        https://bugs.webkit.org/show_bug.cgi?id=42520
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/Plugins/NPRuntimeUtilities.cpp: Added.
+        * WebProcess/Plugins/NPRuntimeUtilities.h: Added.
+        Add new file with NPRuntime related utility functions.
+
+        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+        (WebKit::NPN_CreateObject):
+        (WebKit::NPN_RetainObject):
+        (WebKit::NPN_ReleaseObject):
+        Call the corresponding NPRuntimeUtilities functions.
+
+2010-07-18  Anders Carlsson  <andersca at apple.com>
+
         Reviewed by Dan Bernstein.
 
         Begin work on NPRuntime support
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index fab5b57..8212ee8 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -32,6 +32,8 @@
 		0F52667411DD4A490006D33C /* WebProcessProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F52667311DD4A490006D33C /* WebProcessProxyMac.mm */; };
 		1A10475A110A5AD500A43ECD /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */; };
 		1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; };
+		1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2162AE11F38971008AD0F5 /* NPRuntimeUtilities.cpp */; };
+		1A2162B111F38971008AD0F5 /* NPRuntimeUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2162AF11F38971008AD0F5 /* NPRuntimeUtilities.h */; };
 		1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */; };
 		1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */; };
 		1A3E736111CC2659007BD539 /* WebPlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */; };
@@ -297,6 +299,8 @@
 		0F5265BB11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayerBackedDrawingAreaProxyMac.mm; sourceTree = "<group>"; };
 		0F52667311DD4A490006D33C /* WebProcessProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessProxyMac.mm; sourceTree = "<group>"; };
 		1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+		1A2162AE11F38971008AD0F5 /* NPRuntimeUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeUtilities.cpp; sourceTree = "<group>"; };
+		1A2162AF11F38971008AD0F5 /* NPRuntimeUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPRuntimeUtilities.h; 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>"; };
 		1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPlatformStrategies.h; sourceTree = "<group>"; };
@@ -648,6 +652,8 @@
 				1A6FB90811E66FB100DB1371 /* Netscape */,
 				1A6FB7E511E6530500DB1371 /* DummyPlugin.cpp */,
 				1A6FB7E411E6530500DB1371 /* DummyPlugin.h */,
+				1A2162AE11F38971008AD0F5 /* NPRuntimeUtilities.cpp */,
+				1A2162AF11F38971008AD0F5 /* NPRuntimeUtilities.h */,
 				1A6FB7D011E651E200DB1371 /* Plugin.cpp */,
 				1A6FB7D111E651E200DB1371 /* Plugin.h */,
 				1AA56F2811E92BC80061B882 /* PluginController.h */,
@@ -1234,6 +1240,7 @@
 				BC8699B7116AADAA002A925B /* WKViewInternal.h in Headers */,
 				BC2E6E8C1141971500A63B1E /* WorkItem.h in Headers */,
 				BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */,
+				1A2162B111F38971008AD0F5 /* NPRuntimeUtilities.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1424,6 +1431,7 @@
 				BC8699B6116AADAA002A925B /* WKView.mm in Sources */,
 				BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */,
 				BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */,
+				1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/Plugins/NPRuntimeUtilities.cpp b/WebKit2/WebProcess/Plugins/NPRuntimeUtilities.cpp
new file mode 100644
index 0000000..4bad830
--- /dev/null
+++ b/WebKit2/WebProcess/Plugins/NPRuntimeUtilities.cpp
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+#include "NPRuntimeUtilities.h"
+
+namespace WebKit {
+
+NPObject* createNPObject(NPP npp, NPClass* npClass)
+{
+    ASSERT(npClass);
+    
+    NPObject* npObject;
+    if (npClass->allocate)
+        npObject = npClass->allocate(npp, npClass);
+    else {
+        // This should really call NPN_MemAlloc, but we know that it uses malloc
+        // under the hood so it's fine.
+        npObject = static_cast<NPObject*>(malloc(sizeof(NPObject)));
+    }
+
+    npObject->_class = npClass;
+    npObject->referenceCount = 1;
+    
+    return npObject;
+}
+
+void deallocateNPObject(NPObject* npObject)
+{
+    ASSERT(npObject);
+    if (!npObject)
+        return;
+
+    if (npObject->_class->deallocate)
+        npObject->_class->deallocate(npObject);
+    else {
+        // This should really call NPN_MemFree, but we know that it uses free
+        // under the hood so it's fine.
+        free(npObject);
+    }
+}
+
+void retainNPObject(NPObject* npObject)
+{
+    ASSERT(npObject);
+    if (!npObject)
+        return;
+
+    npObject->referenceCount++;
+}
+
+void releaseNPObject(NPObject* npObject)
+{
+    ASSERT(npObject);
+    if (!npObject)
+        return;
+    
+    ASSERT(npObject->referenceCount >= 1);
+    npObject->referenceCount--;
+    if (!npObject->referenceCount)
+        deallocateNPObject(npObject);
+}
+    
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/NPRuntimeUtilities.h b/WebKit2/WebProcess/Plugins/NPRuntimeUtilities.h
new file mode 100644
index 0000000..dea45f5
--- /dev/null
+++ b/WebKit2/WebProcess/Plugins/NPRuntimeUtilities.h
@@ -0,0 +1,44 @@
+/*
+ * 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 NPRuntimeUtilities_h
+#define NPRuntimeUtilities_h
+
+#include <WebCore/npruntime.h>
+
+struct NPClass;
+struct NPObject;
+
+namespace WebKit {
+
+NPObject* createNPObject(NPP, NPClass*);
+void deallocateNPObject(NPObject*);
+
+void retainNPObject(NPObject*);
+void releaseNPObject(NPObject*);
+
+}
+
+#endif // NPRuntimeUtilities_h
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index a998562..1d7b055 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -25,6 +25,7 @@
 
 #include "NetscapeBrowserFuncs.h"
 
+#include "NPRuntimeUtilities.h"
 #include "NetscapePlugin.h"
 #include "NotImplemented.h"
 #include <WebCore/IdentifierRep.h>
@@ -277,29 +278,18 @@ static int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
 
 static NPObject* NPN_CreateObject(NPP npp, NPClass *npClass)
 {
-    ASSERT(npClass);
-
-    NPObject* object;
-    if (npClass->allocate)
-        object = npClass->allocate(npp, npClass);
-    else
-        object = static_cast<NPObject*>(NPN_MemAlloc(sizeof(NPObject)));
-
-    object->_class = npClass;
-    object->referenceCount = 1;
-
-    return object;
+    return createNPObject(npp, npClass);
 }
 
-static NPObject *NPN_RetainObject(NPObject *npobj)
+static NPObject *NPN_RetainObject(NPObject *npObject)
 {
-    notImplemented();
-    return 0;
+    retainNPObject(npObject);
+    return npObject;
 }
 
-static void NPN_ReleaseObject(NPObject *npobj)
+static void NPN_ReleaseObject(NPObject *npObject)
 {
-    notImplemented();
+    releaseNPObject(npObject);
 }
 
 static bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list