[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

hyatt at apple.com hyatt at apple.com
Wed Apr 7 23:52:57 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 6497577189c057ab5e0b5c318ff03fc249185d9b
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 21 01:17:18 2009 +0000

    Add support for WebSerializedJSValue to WebKit.  This object wraps the SerializedScriptValue functionality in WebCore
    and exposes the ability to do JS value serialization/deserialization to WebKit clients.
    
    Reviewed by Oliver Hunt and Jon Honeycutt.
    
    WebKit:
    
    * WebKit.xcodeproj/project.pbxproj:
    
    WebKit/mac:
    
    * WebView/WebSerializedJSValue.h: Added.
    * WebView/WebSerializedJSValue.mm: Added.
    (-[WebSerializedJSValue initWithValue:context:]):
    (-[WebSerializedJSValue deserialize:]):
    (-[WebSerializedJSValue dealloc]):
    
    WebKit/win:
    
    * Interfaces/IWebSerializedJSValue.idl: Added.
    * Interfaces/WebKit.idl:
    * WebKit.vcproj/WebKit.vcproj:
    * WebSerializedJSValue.cpp: Added.
    (WebSerializedJSValue::WebSerializedJSValue):
    (WebSerializedJSValue::~WebSerializedJSValue):
    (WebSerializedJSValue::createInstance):
    (WebSerializedJSValue::AddRef):
    (WebSerializedJSValue::Release):
    (WebSerializedJSValue::QueryInterface):
    (WebSerializedJSValue::deserialize):
    * WebSerializedJSValue.h: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51267 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 2973a99..0bb5339 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,12 @@
+2009-11-20  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Oliver Hunt and Jon Honeycutt.
+
+        Add support for WebSerializedJSValue to WebKit.  This object wraps the SerializedScriptValue functionality in WebCore
+        and exposes the ability to do JS value serialization/deserialization to WebKit clients.
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2009-11-20  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Beth Dakin.
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index 39bdccd..3033704 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -326,6 +326,8 @@
 		ABDDF20D08EB0DDC001E1241 /* WebDownloadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDF20C08EB0DDC001E1241 /* WebDownloadInternal.h */; };
 		B6CE5C24100BC5CE00219936 /* WebApplicationCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */; };
 		B6CE5C25100BC5F500219936 /* WebApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		BC26C69E10B743F400B687ED /* WebSerializedJSValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC26C69D10B743F400B687ED /* WebSerializedJSValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		BC26C6A510B7447A00B687ED /* WebSerializedJSValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC26C6A410B7447A00B687ED /* WebSerializedJSValue.mm */; };
 		BC2E464D0FD8A96800A9D9DE /* WebViewData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E464B0FD8A96800A9D9DE /* WebViewData.h */; };
 		BC2E464E0FD8A96800A9D9DE /* WebViewData.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC2E464C0FD8A96800A9D9DE /* WebViewData.mm */; };
 		BC542C420FD7766F00D8AB5D /* WebDelegateImplementationCaching.h in Headers */ = {isa = PBXBuildFile; fileRef = BC542C400FD7766F00D8AB5D /* WebDelegateImplementationCaching.h */; };
@@ -602,6 +604,8 @@
 		ABDDF20C08EB0DDC001E1241 /* WebDownloadInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDownloadInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCache.h; sourceTree = "<group>"; };
 		B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebApplicationCache.mm; sourceTree = "<group>"; };
+		BC26C69D10B743F400B687ED /* WebSerializedJSValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSerializedJSValue.h; sourceTree = "<group>"; };
+		BC26C6A410B7447A00B687ED /* WebSerializedJSValue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSerializedJSValue.mm; sourceTree = "<group>"; };
 		BC2E464B0FD8A96800A9D9DE /* WebViewData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewData.h; sourceTree = "<group>"; };
 		BC2E464C0FD8A96800A9D9DE /* WebViewData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewData.mm; sourceTree = "<group>"; };
 		BC542C400FD7766F00D8AB5D /* WebDelegateImplementationCaching.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDelegateImplementationCaching.h; sourceTree = "<group>"; };
@@ -1136,6 +1140,8 @@
 				C0B1F7E510AC8E3100C925D9 /* WebScriptWorld.h */,
 				C0B1F7E610AC8E3100C925D9 /* WebScriptWorld.mm */,
 				C0B1F7E710AC8E3100C925D9 /* WebScriptWorldInternal.h */,
+				BC26C6A410B7447A00B687ED /* WebSerializedJSValue.mm */,
+				BC26C69D10B743F400B687ED /* WebSerializedJSValue.h */,
 				936A2DE90FD2D08400D312DB /* WebTextCompletionController.h */,
 				936A2DE70FD2D08000D312DB /* WebTextCompletionController.mm */,
 				F834AAD50E64B1C700E2737C /* WebTextIterator.h */,
@@ -1517,6 +1523,7 @@
 				C0B1F7E810AC8E3100C925D9 /* WebScriptWorld.h in Headers */,
 				C0B1F7EA10AC8E3100C925D9 /* WebScriptWorldInternal.h in Headers */,
 				C0B88E8B10A08F3D00FBB3F5 /* WebFrameLoadDelegatePrivate.h in Headers */,
+				BC26C69E10B743F400B687ED /* WebSerializedJSValue.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1857,6 +1864,7 @@
 				0A2D87FE107AF52B00CDDEE3 /* WebPluginHalterClient.mm in Sources */,
 				BC97E7E210963D260010D361 /* WebViewEventHandling.mm in Sources */,
 				C0B1F7E910AC8E3100C925D9 /* WebScriptWorld.mm in Sources */,
+				BC26C6A510B7447A00B687ED /* WebSerializedJSValue.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index b7e142e..54589d0 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,16 @@
+2009-11-20  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Oliver Hunt and Jon Honeycutt.
+
+        Add support for WebSerializedJSValue to WebKit.  This object wraps the SerializedScriptValue functionality in WebCore
+        and exposes the ability to do JS value serialization/deserialization to WebKit clients.
+
+        * WebView/WebSerializedJSValue.h: Added.
+        * WebView/WebSerializedJSValue.mm: Added.
+        (-[WebSerializedJSValue initWithValue:context:]):
+        (-[WebSerializedJSValue deserialize:]):
+        (-[WebSerializedJSValue dealloc]):
+
 2009-11-20  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Beth Dakin.
diff --git a/WebKit/mac/WebView/WebSerializedJSValue.h b/WebKit/mac/WebView/WebSerializedJSValue.h
new file mode 100644
index 0000000..5094776
--- /dev/null
+++ b/WebKit/mac/WebView/WebSerializedJSValue.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+ at class WebSerializedJSValuePrivate;
+
+typedef const struct OpaqueJSContext* JSContextRef;
+typedef const struct OpaqueJSValue* JSValueRef;
+
+ at interface WebSerializedJSValue : NSObject {
+ at private
+    WebSerializedJSValuePrivate *_private;
+}
+
+- (id)initWithValue:(JSValueRef)object context:(JSContextRef)sourceContext exception:(JSValueRef*)exception;
+- (JSValueRef)deserialize:(JSContextRef)destinationContext;
+
+ at end
diff --git a/WebKit/mac/WebView/WebSerializedJSValue.mm b/WebKit/mac/WebView/WebSerializedJSValue.mm
new file mode 100644
index 0000000..af96aa4
--- /dev/null
+++ b/WebKit/mac/WebView/WebSerializedJSValue.mm
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#import "WebSerializedJSValue.h"
+
+#import <WebCore/SerializedScriptValue.h>
+#import <wtf/RefPtr.h>
+
+using namespace WebCore;
+
+ at interface WebSerializedJSValuePrivate : NSObject {
+ at public
+    RefPtr<SerializedScriptValue> value;
+}
+ at end
+
+ at implementation WebSerializedJSValuePrivate
+ at end
+
+ at implementation WebSerializedJSValue
+
+- (id)initWithValue:(JSValueRef)value context:(JSContextRef)sourceContext exception:(JSValueRef*)exception;
+{
+    ASSERT_ARG(value, value);
+    ASSERT_ARG(sourceContext, sourceContext);
+
+    if (!value || !sourceContext) {
+        [self release];
+        return nil;
+    }
+
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _private = [[WebSerializedJSValuePrivate alloc] init];
+    
+    _private->value = SerializedScriptValue::create(sourceContext, value, exception);
+    if (!_private->value) {
+        [self release];
+        return nil;
+    }
+
+    return self;
+}
+
+- (JSValueRef)deserialize:(JSContextRef)destinationContext
+{
+    if (!_private || !_private->value)
+        return 0;    
+    return _private->value->deserialize(destinationContext, 0);
+}
+
+- (void)dealloc
+{
+    [_private release];
+    _private = nil;
+    [super dealloc];
+}
+
+ at end
+
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 4335964..ae73252 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,23 @@
+2009-11-20  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Oliver Hunt and Jon Honeycutt.
+
+        Add support for WebSerializedJSValue to WebKit.  This object wraps the SerializedScriptValue functionality in WebCore
+        and exposes the ability to do JS value serialization/deserialization to WebKit clients.
+
+        * Interfaces/IWebSerializedJSValue.idl: Added.
+        * Interfaces/WebKit.idl:
+        * WebKit.vcproj/WebKit.vcproj:
+        * WebSerializedJSValue.cpp: Added.
+        (WebSerializedJSValue::WebSerializedJSValue):
+        (WebSerializedJSValue::~WebSerializedJSValue):
+        (WebSerializedJSValue::createInstance):
+        (WebSerializedJSValue::AddRef):
+        (WebSerializedJSValue::Release):
+        (WebSerializedJSValue::QueryInterface):
+        (WebSerializedJSValue::deserialize):
+        * WebSerializedJSValue.h: Added.
+
 2009-11-19  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/win/Interfaces/IWebSerializedJSValue.idl b/WebKit/win/Interfaces/IWebSerializedJSValue.idl
new file mode 100644
index 0000000..4b395de
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebSerializedJSValue.idl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+cpp_quote("// this is done to get midl to treat the JavaScriptCore API types as pointer types")
+cpp_quote("#if 0")
+typedef void* JSContextRef;
+typedef void* JSValueRef;
+cpp_quote("#else")
+cpp_quote("typedef struct OpaqueJSValue* JSValueRef;")
+cpp_quote("typedef const struct OpaqueJSContext* JSContextRef;")
+cpp_quote("#endif")
+
+[
+    object,
+    oleautomation,
+    uuid(13B3F50A-C996-61A7-2247-3DCC88FB0B84),
+    pointer_default(unique)
+]
+interface IWebSerializedJSValue : IUnknown {
+    HRESULT deserialize([in] JSContextRef context, [out, retval] JSValueRef* value);
+}
diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl
index 4bb5d6f..4800153 100644
--- a/WebKit/win/Interfaces/WebKit.idl
+++ b/WebKit/win/Interfaces/WebKit.idl
@@ -117,6 +117,7 @@ import "ocidl.idl";
 #include "IWebScrollBarDelegatePrivate.idl"
 #include "IWebScrollBarPrivate.idl"
 #include "IWebSecurityOrigin.idl"
+#include "IWebSerializedJSValue.idl"
 #include "IWebTextRenderer.idl"
 #include "IWebUIDelegate.idl"
 #include "IWebUIDelegate2.idl"
@@ -277,5 +278,10 @@ library WebKit
     coclass WebScriptWorld {
         [default] interface IWebScriptWorld;
     }
+    
+    [uuid(13C45703-A3B3-8797-276B-75632F6165C3)]
+    coclass WebSerializedJSValue {
+        [default] interface IWebSerializedJSValue;
+    }
 }
 
diff --git a/WebKit/win/WebKit.vcproj/WebKit.vcproj b/WebKit/win/WebKit.vcproj/WebKit.vcproj
index 9746997..39efb85 100644
--- a/WebKit/win/WebKit.vcproj/WebKit.vcproj
+++ b/WebKit/win/WebKit.vcproj/WebKit.vcproj
@@ -725,6 +725,10 @@
 				RelativePath="..\WebScriptWorld.h"
 				>
 			</File>
+                        <File
+				RelativePath="..\WebSerializedJSValue.h"
+				>
+			</File>
 			<File
 				RelativePath="..\WebKitStatistics.h"
 				>
@@ -1097,6 +1101,10 @@
 				RelativePath="..\WebScriptWorld.cpp"
 				>
 			</File>
+                        <File
+				RelativePath="..\WebSerializedJSValue.cpp"
+				>
+			</File>
 			<File
 				RelativePath="..\WebKitStatistics.cpp"
 				>
diff --git a/WebKit/win/WebSerializedJSValue.cpp b/WebKit/win/WebSerializedJSValue.cpp
new file mode 100644
index 0000000..e845cc1
--- /dev/null
+++ b/WebKit/win/WebSerializedJSValue.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2009 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 "config.h"
+#include "WebKitDLL.h"
+#include "WebSerializedJSValue.h"
+
+#include <WebCore/SeralizedScriptValue.h>
+
+using namespace WebCore;
+
+WebSerializedJSValue::WebSerializedJSValue(JSContextRef sourceContext, JSValueRef value, JSValueRef* exception)
+    : m_refCount(0)
+{
+    ASSERT_ARG(value, value);
+    ASSERT_ARG(sourceContext, sourceContext);
+
+    if (value && sourceContext)
+        m_value = SerializedScriptValue::create(sourceContext, value, exception);
+
+    ++gClassCount;
+    gClassNameCount.add("WebSerializedJSValue");
+}
+
+WebSerializedJSValue::~WebSerializedJSValue()
+{
+    --gClassCount;
+    gClassNameCount.remove("WebSerializedJSValue");
+}
+
+COMPtr<WebSerializedJSValue> WebSerializedJSValue::createInstance(JSContextRef sourceContext, JSValueRef value, JSValueRef* exception)
+{
+    return new WebSerializedJSValue(sourceContext, value, exception);
+}
+
+ULONG WebSerializedJSValue::AddRef()
+{
+    return ++m_refCount;
+}
+
+ULONG WebSerializedJSValue::Release()
+{
+    ULONG newRefCount = --m_refCount;
+    if (!newRefCount)
+        delete this;
+    return newRefCount;
+}
+
+HRESULT WebSerializedJSValue::QueryInterface(REFIID riid, void** ppvObject)
+{
+    if (!ppvObject)
+        return E_POINTER;
+    *ppvObject = 0;
+
+    if (IsEqualIID(riid, __uuidof(WebSerializedJSValue)))
+        *ppvObject = this;
+    else if (IsEqualIID(riid, __uuidof(IWebSerializedJSValue)))
+        *ppvObject = static_cast<IWebSerializedJSValue*>(this);
+    else if (IsEqualIID(riid, IID_IUnknown))
+        *ppvObject = static_cast<IUnknown*>(this);
+    else
+        return E_NOINTERFACE;
+
+    AddRef();
+    return S_OK;
+}
+
+HRESULT WebSerializedJSValue::deserialize(JSContextRef destinationContext, JSValueRef* outValue)
+{
+    if (!outValue)
+        return E_POINTER;
+
+    if (!_private->m_value)
+        *outValue = 0;
+    else
+        *outValue = _private->value->deserialize(destinationContext, 0);
+
+    return S_OK;
+}
diff --git a/WebKit/win/WebSerializedJSValue.h b/WebKit/win/WebSerializedJSValue.h
new file mode 100644
index 0000000..ba7bc89
--- /dev/null
+++ b/WebKit/win/WebSerializedJSValue.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2009 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 WebSerializedJSValue_h
+#define WebSerializedJSValue_h
+
+#include <WebCore/COMPtr.h>
+
+typedef const struct OpaqueJSContext* JSContextRef;
+typedef const struct OpaqueJSValue* JSValueRef;
+
+namespace WebCore {
+    class SerializedScriptValue;
+}
+
+class WebSerializedJSValue : public Noncopyable, public IWebSerializedJSValue {
+public:
+    static COMPtr<WebSerializedJSValue> createInstance(JSContextRef, JSValueRef value, JSValueRef* exception);
+
+    virtual ULONG STDMETHODCALLTYPE AddRef();
+    virtual ULONG STDMETHODCALLTYPE Release();
+
+    virtual HRESULT STDMETHODCALLTYPE deserialize(JSContextRef, JSValueRef* result);
+
+private:
+    WebSerializedJSValue(JSContextRef, JSValueRef);
+    ~WebSerializedJSValue();
+
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject);
+
+    ULONG m_refCount;
+    RefPtr<WebCore::SerializedScriptValue> m_value;
+};
+
+#endif // WebSerializedJSValue_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list