Diff
Modified: trunk/Source/WebKit2/ChangeLog (160656 => 160657)
--- trunk/Source/WebKit2/ChangeLog 2013-12-16 20:46:39 UTC (rev 160656)
+++ trunk/Source/WebKit2/ChangeLog 2013-12-16 20:47:00 UTC (rev 160657)
@@ -1,5 +1,21 @@
2013-12-16 Anders Carlsson <[email protected]>
+ UserData should encode and decode API::Data objects
+ https://bugs.webkit.org/show_bug.cgi?id=125799
+
+ Reviewed by Beth Dakin.
+
+ * Shared/APIData.cpp: Added.
+ (API::Data::encode):
+ (API::Data::decode):
+ * Shared/APIData.h:
+ * Shared/UserData.cpp:
+ (WebKit::UserData::encode):
+ (WebKit::UserData::decode):
+ * WebKit2.xcodeproj/project.pbxproj:
+
+2013-12-16 Anders Carlsson <[email protected]>
+
Rename WebData to API::Data
https://bugs.webkit.org/show_bug.cgi?id=125797
Added: trunk/Source/WebKit2/Shared/APIData.cpp (0 => 160657)
--- trunk/Source/WebKit2/Shared/APIData.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/APIData.cpp 2013-12-16 20:47:00 UTC (rev 160657)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 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 "APIData.h"
+
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+
+namespace API {
+
+void Data::encode(IPC::ArgumentEncoder& encoder) const
+{
+ encoder << dataReference();
+}
+
+bool Data::decode(IPC::ArgumentDecoder& decoder, RefPtr<API::Object>& result)
+{
+ IPC::DataReference dataReference;
+ if (!decoder.decode(dataReference))
+ return false;
+
+ result = create(dataReference.data(), dataReference.size());
+ return true;
+}
+
+} // namespace API
Modified: trunk/Source/WebKit2/Shared/APIData.h (160656 => 160657)
--- trunk/Source/WebKit2/Shared/APIData.h 2013-12-16 20:46:39 UTC (rev 160656)
+++ trunk/Source/WebKit2/Shared/APIData.h 2013-12-16 20:47:00 UTC (rev 160657)
@@ -31,6 +31,11 @@
#include <wtf/Forward.h>
#include <wtf/Vector.h>
+namespace IPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+}
+
namespace API {
class Data : public ObjectImpl<API::Object::Type::Data> {
@@ -69,6 +74,9 @@
IPC::DataReference dataReference() const { return IPC::DataReference(m_bytes, m_size); }
+ void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, RefPtr<API::Object>&);
+
private:
Data(const unsigned char* bytes, size_t size, FreeDataFunction freeDataFunction, const void* context)
: m_bytes(bytes)
Modified: trunk/Source/WebKit2/Shared/UserData.cpp (160656 => 160657)
--- trunk/Source/WebKit2/Shared/UserData.cpp 2013-12-16 20:46:39 UTC (rev 160656)
+++ trunk/Source/WebKit2/Shared/UserData.cpp 2013-12-16 20:47:00 UTC (rev 160657)
@@ -27,6 +27,7 @@
#include "UserData.h"
#include "APIArray.h"
+#include "APIData.h"
#include "APIFrameHandle.h"
#include "APIGeometry.h"
#include "APINumber.h"
@@ -118,6 +119,10 @@
static_cast<const API::Boolean&>(object).encode(encoder);
break;
+ case API::Object::Type::Data:
+ static_cast<const API::Data&>(object).encode(encoder);
+ break;
+
case API::Object::Type::Dictionary: {
auto& dictionary = static_cast<const ImmutableDictionary&>(object);
auto& map = dictionary.map();
@@ -203,6 +208,11 @@
return false;
break;
+ case API::Object::Type::Data:
+ if (!API::Data::decode(decoder, result))
+ return false;
+ break;
+
case API::Object::Type::Dictionary: {
uint64_t size;
if (!decoder.decode(size))
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (160656 => 160657)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-12-16 20:46:39 UTC (rev 160656)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-12-16 20:47:00 UTC (rev 160657)
@@ -224,6 +224,7 @@
1AA9BAE1184FFAC7003B6BC6 /* WeakObjCPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA9BAE0184FFAC7003B6BC6 /* WeakObjCPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
1AAB0379185A7C6A00EDF501 /* MessageSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAB0377185A7C6A00EDF501 /* MessageSender.cpp */; };
1AAB037A185A7C6A00EDF501 /* MessageSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAB0378185A7C6A00EDF501 /* MessageSender.h */; };
+ 1AAB037C185F99D800EDF501 /* APIData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAB037B185F99D800EDF501 /* APIData.cpp */; };
1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAB4A8C1296F0A20023952F /* SandboxExtension.h */; };
1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAB4AA91296F1540023952F /* SandboxExtensionMac.mm */; };
1AABFE3A1829C1ED005B070E /* WKRemoteObjectInterfaceInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AABFE391829C1ED005B070E /* WKRemoteObjectInterfaceInternal.h */; };
@@ -1773,6 +1774,7 @@
1AA9BAE0184FFAC7003B6BC6 /* WeakObjCPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakObjCPtr.h; sourceTree = "<group>"; };
1AAB0377185A7C6A00EDF501 /* MessageSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MessageSender.cpp; sourceTree = "<group>"; };
1AAB0378185A7C6A00EDF501 /* MessageSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageSender.h; sourceTree = "<group>"; };
+ 1AAB037B185F99D800EDF501 /* APIData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIData.cpp; sourceTree = "<group>"; };
1AAB4A8C1296F0A20023952F /* SandboxExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxExtension.h; sourceTree = "<group>"; };
1AAB4AA91296F1540023952F /* SandboxExtensionMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SandboxExtensionMac.mm; sourceTree = "<group>"; };
1AABFE391829C1ED005B070E /* WKRemoteObjectInterfaceInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRemoteObjectInterfaceInternal.h; sourceTree = "<group>"; };
@@ -3468,6 +3470,7 @@
BC64696D11DBE603006455B0 /* APIArray.cpp */,
BC64696E11DBE603006455B0 /* APIArray.h */,
1A3DD205125E5A2F004515E6 /* APIClient.h */,
+ 1AAB037B185F99D800EDF501 /* APIData.cpp */,
51578B821209ECEF00A37C4A /* APIData.h */,
1AC1336F18566C7C00F3EC05 /* APIFrameHandle.cpp */,
1AC1337018566C7C00F3EC05 /* APIFrameHandle.h */,
@@ -3478,6 +3481,7 @@
BCF04C8C11FF9B7D00F86A58 /* APIObject.h */,
1AC1336D18565D2B00F3EC05 /* APIPageHandle.cpp */,
1AC1336B18565C7A00F3EC05 /* APIPageHandle.h */,
+ BCF04C8E11FF9F6E00F86A58 /* APIString.h */,
A7D792D51767CB6E00881CBE /* ActivityAssertion.cpp */,
A7D792D41767CB0900881CBE /* ActivityAssertion.h */,
515E7725183DD6F60007203F /* AsyncRequest.cpp */,
@@ -3605,7 +3609,6 @@
51217463164C21370037A5C1 /* WebResourceBuffer.h */,
F634445512A885C8000612D8 /* WebSecurityOrigin.h */,
A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */,
- BCF04C8E11FF9F6E00F86A58 /* APIString.h */,
C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */,
BCDB86C01200FB97007254BE /* WebURL.h */,
BCE2315C122C30CA00D5C35A /* WebURLRequest.cpp */,
@@ -7134,6 +7137,7 @@
CD5C66A0134B9D38004FE2A8 /* InjectedBundlePageFullScreenClient.cpp in Sources */,
755422CB180650020046F6A8 /* WebOriginDataManager.cpp in Sources */,
BCA8C6A811E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp in Sources */,
+ 1AAB037C185F99D800EDF501 /* APIData.cpp in Sources */,
BC8147AA12F64CDA007B2C32 /* InjectedBundlePagePolicyClient.cpp in Sources */,
659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */,
BCA8C6AF11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp in Sources */,