Move concrete KeyedDecoder/Encoder implementations to WebCore.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Aug 2015 16:04:49 +0000 (16:04 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Aug 2015 16:04:49 +0000 (16:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147757.

Rubberstamped by Andy Estes.

Source/WebCore:

* PlatformEfl.cmake:
* PlatformGTK.cmake:
* WebCore.xcodeproj/project.pbxproj:

* platform/KeyedCoding.h:
(WebCore::KeyedDecoder::KeyedDecoder): Static constructor to be implemented per-platform.
(WebCore::KeyedEncoder::KeyedEncoder): Ditto.

* platform/cf/KeyedDecoderCF.cpp: Renamed from Source/WebKit2/Shared/cf/KeyedDecoder.cpp.
(WebCore::KeyedDecoder::decoder):
(WebCore::KeyedDecoderCF::KeyedDecoderCF):
(WebCore::KeyedDecoderCF::~KeyedDecoderCF):
(WebCore::KeyedDecoderCF::decodeBytes):
(WebCore::KeyedDecoderCF::decodeBool):
(WebCore::KeyedDecoderCF::decodeUInt32):
(WebCore::KeyedDecoderCF::decodeInt32):
(WebCore::KeyedDecoderCF::decodeInt64):
(WebCore::KeyedDecoderCF::decodeFloat):
(WebCore::KeyedDecoderCF::decodeDouble):
(WebCore::KeyedDecoderCF::decodeString):
(WebCore::KeyedDecoderCF::beginObject):
(WebCore::KeyedDecoderCF::endObject):
(WebCore::KeyedDecoderCF::beginArray):
(WebCore::KeyedDecoderCF::beginArrayElement):
(WebCore::KeyedDecoderCF::endArrayElement):
(WebCore::KeyedDecoderCF::endArray):
* platform/cf/KeyedDecoderCF.h: Renamed from Source/WebKit2/Shared/cf/KeyedDecoder.h.

* platform/cf/KeyedEncoderCF.cpp: Renamed from Source/WebKit2/Shared/cf/KeyedEncoder.cpp.
(WebCore::KeyedEncoder::encoder):
(WebCore::createDictionary):
(WebCore::KeyedEncoderCF::KeyedEncoderCF):
(WebCore::KeyedEncoderCF::~KeyedEncoderCF):
(WebCore::KeyedEncoderCF::encodeBytes):
(WebCore::KeyedEncoderCF::encodeBool):
(WebCore::KeyedEncoderCF::encodeUInt32):
(WebCore::KeyedEncoderCF::encodeInt32):
(WebCore::KeyedEncoderCF::encodeInt64):
(WebCore::KeyedEncoderCF::encodeFloat):
(WebCore::KeyedEncoderCF::encodeDouble):
(WebCore::KeyedEncoderCF::encodeString):
(WebCore::KeyedEncoderCF::beginObject):
(WebCore::KeyedEncoderCF::endObject):
(WebCore::KeyedEncoderCF::beginArray):
(WebCore::KeyedEncoderCF::beginArrayElement):
(WebCore::KeyedEncoderCF::endArrayElement):
(WebCore::KeyedEncoderCF::endArray):
(WebCore::KeyedEncoderCF::finishEncoding):
* platform/cf/KeyedEncoderCF.h: Renamed from Source/WebKit2/Shared/cf/KeyedEncoder.h.

* platform/glib/KeyedDecoderGlib.cpp: Renamed from Source/WebKit2/Shared/glib/KeyedDecoder.cpp.
(WebCore::KeyedDecoder::decoder):
(WebCore::KeyedDecoderGlib::KeyedDecoderGlib):
(WebCore::KeyedDecoderGlib::~KeyedDecoderGlib):
(WebCore::KeyedDecoderGlib::dictionaryFromGVariant):
(WebCore::KeyedDecoderGlib::decodeBytes):
(WebCore::KeyedDecoderGlib::decodeSimpleValue):
(WebCore::KeyedDecoderGlib::decodeBool):
(WebCore::KeyedDecoderGlib::decodeUInt32):
(WebCore::KeyedDecoderGlib::decodeInt32):
(WebCore::KeyedDecoderGlib::decodeInt64):
(WebCore::KeyedDecoderGlib::decodeFloat):
(WebCore::KeyedDecoderGlib::decodeDouble):
(WebCore::KeyedDecoderGlib::decodeString):
(WebCore::KeyedDecoderGlib::beginObject):
(WebCore::KeyedDecoderGlib::endObject):
(WebCore::KeyedDecoderGlib::beginArray):
(WebCore::KeyedDecoderGlib::beginArrayElement):
(WebCore::KeyedDecoderGlib::endArrayElement):
(WebCore::KeyedDecoderGlib::endArray):
* platform/glib/KeyedDecoderGlib.h: Renamed from Source/WebKit2/Shared/glib/KeyedDecoder.h.

* platform/glib/KeyedEncoderGlib.cpp: Renamed from Source/WebKit2/Shared/glib/KeyedEncoder.cpp.
(WebCore::KeyedEncoder::encoder):
(WebCore::KeyedEncoderGlib::KeyedEncoderGlib):
(WebCore::KeyedEncoderGlib::~KeyedEncoderGlib):
(WebCore::KeyedEncoderGlib::encodeBytes):
(WebCore::KeyedEncoderGlib::encodeBool):
(WebCore::KeyedEncoderGlib::encodeUInt32):
(WebCore::KeyedEncoderGlib::encodeInt32):
(WebCore::KeyedEncoderGlib::encodeInt64):
(WebCore::KeyedEncoderGlib::encodeFloat):
(WebCore::KeyedEncoderGlib::encodeDouble):
(WebCore::KeyedEncoderGlib::encodeString):
(WebCore::KeyedEncoderGlib::beginObject):
(WebCore::KeyedEncoderGlib::endObject):
(WebCore::KeyedEncoderGlib::beginArray):
(WebCore::KeyedEncoderGlib::beginArrayElement):
(WebCore::KeyedEncoderGlib::endArrayElement):
(WebCore::KeyedEncoderGlib::endArray):
(WebCore::KeyedEncoderGlib::finishEncoding):
* platform/glib/KeyedEncoderGlib.h: Renamed from Source/WebKit2/Shared/glib/KeyedEncoder.h.

Source/WebKit2:

* DatabaseProcess/IndexedDB/IDBSerialization.cpp:
(WebKit::serializeIDBKeyPath):
(WebKit::deserializeIDBKeyPath):
(WebKit::serializeIDBKeyData):
(WebKit::deserializeIDBKeyData):

* PlatformEfl.cmake:
* PlatformGTK.cmake:
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188126 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/PlatformEfl.cmake
Source/WebCore/PlatformGTK.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/KeyedCoding.h
Source/WebCore/platform/cf/KeyedDecoderCF.cpp [moved from Source/WebKit2/Shared/cf/KeyedDecoder.cpp with 81% similarity]
Source/WebCore/platform/cf/KeyedDecoderCF.h [moved from Source/WebKit2/Shared/cf/KeyedDecoder.h with 89% similarity]
Source/WebCore/platform/cf/KeyedEncoderCF.cpp [moved from Source/WebKit2/Shared/cf/KeyedEncoder.cpp with 79% similarity]
Source/WebCore/platform/cf/KeyedEncoderCF.h [moved from Source/WebKit2/Shared/cf/KeyedEncoder.h with 91% similarity]
Source/WebCore/platform/glib/KeyedDecoderGlib.cpp [moved from Source/WebKit2/Shared/glib/KeyedDecoder.cpp with 74% similarity]
Source/WebCore/platform/glib/KeyedDecoderGlib.h [moved from Source/WebKit2/Shared/glib/KeyedDecoder.h with 89% similarity]
Source/WebCore/platform/glib/KeyedEncoderGlib.cpp [moved from Source/WebKit2/Shared/glib/KeyedEncoder.cpp with 77% similarity]
Source/WebCore/platform/glib/KeyedEncoderGlib.h [moved from Source/WebKit2/Shared/glib/KeyedEncoder.h with 91% similarity]
Source/WebKit2/ChangeLog
Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.cpp
Source/WebKit2/PlatformEfl.cmake
Source/WebKit2/PlatformGTK.cmake
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

index b954563..86bb376 100644 (file)
@@ -1,3 +1,103 @@
+2015-08-07  Brady Eidson  <beidson@apple.com>
+
+        Move concrete KeyedDecoder/Encoder implementations to WebCore.
+        https://bugs.webkit.org/show_bug.cgi?id=147757.
+
+        Rubberstamped by Andy Estes.
+
+        * PlatformEfl.cmake:
+        * PlatformGTK.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * platform/KeyedCoding.h:
+        (WebCore::KeyedDecoder::KeyedDecoder): Static constructor to be implemented per-platform.
+        (WebCore::KeyedEncoder::KeyedEncoder): Ditto.
+
+        * platform/cf/KeyedDecoderCF.cpp: Renamed from Source/WebKit2/Shared/cf/KeyedDecoder.cpp.
+        (WebCore::KeyedDecoder::decoder):
+        (WebCore::KeyedDecoderCF::KeyedDecoderCF):
+        (WebCore::KeyedDecoderCF::~KeyedDecoderCF):
+        (WebCore::KeyedDecoderCF::decodeBytes):
+        (WebCore::KeyedDecoderCF::decodeBool):
+        (WebCore::KeyedDecoderCF::decodeUInt32):
+        (WebCore::KeyedDecoderCF::decodeInt32):
+        (WebCore::KeyedDecoderCF::decodeInt64):
+        (WebCore::KeyedDecoderCF::decodeFloat):
+        (WebCore::KeyedDecoderCF::decodeDouble):
+        (WebCore::KeyedDecoderCF::decodeString):
+        (WebCore::KeyedDecoderCF::beginObject):
+        (WebCore::KeyedDecoderCF::endObject):
+        (WebCore::KeyedDecoderCF::beginArray):
+        (WebCore::KeyedDecoderCF::beginArrayElement):
+        (WebCore::KeyedDecoderCF::endArrayElement):
+        (WebCore::KeyedDecoderCF::endArray):
+        * platform/cf/KeyedDecoderCF.h: Renamed from Source/WebKit2/Shared/cf/KeyedDecoder.h.
+        
+        * platform/cf/KeyedEncoderCF.cpp: Renamed from Source/WebKit2/Shared/cf/KeyedEncoder.cpp.
+        (WebCore::KeyedEncoder::encoder):
+        (WebCore::createDictionary):
+        (WebCore::KeyedEncoderCF::KeyedEncoderCF):
+        (WebCore::KeyedEncoderCF::~KeyedEncoderCF):
+        (WebCore::KeyedEncoderCF::encodeBytes):
+        (WebCore::KeyedEncoderCF::encodeBool):
+        (WebCore::KeyedEncoderCF::encodeUInt32):
+        (WebCore::KeyedEncoderCF::encodeInt32):
+        (WebCore::KeyedEncoderCF::encodeInt64):
+        (WebCore::KeyedEncoderCF::encodeFloat):
+        (WebCore::KeyedEncoderCF::encodeDouble):
+        (WebCore::KeyedEncoderCF::encodeString):
+        (WebCore::KeyedEncoderCF::beginObject):
+        (WebCore::KeyedEncoderCF::endObject):
+        (WebCore::KeyedEncoderCF::beginArray):
+        (WebCore::KeyedEncoderCF::beginArrayElement):
+        (WebCore::KeyedEncoderCF::endArrayElement):
+        (WebCore::KeyedEncoderCF::endArray):
+        (WebCore::KeyedEncoderCF::finishEncoding):
+        * platform/cf/KeyedEncoderCF.h: Renamed from Source/WebKit2/Shared/cf/KeyedEncoder.h.
+        
+        * platform/glib/KeyedDecoderGlib.cpp: Renamed from Source/WebKit2/Shared/glib/KeyedDecoder.cpp.
+        (WebCore::KeyedDecoder::decoder):
+        (WebCore::KeyedDecoderGlib::KeyedDecoderGlib):
+        (WebCore::KeyedDecoderGlib::~KeyedDecoderGlib):
+        (WebCore::KeyedDecoderGlib::dictionaryFromGVariant):
+        (WebCore::KeyedDecoderGlib::decodeBytes):
+        (WebCore::KeyedDecoderGlib::decodeSimpleValue):
+        (WebCore::KeyedDecoderGlib::decodeBool):
+        (WebCore::KeyedDecoderGlib::decodeUInt32):
+        (WebCore::KeyedDecoderGlib::decodeInt32):
+        (WebCore::KeyedDecoderGlib::decodeInt64):
+        (WebCore::KeyedDecoderGlib::decodeFloat):
+        (WebCore::KeyedDecoderGlib::decodeDouble):
+        (WebCore::KeyedDecoderGlib::decodeString):
+        (WebCore::KeyedDecoderGlib::beginObject):
+        (WebCore::KeyedDecoderGlib::endObject):
+        (WebCore::KeyedDecoderGlib::beginArray):
+        (WebCore::KeyedDecoderGlib::beginArrayElement):
+        (WebCore::KeyedDecoderGlib::endArrayElement):
+        (WebCore::KeyedDecoderGlib::endArray):
+        * platform/glib/KeyedDecoderGlib.h: Renamed from Source/WebKit2/Shared/glib/KeyedDecoder.h.
+        
+        * platform/glib/KeyedEncoderGlib.cpp: Renamed from Source/WebKit2/Shared/glib/KeyedEncoder.cpp.
+        (WebCore::KeyedEncoder::encoder):
+        (WebCore::KeyedEncoderGlib::KeyedEncoderGlib):
+        (WebCore::KeyedEncoderGlib::~KeyedEncoderGlib):
+        (WebCore::KeyedEncoderGlib::encodeBytes):
+        (WebCore::KeyedEncoderGlib::encodeBool):
+        (WebCore::KeyedEncoderGlib::encodeUInt32):
+        (WebCore::KeyedEncoderGlib::encodeInt32):
+        (WebCore::KeyedEncoderGlib::encodeInt64):
+        (WebCore::KeyedEncoderGlib::encodeFloat):
+        (WebCore::KeyedEncoderGlib::encodeDouble):
+        (WebCore::KeyedEncoderGlib::encodeString):
+        (WebCore::KeyedEncoderGlib::beginObject):
+        (WebCore::KeyedEncoderGlib::endObject):
+        (WebCore::KeyedEncoderGlib::beginArray):
+        (WebCore::KeyedEncoderGlib::beginArrayElement):
+        (WebCore::KeyedEncoderGlib::endArrayElement):
+        (WebCore::KeyedEncoderGlib::endArray):
+        (WebCore::KeyedEncoderGlib::finishEncoding):
+        * platform/glib/KeyedEncoderGlib.h: Renamed from Source/WebKit2/Shared/glib/KeyedEncoder.h.
+
 2015-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GStreamer] Do not automatically show PackageKit codec installation notifications
index c1f6f4c..13e5a58 100644 (file)
@@ -106,6 +106,9 @@ list(APPEND WebCore_SOURCES
     platform/geoclue/GeolocationProviderGeoclue1.cpp
     platform/geoclue/GeolocationProviderGeoclue2.cpp
 
+    platform/glib/KeyedDecoderGlib.cpp
+    platform/glib/KeyedEncoderGlib.cpp
+
     platform/graphics/ImageSource.cpp
     platform/graphics/PlatformDisplay.cpp
     platform/graphics/WOFFFileFormat.cpp
index 1fc6853..2e9daa9 100644 (file)
@@ -65,6 +65,9 @@ list(APPEND WebCore_SOURCES
     platform/geoclue/GeolocationProviderGeoclue1.cpp
     platform/geoclue/GeolocationProviderGeoclue2.cpp
 
+    platform/glib/KeyedDecoderGlib.cpp
+    platform/glib/KeyedEncoderGlib.cpp
+
     platform/graphics/GLContext.cpp
     platform/graphics/GraphicsContext3DPrivate.cpp
     platform/graphics/ImageSource.cpp
index c540d8a..807e763 100644 (file)
                5179CE2A195C91860019C198 /* GamepadProviderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 5179CE29195C91860019C198 /* GamepadProviderClient.h */; };
                5179CE36195CAC7E0019C198 /* HIDGamepadProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5179CE34195CAC7E0019C198 /* HIDGamepadProvider.cpp */; };
                5179CE37195CAC7E0019C198 /* HIDGamepadProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5179CE35195CAC7E0019C198 /* HIDGamepadProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               517A63C31B74318700E7DCDC /* KeyedDecoderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */; };
+               517A63C41B74318B00E7DCDC /* KeyedEncoderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */; };
+               517A63C51B74318F00E7DCDC /* KeyedDecoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               517A63C61B74319200E7DCDC /* KeyedEncoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C21B74317E00E7DCDC /* KeyedEncoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
                517FBA1E151AB17C00B57959 /* DOMWindowExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517FBA17151AA71B00B57959 /* DOMWindowExtension.cpp */; };
                5189F01D10B37BD900F3C739 /* JSPopStateEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5189F01B10B37BD900F3C739 /* JSPopStateEvent.cpp */; };
                5189F01E10B37BD900F3C739 /* JSPopStateEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 5189F01C10B37BD900F3C739 /* JSPopStateEvent.h */; };
                5179CE29195C91860019C198 /* GamepadProviderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadProviderClient.h; sourceTree = "<group>"; };
                5179CE34195CAC7E0019C198 /* HIDGamepadProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HIDGamepadProvider.cpp; sourceTree = "<group>"; };
                5179CE35195CAC7E0019C198 /* HIDGamepadProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HIDGamepadProvider.h; sourceTree = "<group>"; };
+               517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedDecoderCF.cpp; sourceTree = "<group>"; };
+               517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedDecoderCF.h; sourceTree = "<group>"; };
+               517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedEncoderCF.cpp; sourceTree = "<group>"; };
+               517A63C21B74317E00E7DCDC /* KeyedEncoderCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedEncoderCF.h; sourceTree = "<group>"; };
                517FBA17151AA71B00B57959 /* DOMWindowExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtension.cpp; sourceTree = "<group>"; };
                517FBA18151AA71B00B57959 /* DOMWindowExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowExtension.h; sourceTree = "<group>"; };
                5189F01B10B37BD900F3C739 /* JSPopStateEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPopStateEvent.cpp; sourceTree = "<group>"; };
                                443817FD1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp */,
                                443817FE1A91B2F8006E04F2 /* CoreMediaSoftLink.h */,
                                5160306B0CC4362300C8AC25 /* FileSystemCF.cpp */,
+                               517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */,
+                               517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */,
+                               517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */,
+                               517A63C21B74317E00E7DCDC /* KeyedEncoderCF.h */,
                                5CBC8DAA1AAA302200E1C803 /* MediaAccessibilitySoftLink.cpp */,
                                5CBC8DAB1AAA302200E1C803 /* MediaAccessibilitySoftLink.h */,
                                2D76BB8319456F8100CFD29A /* RunLoopObserver.cpp */,
                                07969DB017D14151007FF842 /* JSRTCDTMFSender.h in Headers */,
                                07969DB217D14151007FF842 /* JSRTCDTMFToneChangeEvent.h in Headers */,
                                07969DB617D14151007FF842 /* JSRTCIceCandidate.h in Headers */,
+                               517A63C61B74319200E7DCDC /* KeyedEncoderCF.h in Headers */,
                                07969DB817D14151007FF842 /* JSRTCIceCandidateEvent.h in Headers */,
                                073794EC19EE341E00E5A045 /* JSRTCIceServer.h in Headers */,
                                07969DBA17D14151007FF842 /* JSRTCPeerConnection.h in Headers */,
                                31955A88160D199200858025 /* RenderSnapshottedPlugIn.h in Headers */,
                                BC8C8FAE0DDCD31B00B592F4 /* RenderStyle.h in Headers */,
                                BC5EB6680E81CB7100B25965 /* RenderStyleConstants.h in Headers */,
+                               517A63C51B74318F00E7DCDC /* KeyedDecoderCF.h in Headers */,
                                436708C112D9CA4B00044234 /* RenderSVGBlock.h in Headers */,
                                436708C312D9CA4B00044234 /* RenderSVGContainer.h in Headers */,
                                2B365C841525119E0091D27B /* RenderSVGEllipse.h in Headers */,
                                07C59B6817F784BA000FBCBB /* MediaSourceStates.cpp in Sources */,
                                078E08FF17D14CEE00420AA1 /* MediaStream.cpp in Sources */,
                                078E094B17D1709600420AA1 /* MediaStreamAudioDestinationNode.cpp in Sources */,
+                               517A63C31B74318700E7DCDC /* KeyedDecoderCF.cpp in Sources */,
                                0783228418013ED800999E0C /* MediaStreamAudioSource.cpp in Sources */,
                                FD671A77159BB07000197559 /* MediaStreamAudioSourceNode.cpp in Sources */,
                                0705851517FB0EEA005F2BCB /* MediaStreamCapabilities.cpp in Sources */,
                                1A0D57360A5C77FE007EDD4C /* OverflowEvent.cpp in Sources */,
                                9B55EEE91B3E8898005342BC /* EditorCocoa.mm in Sources */,
                                65FEA86909833ADE00BED4AB /* Page.cpp in Sources */,
+                               517A63C41B74318B00E7DCDC /* KeyedEncoderCF.cpp in Sources */,
                                1477E7760BF4134A00152872 /* PageCache.cpp in Sources */,
                                CD5E5B611A15F156000C609E /* PageConfiguration.cpp in Sources */,
                                F3820892147D35F90010BC06 /* PageConsoleAgent.cpp in Sources */,
index 9fa5c8f..e2969a2 100644 (file)
@@ -35,10 +35,11 @@ namespace WebCore {
 class SharedBuffer;
 
 class KeyedDecoder {
-protected:
+public:
+    WEBCORE_EXPORT static std::unique_ptr<KeyedDecoder> decoder(const uint8_t* data, size_t);
+
     virtual ~KeyedDecoder() { }
 
-public:
     virtual bool decodeBytes(const String& key, const uint8_t*&, size_t&) = 0;
     virtual bool decodeBool(const String& key, bool&) = 0;
     virtual bool decodeUInt32(const String& key, uint32_t&) = 0;
@@ -125,6 +126,11 @@ public:
         return result;
     }
 
+protected:
+    KeyedDecoder()
+    {
+    }
+
 private:
     virtual bool beginObject(const String& key) = 0;
     virtual void endObject() = 0;
@@ -136,10 +142,11 @@ private:
 };
 
 class KeyedEncoder {
-protected:
+public:
+    WEBCORE_EXPORT static std::unique_ptr<KeyedEncoder> encoder();
+
     virtual ~KeyedEncoder() { }
 
-public:
     virtual void encodeBytes(const String& key, const uint8_t*, size_t) = 0;
     virtual void encodeBool(const String& key, bool) = 0;
     virtual void encodeUInt32(const String& key, uint32_t) = 0;
@@ -188,6 +195,11 @@ public:
         endArray();
     }
 
+protected:
+    KeyedEncoder()
+    {
+    }
+
 private:
     virtual void beginObject(const String& key) = 0;
     virtual void endObject() = 0;
similarity index 81%
rename from Source/WebKit2/Shared/cf/KeyedDecoder.cpp
rename to Source/WebCore/platform/cf/KeyedDecoderCF.cpp
index 2ba3fc1..7534ba7 100644 (file)
  */
 
 #include "config.h"
-#include "KeyedDecoder.h"
+#include "KeyedDecoderCF.h"
 
 #include <wtf/cf/TypeCastsCF.h>
 #include <wtf/text/WTFString.h>
 
-namespace WebKit {
+namespace WebCore {
 
-KeyedDecoder::KeyedDecoder(const uint8_t* data, size_t size)
+std::unique_ptr<KeyedDecoder> KeyedDecoder::decoder(const uint8_t* data, size_t size)
+{
+    return std::make_unique<KeyedDecoderCF>(data, size);
+}
+
+KeyedDecoderCF::KeyedDecoderCF(const uint8_t* data, size_t size)
 {
     auto cfData = adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, data, size, kCFAllocatorNull));
 
@@ -42,7 +47,7 @@ KeyedDecoder::KeyedDecoder(const uint8_t* data, size_t size)
     m_dictionaryStack.append(m_rootDictionary.get());
 }
 
-KeyedDecoder::~KeyedDecoder()
+KeyedDecoderCF::~KeyedDecoderCF()
 {
     ASSERT(m_dictionaryStack.size() == 1);
     ASSERT(m_dictionaryStack.last() == m_rootDictionary);
@@ -50,7 +55,7 @@ KeyedDecoder::~KeyedDecoder()
     ASSERT(m_arrayIndexStack.isEmpty());
 }
 
-bool KeyedDecoder::decodeBytes(const String& key, const uint8_t*& bytes, size_t& size)
+bool KeyedDecoderCF::decodeBytes(const String& key, const uint8_t*& bytes, size_t& size)
 {
     auto data = dynamic_cf_cast<CFDataRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
     if (!data)
@@ -61,7 +66,7 @@ bool KeyedDecoder::decodeBytes(const String& key, const uint8_t*& bytes, size_t&
     return true;
 }
 
-bool KeyedDecoder::decodeBool(const String& key, bool& result)
+bool KeyedDecoderCF::decodeBool(const String& key, bool& result)
 {
     auto boolean = dynamic_cf_cast<CFBooleanRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
     if (!boolean)
@@ -71,12 +76,12 @@ bool KeyedDecoder::decodeBool(const String& key, bool& result)
     return true;
 }
 
-bool KeyedDecoder::decodeUInt32(const String& key, uint32_t& result)
+bool KeyedDecoderCF::decodeUInt32(const String& key, uint32_t& result)
 {
     return decodeInt32(key, reinterpret_cast<int32_t&>(result));
 }
 
-bool KeyedDecoder::decodeInt32(const String& key, int32_t& result)
+bool KeyedDecoderCF::decodeInt32(const String& key, int32_t& result)
 {
     auto number = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
     if (!number)
@@ -85,7 +90,7 @@ bool KeyedDecoder::decodeInt32(const String& key, int32_t& result)
     return CFNumberGetValue(number, kCFNumberSInt32Type, &result);
 }
 
-bool KeyedDecoder::decodeInt64(const String& key, int64_t& result)
+bool KeyedDecoderCF::decodeInt64(const String& key, int64_t& result)
 {
     auto number = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
     if (!number)
@@ -94,7 +99,7 @@ bool KeyedDecoder::decodeInt64(const String& key, int64_t& result)
     return CFNumberGetValue(number, kCFNumberSInt64Type, &result);
 }
 
-bool KeyedDecoder::decodeFloat(const String& key, float& result)
+bool KeyedDecoderCF::decodeFloat(const String& key, float& result)
 {
     auto number = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
     if (!number)
@@ -103,7 +108,7 @@ bool KeyedDecoder::decodeFloat(const String& key, float& result)
     return CFNumberGetValue(number, kCFNumberFloatType, &result);
 }
 
-bool KeyedDecoder::decodeDouble(const String& key, double& result)
+bool KeyedDecoderCF::decodeDouble(const String& key, double& result)
 {
     auto number = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
     if (!number)
@@ -112,7 +117,7 @@ bool KeyedDecoder::decodeDouble(const String& key, double& result)
     return CFNumberGetValue(number, kCFNumberDoubleType, &result);
 }
 
-bool KeyedDecoder::decodeString(const String& key, String& result)
+bool KeyedDecoderCF::decodeString(const String& key, String& result)
 {
     auto string = dynamic_cf_cast<CFStringRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
     if (!string)
@@ -122,7 +127,7 @@ bool KeyedDecoder::decodeString(const String& key, String& result)
     return true;
 }
 
-bool KeyedDecoder::beginObject(const String& key)
+bool KeyedDecoderCF::beginObject(const String& key)
 {
     auto dictionary = dynamic_cf_cast<CFDictionaryRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
     if (!dictionary)
@@ -132,12 +137,12 @@ bool KeyedDecoder::beginObject(const String& key)
     return true;
 }
 
-void KeyedDecoder::endObject()
+void KeyedDecoderCF::endObject()
 {
     m_dictionaryStack.removeLast();
 }
 
-bool KeyedDecoder::beginArray(const String& key)
+bool KeyedDecoderCF::beginArray(const String& key)
 {
     auto array = dynamic_cf_cast<CFArrayRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
     if (!array)
@@ -154,7 +159,7 @@ bool KeyedDecoder::beginArray(const String& key)
     return true;
 }
 
-bool KeyedDecoder::beginArrayElement()
+bool KeyedDecoderCF::beginArrayElement()
 {
     if (m_arrayIndexStack.last() >= CFArrayGetCount(m_arrayStack.last()))
         return false;
@@ -164,15 +169,15 @@ bool KeyedDecoder::beginArrayElement()
     return true;
 }
 
-void KeyedDecoder::endArrayElement()
+void KeyedDecoderCF::endArrayElement()
 {
     m_dictionaryStack.removeLast();
 }
 
-void KeyedDecoder::endArray()
+void KeyedDecoderCF::endArray()
 {
     m_arrayStack.removeLast();
     m_arrayIndexStack.removeLast();
 }
 
-} // namespace WebKit
+} // namespace WebCore
similarity index 89%
rename from Source/WebKit2/Shared/cf/KeyedDecoder.h
rename to Source/WebCore/platform/cf/KeyedDecoderCF.h
index 98ab784..3f07b9a 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef KeyedDecoder_h
-#define KeyedDecoder_h
+#ifndef KeyedDecoderCF_h
+#define KeyedDecoderCF_h
 
-#include <WebCore/KeyedCoding.h>
+#include "KeyedCoding.h"
 #include <wtf/RetainPtr.h>
 #include <wtf/Vector.h>
 
-namespace WebKit {
+namespace WebCore {
 
-class KeyedDecoder final : public WebCore::KeyedDecoder {
+class KeyedDecoderCF final : public KeyedDecoder {
 public:
-    KeyedDecoder(const uint8_t* data, size_t);
-    virtual ~KeyedDecoder() override;
+    KeyedDecoderCF(const uint8_t* data, size_t);
+    virtual ~KeyedDecoderCF() override;
 
 private:
     virtual bool decodeBytes(const String& key, const uint8_t*&, size_t&) override;
@@ -62,6 +62,6 @@ private:
     Vector<CFIndex> m_arrayIndexStack;
 };
 
-} // namespace WebKit
+} // namespace WebCore
 
-#endif // KeyedDecoder_h
+#endif // KeyedDecoderCF_h
similarity index 79%
rename from Source/WebKit2/Shared/cf/KeyedEncoder.cpp
rename to Source/WebCore/platform/cf/KeyedEncoderCF.cpp
index 63f72a5..1ec53d8 100644 (file)
  */
 
 #include "config.h"
-#include "KeyedEncoder.h"
+#include "KeyedEncoderCF.h"
 
+#include "SharedBuffer.h"
 #include <CoreFoundation/CoreFoundation.h>
-#include <WebCore/SharedBuffer.h>
 #include <wtf/text/WTFString.h>
 
-using namespace WebCore;
+namespace WebCore {
 
-namespace WebKit {
+std::unique_ptr<KeyedEncoder> KeyedEncoder::encoder()
+{
+    return std::make_unique<KeyedEncoderCF>();
+}
 
 static RetainPtr<CFMutableDictionaryRef> createDictionary()
 {
     return adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 }
 
-KeyedEncoder::KeyedEncoder()
+KeyedEncoderCF::KeyedEncoderCF()
     : m_rootDictionary(createDictionary())
 {
     m_dictionaryStack.append(m_rootDictionary.get());
 }
     
-KeyedEncoder::~KeyedEncoder()
+KeyedEncoderCF::~KeyedEncoderCF()
 {
     ASSERT(m_dictionaryStack.size() == 1);
     ASSERT(m_dictionaryStack.last() == m_rootDictionary);
     ASSERT(m_arrayStack.isEmpty());
 }
 
-void KeyedEncoder::encodeBytes(const String& key, const uint8_t* bytes, size_t size)
+void KeyedEncoderCF::encodeBytes(const String& key, const uint8_t* bytes, size_t size)
 {
     auto data = adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, bytes, size, kCFAllocatorNull));
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), data.get());
 }
 
-void KeyedEncoder::encodeBool(const String& key, bool value)
+void KeyedEncoderCF::encodeBool(const String& key, bool value)
 {
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), value ? kCFBooleanTrue : kCFBooleanFalse);
 }
 
-void KeyedEncoder::encodeUInt32(const String& key, uint32_t value)
+void KeyedEncoderCF::encodeUInt32(const String& key, uint32_t value)
 {
     auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value));
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get());
 }
 
-void KeyedEncoder::encodeInt32(const String& key, int32_t value)
+void KeyedEncoderCF::encodeInt32(const String& key, int32_t value)
 {
     auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value));
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get());
 }
 
-void KeyedEncoder::encodeInt64(const String& key, int64_t value)
+void KeyedEncoderCF::encodeInt64(const String& key, int64_t value)
 {
     auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &value));
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get());
 }
 
-void KeyedEncoder::encodeFloat(const String& key, float value)
+void KeyedEncoderCF::encodeFloat(const String& key, float value)
 {
     auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &value));
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get());
 }
 
-void KeyedEncoder::encodeDouble(const String& key, double value)
+void KeyedEncoderCF::encodeDouble(const String& key, double value)
 {
     auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &value));
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get());
 }
 
-void KeyedEncoder::encodeString(const String& key, const String& value)
+void KeyedEncoderCF::encodeString(const String& key, const String& value)
 {
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), value.createCFString().get());
 }
 
-void KeyedEncoder::beginObject(const String& key)
+void KeyedEncoderCF::beginObject(const String& key)
 {
     auto dictionary = createDictionary();
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), dictionary.get());
@@ -106,12 +109,12 @@ void KeyedEncoder::beginObject(const String& key)
     m_dictionaryStack.append(dictionary.get());
 }
 
-void KeyedEncoder::endObject()
+void KeyedEncoderCF::endObject()
 {
     m_dictionaryStack.removeLast();
 }
 
-void KeyedEncoder::beginArray(const String& key)
+void KeyedEncoderCF::beginArray(const String& key)
 {
     auto array = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
     CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), array.get());
@@ -119,7 +122,7 @@ void KeyedEncoder::beginArray(const String& key)
     m_arrayStack.append(array.get());
 }
 
-void KeyedEncoder::beginArrayElement()
+void KeyedEncoderCF::beginArrayElement()
 {
     auto dictionary = createDictionary();
     CFArrayAppendValue(m_arrayStack.last(), dictionary.get());
@@ -127,17 +130,17 @@ void KeyedEncoder::beginArrayElement()
     m_dictionaryStack.append(dictionary.get());
 }
 
-void KeyedEncoder::endArrayElement()
+void KeyedEncoderCF::endArrayElement()
 {
     m_dictionaryStack.removeLast();
 }
 
-void KeyedEncoder::endArray()
+void KeyedEncoderCF::endArray()
 {
     m_arrayStack.removeLast();
 }
 
-PassRefPtr<SharedBuffer> KeyedEncoder::finishEncoding()
+PassRefPtr<SharedBuffer> KeyedEncoderCF::finishEncoding()
 {
     RetainPtr<CFDataRef> data = adoptCF(CFPropertyListCreateData(kCFAllocatorDefault, m_rootDictionary.get(), kCFPropertyListBinaryFormat_v1_0, 0, nullptr));
     if (!data)
@@ -146,4 +149,4 @@ PassRefPtr<SharedBuffer> KeyedEncoder::finishEncoding()
     return SharedBuffer::wrapCFData(data.get());
 }
 
-} // namespace WebKit
+} // namespace WebCore
similarity index 91%
rename from Source/WebKit2/Shared/cf/KeyedEncoder.h
rename to Source/WebCore/platform/cf/KeyedEncoderCF.h
index 20ca3bf..a928c49 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef KeyedEncoder_h
-#define KeyedEncoder_h
+#ifndef KeyedEncoderCF_h
+#define KeyedEncoderCF_h
 
-#include <WebCore/KeyedCoding.h>
+#include "KeyedCoding.h"
 #include <wtf/RetainPtr.h>
 #include <wtf/Vector.h>
 
-namespace WebKit {
+namespace WebCore {
 
-class KeyedEncoder final : public WebCore::KeyedEncoder {
+class KeyedEncoderCF final : public KeyedEncoder {
 public:
-    KeyedEncoder();
-    ~KeyedEncoder();
+    KeyedEncoderCF();
+    ~KeyedEncoderCF();
 
     virtual PassRefPtr<WebCore::SharedBuffer> finishEncoding() override;
 
@@ -63,6 +63,6 @@ private:
     Vector<CFMutableArrayRef, 16> m_arrayStack;
 };
 
-} // namespace WebKit
+} // namespace WebCore
 
-#endif // KeyedEncoder_h
+#endif // KeyedEncoderCF_h
  */
 
 #include "config.h"
-#include "KeyedDecoder.h"
+#include "KeyedDecoderGlib.h"
 
 #include <wtf/text/CString.h>
 
-namespace WebKit {
+namespace WebCore {
 
-KeyedDecoder::KeyedDecoder(const uint8_t* data, size_t size)
+std::unique_ptr<KeyedDecoder> KeyedDecoder::decoder(const uint8_t* data, size_t size)
+{
+    return std::make_unique<KeyedDecoderGlib>(data, size);
+}
+
+KeyedDecoderGlib::KeyedDecoderGlib(const uint8_t* data, size_t size)
 {
     GRefPtr<GBytes> bytes = adoptGRef(g_bytes_new(data, size));
     GRefPtr<GVariant> variant = g_variant_new_from_bytes(G_VARIANT_TYPE("a{sv}"), bytes.get(), TRUE);
     m_dictionaryStack.append(dictionaryFromGVariant(variant.get()));
 }
 
-KeyedDecoder::~KeyedDecoder()
+KeyedDecoderGlib::~KeyedDecoderGlib()
 {
     ASSERT(m_dictionaryStack.size() == 1);
     ASSERT(m_arrayStack.isEmpty());
     ASSERT(m_arrayIndexStack.isEmpty());
 }
 
-HashMap<String, GRefPtr<GVariant>> KeyedDecoder::dictionaryFromGVariant(GVariant* variant)
+HashMap<String, GRefPtr<GVariant>> KeyedDecoderGlib::dictionaryFromGVariant(GVariant* variant)
 {
     HashMap<String, GRefPtr<GVariant>> dictionary;
     GVariantIter iter;
@@ -56,7 +61,7 @@ HashMap<String, GRefPtr<GVariant>> KeyedDecoder::dictionaryFromGVariant(GVariant
     return WTF::move(dictionary);
 }
 
-bool KeyedDecoder::decodeBytes(const String& key, const uint8_t*& bytes, size_t& size)
+bool KeyedDecoderGlib::decodeBytes(const String& key, const uint8_t*& bytes, size_t& size)
 {
     GRefPtr<GVariant> value = m_dictionaryStack.last().get(key);
     if (!value)
@@ -68,7 +73,7 @@ bool KeyedDecoder::decodeBytes(const String& key, const uint8_t*& bytes, size_t&
 }
 
 template<typename T, typename F>
-bool KeyedDecoder::decodeSimpleValue(const String& key, T& result, F getFunction)
+bool KeyedDecoderGlib::decodeSimpleValue(const String& key, T& result, F getFunction)
 {
     GRefPtr<GVariant> value = m_dictionaryStack.last().get(key);
     if (!value)
@@ -78,37 +83,37 @@ bool KeyedDecoder::decodeSimpleValue(const String& key, T& result, F getFunction
     return true;
 }
 
-bool KeyedDecoder::decodeBool(const String& key, bool& result)
+bool KeyedDecoderGlib::decodeBool(const String& key, bool& result)
 {
     return decodeSimpleValue(key, result, g_variant_get_boolean);
 }
 
-bool KeyedDecoder::decodeUInt32(const String& key, uint32_t& result)
+bool KeyedDecoderGlib::decodeUInt32(const String& key, uint32_t& result)
 {
     return decodeSimpleValue(key, result, g_variant_get_uint32);
 }
 
-bool KeyedDecoder::decodeInt32(const String& key, int32_t& result)
+bool KeyedDecoderGlib::decodeInt32(const String& key, int32_t& result)
 {
     return decodeSimpleValue(key, result, g_variant_get_int32);
 }
 
-bool KeyedDecoder::decodeInt64(const String& key, int64_t& result)
+bool KeyedDecoderGlib::decodeInt64(const String& key, int64_t& result)
 {
     return decodeSimpleValue(key, result, g_variant_get_int64);
 }
 
-bool KeyedDecoder::decodeFloat(const String& key, float& result)
+bool KeyedDecoderGlib::decodeFloat(const String& key, float& result)
 {
     return decodeSimpleValue(key, result, g_variant_get_double);
 }
 
-bool KeyedDecoder::decodeDouble(const String& key, double& result)
+bool KeyedDecoderGlib::decodeDouble(const String& key, double& result)
 {
     return decodeSimpleValue(key, result, g_variant_get_double);
 }
 
-bool KeyedDecoder::decodeString(const String& key, String& result)
+bool KeyedDecoderGlib::decodeString(const String& key, String& result)
 {
     GRefPtr<GVariant> value = m_dictionaryStack.last().get(key);
     if (!value)
@@ -118,7 +123,7 @@ bool KeyedDecoder::decodeString(const String& key, String& result)
     return true;
 }
 
-bool KeyedDecoder::beginObject(const String& key)
+bool KeyedDecoderGlib::beginObject(const String& key)
 {
     GRefPtr<GVariant> value = m_dictionaryStack.last().get(key);
     if (!value)
@@ -128,12 +133,12 @@ bool KeyedDecoder::beginObject(const String& key)
     return true;
 }
 
-void KeyedDecoder::endObject()
+void KeyedDecoderGlib::endObject()
 {
     m_dictionaryStack.removeLast();
 }
 
-bool KeyedDecoder::beginArray(const String& key)
+bool KeyedDecoderGlib::beginArray(const String& key)
 {
     GRefPtr<GVariant> value = m_dictionaryStack.last().get(key);
     if (!value)
@@ -144,7 +149,7 @@ bool KeyedDecoder::beginArray(const String& key)
     return true;
 }
 
-bool KeyedDecoder::beginArrayElement()
+bool KeyedDecoderGlib::beginArrayElement()
 {
     if (m_arrayIndexStack.last() >= g_variant_n_children(m_arrayStack.last()))
         return false;
@@ -154,15 +159,15 @@ bool KeyedDecoder::beginArrayElement()
     return true;
 }
 
-void KeyedDecoder::endArrayElement()
+void KeyedDecoderGlib::endArrayElement()
 {
     m_dictionaryStack.removeLast();
 }
 
-void KeyedDecoder::endArray()
+void KeyedDecoderGlib::endArray()
 {
     m_arrayStack.removeLast();
     m_arrayIndexStack.removeLast();
 }
 
-} // namespace WebKit
+} // namespace WebCore
similarity index 89%
rename from Source/WebKit2/Shared/glib/KeyedDecoder.h
rename to Source/WebCore/platform/glib/KeyedDecoderGlib.h
index 8eb1c61..9ce88e1 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef KeyedDecoder_h
-#define KeyedDecoder_h
+#ifndef KeyedDecoderGlib_h
+#define KeyedDecoderGlib_h
 
-#include <WebCore/KeyedCoding.h>
+#include "KeyedCoding.h"
 #include <glib.h>
 #include <wtf/HashMap.h>
 #include <wtf/glib/GRefPtr.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 
-namespace WebKit {
+namespace WebCore {
 
-class KeyedDecoder final : public WebCore::KeyedDecoder {
+class KeyedDecoderGlib final : public KeyedDecoder {
 public:
-    KeyedDecoder(const uint8_t* data, size_t);
-    virtual ~KeyedDecoder() override;
+    KeyedDecoderGlib(const uint8_t* data, size_t);
+    virtual ~KeyedDecoderGlib() override;
 
 private:
     virtual bool decodeBytes(const String& key, const uint8_t*&, size_t&) override;
@@ -66,6 +66,6 @@ private:
     Vector<unsigned> m_arrayIndexStack;
 };
 
-} // namespace WebKit
+} // namespace WebCore
 
-#endif // KeyedDecoder_h
+#endif // KeyedDecoderGlib_h
  */
 
 #include "config.h"
-#include "KeyedEncoder.h"
+#include "KeyedEncoderGlib.h"
 
-#include <WebCore/SharedBuffer.h>
+#include "SharedBuffer.h"
 #include <wtf/text/CString.h>
 
-using namespace WebCore;
+namespace WebCore {
 
-namespace WebKit {
+std::unique_ptr<KeyedEncoder> KeyedEncoder::encoder()
+{
+    return std::make_unique<KeyedEncoderGlib>();
+}
 
-KeyedEncoder::KeyedEncoder()
+KeyedEncoderGlib::KeyedEncoderGlib()
 {
     g_variant_builder_init(&m_variantBuilder, G_VARIANT_TYPE("a{sv}"));
     m_variantBuilderStack.append(&m_variantBuilder);
 }
 
-KeyedEncoder::~KeyedEncoder()
+KeyedEncoderGlib::~KeyedEncoderGlib()
 {
     ASSERT(m_variantBuilderStack.size() == 1);
     ASSERT(m_variantBuilderStack.last() == &m_variantBuilder);
@@ -47,84 +50,84 @@ KeyedEncoder::~KeyedEncoder()
     ASSERT(m_objectStack.isEmpty());
 }
 
-void KeyedEncoder::encodeBytes(const String& key, const uint8_t* bytes, size_t size)
+void KeyedEncoderGlib::encodeBytes(const String& key, const uint8_t* bytes, size_t size)
 {
     GRefPtr<GBytes> gBytes = adoptGRef(g_bytes_new_static(bytes, size));
     g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_from_bytes(G_VARIANT_TYPE("ay"), gBytes.get(), TRUE));
 }
 
-void KeyedEncoder::encodeBool(const String& key, bool value)
+void KeyedEncoderGlib::encodeBool(const String& key, bool value)
 {
     g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_boolean(value));
 }
 
-void KeyedEncoder::encodeUInt32(const String& key, uint32_t value)
+void KeyedEncoderGlib::encodeUInt32(const String& key, uint32_t value)
 {
     g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_uint32(value));
 }
 
-void KeyedEncoder::encodeInt32(const String& key, int32_t value)
+void KeyedEncoderGlib::encodeInt32(const String& key, int32_t value)
 {
     g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_int32(value));
 }
 
-void KeyedEncoder::encodeInt64(const String& key, int64_t value)
+void KeyedEncoderGlib::encodeInt64(const String& key, int64_t value)
 {
     g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_int64(value));
 }
 
-void KeyedEncoder::encodeFloat(const String& key, float value)
+void KeyedEncoderGlib::encodeFloat(const String& key, float value)
 {
     encodeDouble(key, value);
 }
 
-void KeyedEncoder::encodeDouble(const String& key, double value)
+void KeyedEncoderGlib::encodeDouble(const String& key, double value)
 {
     g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_double(value));
 }
 
-void KeyedEncoder::encodeString(const String& key, const String& value)
+void KeyedEncoderGlib::encodeString(const String& key, const String& value)
 {
     g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_string(value.utf8().data()));
 }
 
-void KeyedEncoder::beginObject(const String& key)
+void KeyedEncoderGlib::beginObject(const String& key)
 {
     GRefPtr<GVariantBuilder> builder = adoptGRef(g_variant_builder_new(G_VARIANT_TYPE("aa{sv}")));
     m_objectStack.append(std::make_pair(key, builder));
     m_variantBuilderStack.append(builder.get());
 }
 
-void KeyedEncoder::endObject()
+void KeyedEncoderGlib::endObject()
 {
     GVariantBuilder* builder = m_variantBuilderStack.takeLast();
     g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", m_objectStack.last().first.utf8().data(), g_variant_builder_end(builder));
     m_objectStack.removeLast();
 }
 
-void KeyedEncoder::beginArray(const String& key)
+void KeyedEncoderGlib::beginArray(const String& key)
 {
     m_arrayStack.append(std::make_pair(key, adoptGRef(g_variant_builder_new(G_VARIANT_TYPE("aa{sv}")))));
 }
 
-void KeyedEncoder::beginArrayElement()
+void KeyedEncoderGlib::beginArrayElement()
 {
     m_variantBuilderStack.append(g_variant_builder_new(G_VARIANT_TYPE("a{sv}")));
 }
 
-void KeyedEncoder::endArrayElement()
+void KeyedEncoderGlib::endArrayElement()
 {
     GRefPtr<GVariantBuilder> variantBuilder = adoptGRef(m_variantBuilderStack.takeLast());
     g_variant_builder_add_value(m_arrayStack.last().second.get(), g_variant_builder_end(variantBuilder.get()));
 }
 
-void KeyedEncoder::endArray()
+void KeyedEncoderGlib::endArray()
 {
     g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", m_arrayStack.last().first.utf8().data(), g_variant_builder_end(m_arrayStack.last().second.get()));
     m_arrayStack.removeLast();
 }
 
-PassRefPtr<SharedBuffer> KeyedEncoder::finishEncoding()
+PassRefPtr<SharedBuffer> KeyedEncoderGlib::finishEncoding()
 {
     g_assert(m_variantBuilderStack.last() == &m_variantBuilder);
     GRefPtr<GVariant> variant = g_variant_builder_end(&m_variantBuilder);
@@ -132,4 +135,4 @@ PassRefPtr<SharedBuffer> KeyedEncoder::finishEncoding()
     return SharedBuffer::create(static_cast<const unsigned char*>(g_bytes_get_data(data.get(), nullptr)), static_cast<unsigned>(g_bytes_get_size(data.get())));
 }
 
-} // namespace WebKit
+} // namespace WebCore
similarity index 91%
rename from Source/WebKit2/Shared/glib/KeyedEncoder.h
rename to Source/WebCore/platform/glib/KeyedEncoderGlib.h
index acbb76b..3a30f4c 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef KeyedEncoder_h
-#define KeyedEncoder_h
+#ifndef KeyedEncoderGlib_h
+#define KeyedEncoderGlib_h
 
-#include <WebCore/KeyedCoding.h>
+#include "KeyedCoding.h"
 #include <glib.h>
 #include <wtf/Vector.h>
 #include <wtf/glib/GRefPtr.h>
 #include <wtf/text/WTFString.h>
 
-namespace WebKit {
+namespace WebCore {
 
-class KeyedEncoder final : public WebCore::KeyedEncoder {
+class KeyedEncoderGlib final : public KeyedEncoder {
 public:
-    KeyedEncoder();
-    ~KeyedEncoder();
+    KeyedEncoderGlib();
+    ~KeyedEncoderGlib();
 
     virtual PassRefPtr<WebCore::SharedBuffer> finishEncoding() override;
 
@@ -65,6 +65,6 @@ private:
     Vector<std::pair<String, GRefPtr<GVariantBuilder>>, 16> m_objectStack;
 };
 
-} // namespace WebKit
+} // namespace WebCore
 
-#endif // KeyedEncoder_h
+#endif // KeyedEncoderGlib_h
index 57fea3c..0c5a085 100644 (file)
@@ -1,3 +1,20 @@
+2015-08-07  Brady Eidson  <beidson@apple.com>
+
+        Move concrete KeyedDecoder/Encoder implementations to WebCore.
+        https://bugs.webkit.org/show_bug.cgi?id=147757.
+
+        Rubberstamped by Andy Estes.
+
+        * DatabaseProcess/IndexedDB/IDBSerialization.cpp:
+        (WebKit::serializeIDBKeyPath):
+        (WebKit::deserializeIDBKeyPath):
+        (WebKit::serializeIDBKeyData):
+        (WebKit::deserializeIDBKeyData):
+        
+        * PlatformEfl.cmake:
+        * PlatformGTK.cmake:
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2015-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Fix GTK+ compile warning also introduced in r188121.
index 7d730be..a125d6a 100644 (file)
 #if ENABLE(INDEXED_DATABASE)
 
 #include "ArgumentEncoder.h"
-#include "KeyedDecoder.h"
-#include "KeyedEncoder.h"
 #include <WebCore/IDBKeyData.h>
 #include <WebCore/IDBKeyPath.h>
+#include <WebCore/KeyedCoding.h>
 
 using namespace WebCore;
 
@@ -39,9 +38,9 @@ namespace WebKit {
 
 RefPtr<SharedBuffer> serializeIDBKeyPath(const IDBKeyPath& keyPath)
 {
-    KeyedEncoder encoder;
-    keyPath.encode(encoder);
-    return encoder.finishEncoding();
+    auto encoder = KeyedEncoder::encoder();
+    keyPath.encode(*encoder);
+    return encoder->finishEncoding();
 }
 
 bool deserializeIDBKeyPath(const uint8_t* data, size_t size, IDBKeyPath& result)
@@ -49,15 +48,15 @@ bool deserializeIDBKeyPath(const uint8_t* data, size_t size, IDBKeyPath& result)
     if (!data || !size)
         return false;
 
-    KeyedDecoder decoder(data, size);
-    return IDBKeyPath::decode(decoder, result);
+    auto decoder = KeyedDecoder::decoder(data, size);
+    return IDBKeyPath::decode(*decoder, result);
 }
 
 RefPtr<SharedBuffer> serializeIDBKeyData(const IDBKeyData& key)
 {
-    KeyedEncoder encoder;
-    key.encode(encoder);
-    return encoder.finishEncoding();
+    auto encoder = KeyedEncoder::encoder();
+    key.encode(*encoder);
+    return encoder->finishEncoding();
 }
 
 bool deserializeIDBKeyData(const uint8_t* data, size_t size, IDBKeyData& result)
@@ -65,8 +64,8 @@ bool deserializeIDBKeyData(const uint8_t* data, size_t size, IDBKeyData& result)
     if (!data || !size)
         return false;
 
-    KeyedDecoder decoder(data, size);
-    return IDBKeyData::decode(decoder, result);
+    auto decoder = KeyedDecoder::decoder(data, size);
+    return IDBKeyData::decode(*decoder, result);
 }
 
 } // namespace WebKit
index ed0f0d8..d1dc895 100644 (file)
@@ -47,9 +47,6 @@ list(APPEND WebKit2_SOURCES
     Shared/efl/ProcessExecutablePathEfl.cpp
     Shared/efl/WebEventFactory.cpp
 
-    Shared/glib/KeyedDecoder.cpp
-    Shared/glib/KeyedEncoder.cpp
-
     Shared/linux/WebMemorySamplerLinux.cpp
 
     Shared/linux/SeccompFilters/OpenSyscall.cpp
index b3b790b..85cb6c4 100644 (file)
@@ -62,8 +62,6 @@ list(APPEND WebKit2_SOURCES
 
     Shared/cairo/ShareableBitmapCairo.cpp
 
-    Shared/glib/KeyedDecoder.cpp
-    Shared/glib/KeyedEncoder.cpp
     Shared/gtk/ArgumentCodersGtk.cpp
     Shared/gtk/NativeContextMenuItemGtk.cpp
     Shared/gtk/NativeWebKeyboardEventGtk.cpp
index 14d602f..1d4295f 100644 (file)
                1AE00D4C182D6EB000087DD7 /* WKBrowsingContextHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */; };
                1AE00D4D182D6EB000087DD7 /* WKBrowsingContextHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D4B182D6EB000087DD7 /* WKBrowsingContextHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1AE00D4F182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */; };
-               1AE00D5C182DADE100087DD7 /* KeyedEncoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE00D5A182DADE100087DD7 /* KeyedEncoder.cpp */; };
-               1AE00D5D182DADE100087DD7 /* KeyedEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D5B182DADE100087DD7 /* KeyedEncoder.h */; };
                1AE00D601831792100087DD7 /* FrameLoadState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE00D5E1831792100087DD7 /* FrameLoadState.cpp */; };
                1AE00D611831792100087DD7 /* FrameLoadState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D5F1831792100087DD7 /* FrameLoadState.h */; };
                1AE00D6B18327C1200087DD7 /* StringReference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE00D6918327C1200087DD7 /* StringReference.cpp */; };
                51834593134532E90092B696 /* WebIconDatabaseClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51834591134532E80092B696 /* WebIconDatabaseClient.h */; };
                518353DA1885BF8C00D9FE44 /* IDBSerialization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518353D81885BF8C00D9FE44 /* IDBSerialization.cpp */; };
                518353DB1885BF8C00D9FE44 /* IDBSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 518353D91885BF8C00D9FE44 /* IDBSerialization.h */; };
-               518353DE1887128B00D9FE44 /* KeyedDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518353DC1887128B00D9FE44 /* KeyedDecoder.cpp */; };
-               518353DF1887128B00D9FE44 /* KeyedDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 518353DD1887128B00D9FE44 /* KeyedDecoder.h */; };
                5183DDEC1630BDFC008BE5C7 /* NetworkProcessConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5105B0D4162F7A7A00E27709 /* NetworkProcessConnection.cpp */; };
                51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51871B59127CB89D00F76232 /* WebContextMenu.cpp */; };
                51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 51871B5A127CB89D00F76232 /* WebContextMenu.h */; };
                1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBrowsingContextHandle.mm; sourceTree = "<group>"; };
                1AE00D4B182D6EB000087DD7 /* WKBrowsingContextHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextHandle.h; sourceTree = "<group>"; };
                1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextHandleInternal.h; sourceTree = "<group>"; };
-               1AE00D5A182DADE100087DD7 /* KeyedEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedEncoder.cpp; sourceTree = "<group>"; };
-               1AE00D5B182DADE100087DD7 /* KeyedEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedEncoder.h; sourceTree = "<group>"; };
                1AE00D5E1831792100087DD7 /* FrameLoadState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoadState.cpp; sourceTree = "<group>"; };
                1AE00D5F1831792100087DD7 /* FrameLoadState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLoadState.h; sourceTree = "<group>"; };
                1AE00D6918327C1200087DD7 /* StringReference.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringReference.cpp; sourceTree = "<group>"; };
                51834591134532E80092B696 /* WebIconDatabaseClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseClient.h; sourceTree = "<group>"; };
                518353D81885BF8C00D9FE44 /* IDBSerialization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBSerialization.cpp; sourceTree = "<group>"; };
                518353D91885BF8C00D9FE44 /* IDBSerialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBSerialization.h; sourceTree = "<group>"; };
-               518353DC1887128B00D9FE44 /* KeyedDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedDecoder.cpp; sourceTree = "<group>"; };
-               518353DD1887128B00D9FE44 /* KeyedDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedDecoder.h; sourceTree = "<group>"; };
                5183B3931379F85C00E8754E /* Shim.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Shim.xcconfig; sourceTree = "<group>"; };
                5184BC4A132E907A006B9E28 /* WebIconDatabase.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebIconDatabase.messages.in; sourceTree = "<group>"; };
                51871B59127CB89D00F76232 /* WebContextMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenu.cpp; sourceTree = "<group>"; };
                        children = (
                                1AAF0C4912B16334008E49E2 /* ArgumentCodersCF.cpp */,
                                1AAF0C4812B16334008E49E2 /* ArgumentCodersCF.h */,
-                               518353DC1887128B00D9FE44 /* KeyedDecoder.cpp */,
-                               518353DD1887128B00D9FE44 /* KeyedDecoder.h */,
-                               1AE00D5A182DADE100087DD7 /* KeyedEncoder.cpp */,
-                               1AE00D5B182DADE100087DD7 /* KeyedEncoder.h */,
                        );
                        path = cf;
                        sourceTree = "<group>";
                                C58CDF2A1887548B00871536 /* InteractionInformationAtPosition.h in Headers */,
                                1AE49A4911FFA8CE0048B464 /* JSNPMethod.h in Headers */,
                                1AE4987811FF7FAA0048B464 /* JSNPObject.h in Headers */,
-                               518353DF1887128B00D9FE44 /* KeyedDecoder.h in Headers */,
-                               1AE00D5D182DADE100087DD7 /* KeyedEncoder.h in Headers */,
                                BCE0937814FB128C001138D9 /* LayerHostingContext.h in Headers */,
                                0F0C365A18C0555800F607D7 /* LayerRepresentation.h in Headers */,
                                1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */,
                                C58CDF2D1887609F00871536 /* InteractionInformationAtPosition.cpp in Sources */,
                                1AE49A4A11FFA8CE0048B464 /* JSNPMethod.cpp in Sources */,
                                1AE4987911FF7FAA0048B464 /* JSNPObject.cpp in Sources */,
-                               518353DE1887128B00D9FE44 /* KeyedDecoder.cpp in Sources */,
-                               1AE00D5C182DADE100087DD7 /* KeyedEncoder.cpp in Sources */,
                                BCE0937714FB128C001138D9 /* LayerHostingContext.mm in Sources */,
                                0F0C365E18C110A500F607D7 /* LayerRepresentation.mm in Sources */,
                                1A92DC1312F8BAB90017AF65 /* LayerTreeContext.cpp in Sources */,