[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 11:45:12 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6ee848b07271f2886ae1c52f22a61bec2c85df2d
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 5 20:19:42 2010 +0000

    Reviewed Anders Carlsson.
    
    Add DOM Node wrapper class for injected bundle
    https://bugs.webkit.org/show_bug.cgi?id=43524
    
    - This class should not expose any DOM APIs, but just be a handle that can be used to get a JS
      wrapper for the node in a specific world.
    
    * Shared/APIObject.h:
    (WebKit::APIObject::):
    * WebKit2.xcodeproj/project.pbxproj:
    * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
    (WebKit::):
    * WebProcess/InjectedBundle/API/c/WKBundleBase.h:
    * WebProcess/InjectedBundle/API/c/WKBundleNode.h:
    * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: Added.
    (WKBundleNodeHandleGetTypeID):
    (WKBundleNodeHandleRetain):
    (WKBundleNodeHandleRelease):
    * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h: Added.
    * WebProcess/InjectedBundle/DOM: Added.
    * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: Added.
    (WebKit::domHandleCache):
    (WebKit::getDOMHandle):
    (WebKit::setDOMHandle):
    (WebKit::removeDOMHandle):
    (WebKit::InjectedBundleNodeHandle::getOrCreate):
    (WebKit::InjectedBundleNodeHandle::create):
    (WebKit::InjectedBundleNodeHandle::InjectedBundleNodeHandle):
    (WebKit::InjectedBundleNodeHandle::~InjectedBundleNodeHandle):
    * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: Added.
    (WebKit::InjectedBundleNodeHandle::type):
    * win/WebKit2.vcproj:
    * win/WebKit2Generated.make:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64778 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 6d0676b..099fe6d 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,40 @@
+2010-08-05  Sam Weinig  <sam at webkit.org>
+
+        Reviewed Anders Carlsson.
+
+        Add DOM Node wrapper class for injected bundle
+        https://bugs.webkit.org/show_bug.cgi?id=43524
+
+        - This class should not expose any DOM APIs, but just be a handle that can be used to get a JS
+          wrapper for the node in a specific world.
+
+        * Shared/APIObject.h:
+        (WebKit::APIObject::):
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
+        (WebKit::):
+        * WebProcess/InjectedBundle/API/c/WKBundleBase.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleNode.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: Added.
+        (WKBundleNodeHandleGetTypeID):
+        (WKBundleNodeHandleRetain):
+        (WKBundleNodeHandleRelease):
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h: Added.
+        * WebProcess/InjectedBundle/DOM: Added.
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: Added.
+        (WebKit::domHandleCache):
+        (WebKit::getDOMHandle):
+        (WebKit::setDOMHandle):
+        (WebKit::removeDOMHandle):
+        (WebKit::InjectedBundleNodeHandle::getOrCreate):
+        (WebKit::InjectedBundleNodeHandle::create):
+        (WebKit::InjectedBundleNodeHandle::InjectedBundleNodeHandle):
+        (WebKit::InjectedBundleNodeHandle::~InjectedBundleNodeHandle):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: Added.
+        (WebKit::InjectedBundleNodeHandle::type):
+        * win/WebKit2.vcproj:
+        * win/WebKit2Generated.make:
+
 2010-08-05  Anders Carlsson  <andersca at apple.com>
 
         Build fix.
diff --git a/WebKit2/Shared/APIObject.h b/WebKit2/Shared/APIObject.h
index 8722b93..fa1b498 100644
--- a/WebKit2/Shared/APIObject.h
+++ b/WebKit2/Shared/APIObject.h
@@ -55,7 +55,8 @@ public:
         TypeBundle,
         TypeBundleFrame,
         TypeBundlePage,
-        
+        TypeBundleNodeHandle,
+
         // Platform specific
         TypeView
     };
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 54b6cb1..97fe9c1 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -184,6 +184,10 @@
 		BC2E6E8C1141971500A63B1E /* WorkItem.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E7C1141970C00A63B1E /* WorkItem.h */; };
 		BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */; };
 		BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E7E1141970C00A63B1E /* WorkQueue.h */; };
+		BC4BEEAB120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */; };
+		BC4BEEAC120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */; };
+		BC4BEFE1120A1A4C00FBA0C7 /* WKBundleNodeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */; };
+		BC4BEFE2120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4BEFE0120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp */; };
 		BC59534210FC04520098F82D /* WebLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC59534010FC04520098F82D /* WebLoaderClient.h */; };
 		BC597075116591D000551FCA /* ProcessModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BC597074116591D000551FCA /* ProcessModel.h */; };
 		BC5F7BB41182376C0052C02C /* ChunkedUpdateDrawingArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5F7BB21182376C0052C02C /* ChunkedUpdateDrawingArea.cpp */; };
@@ -501,6 +505,10 @@
 		BC2E6E7C1141970C00A63B1E /* WorkItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkItem.h; sourceTree = "<group>"; };
 		BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; };
 		BC2E6E7E1141970C00A63B1E /* WorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueue.h; sourceTree = "<group>"; };
+		BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleNodeHandle.h; sourceTree = "<group>"; };
+		BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleNodeHandle.cpp; sourceTree = "<group>"; };
+		BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleNodeHandle.h; sourceTree = "<group>"; };
+		BC4BEFE0120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleNodeHandle.cpp; sourceTree = "<group>"; };
 		BC59534010FC04520098F82D /* WebLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebLoaderClient.h; sourceTree = "<group>"; };
 		BC597074116591D000551FCA /* ProcessModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessModel.h; sourceTree = "<group>"; };
 		BC5F7BB21182376C0052C02C /* ChunkedUpdateDrawingArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChunkedUpdateDrawingArea.cpp; sourceTree = "<group>"; };
@@ -1116,6 +1124,7 @@
 			children = (
 				BC204EE711C83EAD008F3375 /* API */,
 				BC204EE411C83E9C008F3375 /* mac */,
+				BC4BEE96120A091700FBA0C7 /* DOM */,
 				BC204EE011C83E98008F3375 /* InjectedBundle.cpp */,
 				BC204EE111C83E98008F3375 /* InjectedBundle.h */,
 				E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */,
@@ -1149,7 +1158,6 @@
 			children = (
 				BC204EE911C83EC8008F3375 /* WKBundle.cpp */,
 				BC204EEA11C83EC8008F3375 /* WKBundle.h */,
-				BCF049E511FE20F600F86A58 /* WKBundlePrivate.h */,
 				BC204EEB11C83EC8008F3375 /* WKBundleAPICast.h */,
 				BC204EEC11C83EC8008F3375 /* WKBundleBase.h */,
 				BCD25F1611D6BDE100169B0E /* WKBundleFrame.cpp */,
@@ -1158,9 +1166,12 @@
 				BC204EED11C83EC8008F3375 /* WKBundleInitialize.h */,
 				E1EE565511F8F71700CCBEE4 /* WKBundleNode.cpp */,
 				E1EE562F11F8F6AA00CCBEE4 /* WKBundleNode.h */,
+				BC4BEFE0120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp */,
+				BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */,
 				BC20528011C94284008F3375 /* WKBundlePage.cpp */,
 				BC20527F11C94284008F3375 /* WKBundlePage.h */,
 				BC1B419711D41D570011E8DD /* WKBundlePagePrivate.h */,
+				BCF049E511FE20F600F86A58 /* WKBundlePrivate.h */,
 				E1EE55F711F8F1BC00CCBEE4 /* WKBundleRange.cpp */,
 				E1EE55F311F8F18900CCBEE4 /* WKBundleRange.h */,
 			);
@@ -1196,6 +1207,15 @@
 			path = Platform;
 			sourceTree = "<group>";
 		};
+		BC4BEE96120A091700FBA0C7 /* DOM */ = {
+			isa = PBXGroup;
+			children = (
+				BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */,
+				BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */,
+			);
+			path = DOM;
+			sourceTree = "<group>";
+		};
 		BC8A500E11765AD400757573 /* WebKit2 */ = {
 			isa = PBXGroup;
 			children = (
@@ -1396,6 +1416,8 @@
 				1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */,
 				1A0F29CC120B37160053D1B9 /* VisitedLinkTable.h in Headers */,
 				1A0F29E4120B44420053D1B9 /* VisitedLinkProvider.h in Headers */,
+				BC4BEEAB120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.h in Headers */,
+				BC4BEFE1120A1A4C00FBA0C7 /* WKBundleNodeHandle.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1606,6 +1628,8 @@
 				1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */,
 				1A0F29CB120B37160053D1B9 /* VisitedLinkTable.cpp in Sources */,
 				1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */,
+				BC4BEEAC120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp in Sources */,
+				BC4BEFE2120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
index 52a33e2..6248d2d 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
@@ -40,24 +40,27 @@ namespace WebCore {
 namespace WebKit {
 
 class InjectedBundle;
+class InjectedBundleNodeHandle;
 class WebFrame;
 class WebPage;
 
 template<typename APIType> struct BundleAPITypeInfo { };
-template<> struct BundleAPITypeInfo<WKBundleCSSStyleDeclarationRef>     { typedef WebCore::CSSStyleDeclaration* ImplType; };
 template<> struct BundleAPITypeInfo<WKBundleFrameRef>                   { typedef WebFrame* ImplType; };
-template<> struct BundleAPITypeInfo<WKBundleNodeRef>                    { typedef WebCore::Node* ImplType; };
 template<> struct BundleAPITypeInfo<WKBundlePageRef>                    { typedef WebPage* ImplType; };
-template<> struct BundleAPITypeInfo<WKBundleRangeRef>                   { typedef WebCore::Range* ImplType; };
 template<> struct BundleAPITypeInfo<WKBundleRef>                        { typedef InjectedBundle* ImplType; };
+template<> struct BundleAPITypeInfo<WKBundleNodeHandleRef>              { typedef InjectedBundleNodeHandle* ImplType; };
+template<> struct BundleAPITypeInfo<WKBundleNodeRef>                    { typedef WebCore::Node* ImplType; };
+template<> struct BundleAPITypeInfo<WKBundleRangeRef>                   { typedef WebCore::Range* ImplType; };
+template<> struct BundleAPITypeInfo<WKBundleCSSStyleDeclarationRef>     { typedef WebCore::CSSStyleDeclaration* ImplType; };
 
 template<typename ImplType> struct BundleImplTypeInfo { };
 template<> struct BundleImplTypeInfo<InjectedBundle*>                   { typedef WKBundleRef APIType; };
+template<> struct BundleImplTypeInfo<InjectedBundleNodeHandle*>         { typedef WKBundleNodeHandleRef APIType; };
+template<> struct BundleImplTypeInfo<WebFrame*>                         { typedef WKBundleFrameRef APIType; };
+template<> struct BundleImplTypeInfo<WebPage*>                          { typedef WKBundlePageRef APIType; };
 template<> struct BundleImplTypeInfo<WebCore::CSSStyleDeclaration*>     { typedef WKBundleCSSStyleDeclarationRef APIType; };
 template<> struct BundleImplTypeInfo<WebCore::Node*>                    { typedef WKBundleNodeRef APIType; };
 template<> struct BundleImplTypeInfo<WebCore::Range*>                   { typedef WKBundleRangeRef APIType; };
-template<> struct BundleImplTypeInfo<WebFrame*>                         { typedef WKBundleFrameRef APIType; };
-template<> struct BundleImplTypeInfo<WebPage*>                          { typedef WKBundlePageRef APIType; };
 
 } // namespace WebKit
 
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
index 784f862..be5fda9 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
@@ -27,10 +27,12 @@
 #define WKBundleBase_h
 
 typedef struct OpaqueWKBundle* WKBundleRef;
-typedef struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
 typedef struct OpaqueWKBundleFrame* WKBundleFrameRef;
-typedef struct OpaqueWKBundleNode* WKBundleNodeRef;
+typedef struct OpaqueWKBundleNodeHandle* WKBundleNodeHandleRef;
 typedef struct OpaqueWKBundlePage* WKBundlePageRef;
+
+typedef struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
+typedef struct OpaqueWKBundleNode* WKBundleNodeRef;
 typedef struct OpaqueWKBundleRange* WKBundleRangeRef;
 
 #undef WK_EXPORT
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h
index ac2ed0f..39824bd 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h
@@ -29,10 +29,6 @@
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKBundleBase.h>
 
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
new file mode 100644
index 0000000..c982850
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
@@ -0,0 +1,48 @@
+/*
+ * 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 "WKBundleNodeHandle.h"
+
+#include "InjectedBundleNodeHandle.h"
+#include "WKAPICast.h"
+#include "WKBundleAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKBundleNodeHandleGetTypeID()
+{
+    return toRef(InjectedBundleNodeHandle::APIType);
+}
+
+WKBundleNodeHandleRef WKBundleNodeHandleRetain(WKBundleNodeHandleRef nodeHandleRef)
+{
+    toWK(nodeHandleRef)->ref();
+    return nodeHandleRef;
+}
+
+void WKBundleNodeHandleRelease(WKBundleNodeHandleRef nodeHandleRef)
+{
+    toWK(nodeHandleRef)->deref();
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h
new file mode 100644
index 0000000..af7d895
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h
@@ -0,0 +1,45 @@
+/*
+ * 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 WKBundleNodeHandle_h
+#define WKBundleNodeHandle_h
+
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKBundleBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKBundleNodeHandleGetTypeID();
+
+WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleRetain(WKBundleNodeHandleRef nodeHandle);
+WK_EXPORT void WKBundleNodeHandleRelease(WKBundleNodeHandleRef nodeHandle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKBundleNodeHandle_h */
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
new file mode 100644
index 0000000..35fcb8e
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.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.
+ */
+
+#include "InjectedBundleNodeHandle.h"
+
+#include <WebCore/Node.h>
+#include <wtf/HashMap.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+typedef HashMap<Node*, InjectedBundleNodeHandle*> DOMHandleCache;
+
+static DOMHandleCache& domHandleCache()
+{
+    DEFINE_STATIC_LOCAL(DOMHandleCache, cache, ());
+    return cache;
+}
+
+static inline InjectedBundleNodeHandle* getDOMHandle(Node* domObject)
+{
+    return domHandleCache().get(domObject);
+}
+
+static inline void setDOMHandle(Node* domObject, InjectedBundleNodeHandle* handle)
+{
+    domHandleCache().set(domObject, handle);
+}
+
+static inline void removeDOMHandle(Node* domObject)
+{
+    domHandleCache().remove(domObject);
+}
+
+PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(Node* node)
+{
+    std::pair<DOMHandleCache::iterator, bool> result = domHandleCache().add(node, 0);
+    if (!result.second)
+        return PassRefPtr<InjectedBundleNodeHandle>(result.first->second);
+
+    RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::create(node);
+    result.first->second = nodeHandle.get();
+    return nodeHandle.release();
+}
+
+PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::create(Node* node)
+{
+    return adoptRef(new InjectedBundleNodeHandle(node));
+}
+
+InjectedBundleNodeHandle::InjectedBundleNodeHandle(Node* node)
+    : m_node(node)
+{
+}
+
+InjectedBundleNodeHandle::~InjectedBundleNodeHandle()
+{
+    domHandleCache().remove(m_node.get());
+}
+
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
new file mode 100644
index 0000000..df9f5fc
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
@@ -0,0 +1,52 @@
+/*
+ * 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 "APIObject.h"
+#include <wtf/RefPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+    class Node;
+}
+
+namespace WebKit {
+
+class InjectedBundleNodeHandle : public APIObject {
+public:
+    static const Type APIType = TypeBundleNodeHandle;
+
+    static PassRefPtr<InjectedBundleNodeHandle> getOrCreate(WebCore::Node*);
+    ~InjectedBundleNodeHandle();
+
+private:
+    static PassRefPtr<InjectedBundleNodeHandle> create(WebCore::Node*);
+    InjectedBundleNodeHandle(WebCore::Node*);
+
+    virtual Type type() const { return APIType; }
+
+    RefPtr<WebCore::Node> m_node;
+};
+
+} // namespace WebKit
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index f19b47b..22daaae 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -778,6 +778,14 @@
 							>
 						</File>
 						<File
+							RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.cpp"
+							>
+						</File>
+						<File
+							RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.h"
+							>
+						</File>
+						<File
 							RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePage.cpp"
 							>
 						</File>
@@ -804,6 +812,18 @@
 					</Filter>
 				</Filter>
 				<Filter
+					Name="DOM"
+					>
+					<File
+						RelativePath="..\WebProcess\InjectedBundle\DOM\InjectedBundleNodeHandle.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\WebProcess\InjectedBundle\DOM\InjectedBundleNodeHandle.h"
+						>
+					</File>
+				</Filter>
+				<Filter
 					Name="win"
 					>
 					<File
diff --git a/WebKit2/win/WebKit2Generated.make b/WebKit2/win/WebKit2Generated.make
index b2f9905..97c8c51 100644
--- a/WebKit2/win/WebKit2Generated.make
+++ b/WebKit2/win/WebKit2Generated.make
@@ -30,6 +30,7 @@ all:
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleFramePrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleInitialize.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNode.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+    xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePage.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePagePrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list