Diff
Modified: trunk/Source/WebCore/ChangeLog (162147 => 162148)
--- trunk/Source/WebCore/ChangeLog 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebCore/ChangeLog 2014-01-16 21:45:34 UTC (rev 162148)
@@ -1,3 +1,24 @@
+2014-01-16 Brady Eidson <beid...@apple.com>
+
+ Use KeyedCoding as a persistent storage mechanism for blobs
+ https://bugs.webkit.org/show_bug.cgi?id=127012
+
+ Reviewed by Anders Carlsson.
+
+ Add basic KeyedDecoder interface that is the inverse of KeyedEncoder:
+ * platform/KeyedCoding.h:
+ (WebCore::KeyedDecoder::decodeVerifiedEnum):
+ (WebCore::KeyedDecoder::decodeObject):
+ (WebCore::KeyedDecoder::decodeObjects):
+
+ Use KeyedEncoder/Decoder to encode/decode IDBKeyPath:
+ * Modules/indexeddb/IDBKeyPath.cpp:
+ (WebCore::IDBKeyPath::encode):
+ (WebCore::IDBKeyPath::decode):
+ * Modules/indexeddb/IDBKeyPath.h:
+
+ * WebCore.exp.in:
+
2014-01-16 Eric Carlson <eric.carl...@apple.com>
Allow MediaSessionManager to restrict inline <video> playback
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp (162147 => 162148)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp 2014-01-16 21:45:34 UTC (rev 162148)
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
+#include "KeyedCoding.h"
#include <wtf/ASCIICType.h>
#include <wtf/dtoa.h>
#include <wtf/unicode/Unicode.h>
@@ -261,6 +262,49 @@
return result;
}
+void IDBKeyPath::encode(KeyedEncoder& encoder) const
+{
+ encoder.encodeEnum("type", m_type);
+ switch (m_type) {
+ case IDBKeyPath::NullType:
+ break;
+ case IDBKeyPath::StringType:
+ encoder.encodeString("string", m_string);
+ break;
+ case IDBKeyPath::ArrayType:
+ encoder.encodeObjects("array", m_array.begin(), m_array.end(), [](WebCore::KeyedEncoder& encoder, const String& string) {
+ encoder.encodeString("string", string);
+ });
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ };
+}
+
+bool IDBKeyPath::decode(KeyedDecoder& decoder, IDBKeyPath& result)
+{
+ auto enumFunction = [](int64_t value) {
+ return value == NullType || value == StringType || value == ArrayType;
+ };
+
+ if (!decoder.decodeVerifiedEnum("type", result.m_type, enumFunction))
+ return false;
+
+ if (result.m_type == NullType)
+ return true;
+
+ if (result.m_type == StringType)
+ return decoder.decodeString("string", result.m_string);
+
+ ASSERT(result.m_type == ArrayType);
+
+ auto arrayFunction = [](KeyedDecoder& decoder, String& result) {
+ return decoder.decodeString("string", result);
+ };
+
+ return decoder.decodeObjects("array", result.m_array, arrayFunction);
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.h (162147 => 162148)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.h 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.h 2014-01-16 21:45:34 UTC (rev 162148)
@@ -33,6 +33,9 @@
namespace WebCore {
+class KeyedDecoder;
+class KeyedEncoder;
+
enum IDBKeyPathParseError {
IDBKeyPathParseErrorNone,
IDBKeyPathParseErrorStart,
@@ -74,6 +77,9 @@
IDBKeyPath isolatedCopy() const;
+ void encode(KeyedEncoder&) const;
+ static bool decode(KeyedDecoder&, IDBKeyPath&);
+
private:
Type m_type;
String m_string;
Modified: trunk/Source/WebCore/WebCore.exp.in (162147 => 162148)
--- trunk/Source/WebCore/WebCore.exp.in 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-01-16 21:45:34 UTC (rev 162148)
@@ -3074,8 +3074,10 @@
#endif
#if ENABLE(INDEXED_DATABASE)
+__ZNK7WebCore10IDBKeyPath6encodeERNS_12KeyedEncoderE
__ZN7WebCore10IDBKeyPathC1ERKN3WTF6StringE
__ZN7WebCore10IDBKeyPathC1ERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEE
+__ZN7WebCore10IDBKeyPath6decodeERNS_12KeyedDecoderERS0_
__ZN7WebCore18IDBDatabaseBackend14openConnectionEN3WTF10PassRefPtrINS_12IDBCallbacksEEENS2_INS_20IDBDatabaseCallbacksEEExy
__ZN7WebCore18IDBDatabaseBackend6createERKN3WTF6StringES4_PNS_26IDBFactoryBackendInterfaceERNS_19IDBServerConnectionE
__ZN7WebCore18IDBDatabaseBackendD1Ev
Modified: trunk/Source/WebCore/platform/KeyedCoding.h (162147 => 162148)
--- trunk/Source/WebCore/platform/KeyedCoding.h 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebCore/platform/KeyedCoding.h 2014-01-16 21:45:34 UTC (rev 162148)
@@ -26,16 +26,78 @@
#ifndef KeyedCoding_h
#define KeyedCoding_h
+#include <functional>
#include <wtf/Forward.h>
+#include <wtf/Vector.h>
namespace WebCore {
+class SharedBuffer;
+
class KeyedDecoder {
protected:
virtual ~KeyedDecoder() { }
public:
+ virtual bool decodeInt64(const String& key, int64_t&) = 0;
virtual bool decodeUInt32(const String& key, uint32_t&) = 0;
+ virtual bool decodeString(const String& key, String&) = 0;
+
+ template<typename T, typename F>
+ bool decodeVerifiedEnum(const String& key, T& value, F&& function)
+ {
+ static_assert(std::is_enum<T>::value, "T must be an enum type");
+
+ int64_t intValue;
+ if (!decodeInt64(key, intValue))
+ return false;
+
+ if (!function(intValue))
+ return false;
+
+ value = static_cast<T>(intValue);
+ return true;
+ }
+
+ template<typename T, typename F>
+ bool decodeObject(const String& key, T& object, F&& function)
+ {
+ if (!beginObject(key))
+ return false;
+ bool result = function(*this, object);
+ endObject();
+ return result;
+ }
+
+ template<typename T, typename F>
+ bool decodeObjects(const String& key, Vector<T>& objects, F&& function)
+ {
+ if (!beginArray(key))
+ return false;
+
+ bool result = true;
+ while (beginArrayElement()) {
+ T element;
+ if (!function(*this, element)) {
+ result = false;
+ break;
+ }
+ objects.append(std::move(element));
+ endArrayElement();
+ }
+
+ endArray();
+ return result;
+ }
+
+private:
+ virtual bool beginObject(const String& key) = 0;
+ virtual void endObject() = 0;
+
+ virtual bool beginArray(const String& key) = 0;
+ virtual bool beginArrayElement() = 0;
+ virtual void endArrayElement() = 0;
+ virtual void endArray() = 0;
};
class KeyedEncoder {
@@ -52,6 +114,8 @@
virtual void encodeDouble(const String& key, double) = 0;
virtual void encodeString(const String& key, const String&) = 0;
+ virtual PassRefPtr<SharedBuffer> finishEncoding() = 0;
+
template<typename T>
void encodeEnum(const String& key, T value)
{
Modified: trunk/Source/WebKit2/ChangeLog (162147 => 162148)
--- trunk/Source/WebKit2/ChangeLog 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebKit2/ChangeLog 2014-01-16 21:45:34 UTC (rev 162148)
@@ -1,3 +1,41 @@
+2014-01-15 Brady Eidson <beid...@apple.com>
+
+ Use KeyedCoding as a persistent storage mechanism for blobs
+ https://bugs.webkit.org/show_bug.cgi?id=127012
+
+ Reviewed by Anders Carlsson.
+
+ Add a way to get the encoded buffer to save:
+ * Shared/cf/KeyedEncoder.cpp:
+ (WebKit::KeyedEncoder::finishEncoding):
+ * Shared/cf/KeyedEncoder.h:
+
+ Add a WebKit KeyedDecoder for CF platforms that can decode the previously encoded buffer:
+ * Shared/cf/KeyedDecoder.cpp: Added.
+ (WebKit::KeyedDecoder::KeyedDecoder):
+ (WebKit::KeyedDecoder::~KeyedDecoder):
+ (WebKit::KeyedDecoder::decodeInt64):
+ (WebKit::KeyedDecoder::decodeUInt32):
+ (WebKit::KeyedDecoder::decodeString):
+ (WebKit::KeyedDecoder::beginObject):
+ (WebKit::KeyedDecoder::endObject):
+ (WebKit::KeyedDecoder::beginArray):
+ (WebKit::KeyedDecoder::beginArrayElement):
+ (WebKit::KeyedDecoder::endArrayElement):
+ (WebKit::KeyedDecoder::endArray):
+ * Shared/cf/KeyedDecoder.h:
+
+ Create a WebKit KeyedEncoder/Decoder and use to encode/decode IDBKeyPaths:
+ * DatabaseProcess/IndexedDB/IDBSerialization.cpp:
+ (WebKit::serializeIDBKeyPath):
+ (WebKit::deserializeIDBKeyPath):
+ * DatabaseProcess/IndexedDB/IDBSerialization.h:
+
+ * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::createObjectStore):
+
+ * WebKit2.xcodeproj/project.pbxproj:
+
2014-01-16 Andy Estes <aes...@apple.com>
Stop copying WKOriginDataManager.cpp into WebKit2.framework
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.cpp (162147 => 162148)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.cpp 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.cpp 2014-01-16 21:45:34 UTC (rev 162148)
@@ -28,24 +28,29 @@
#if ENABLE(INDEXED_DATABASE)
#include "ArgumentEncoder.h"
+#include "KeyedDecoder.h"
+#include "KeyedEncoder.h"
#include <WebCore/IDBKeyPath.h>
using namespace WebCore;
namespace WebKit {
-std::unique_ptr<Vector<uint8_t>> serializeIDBKeyPath(const WebCore::IDBKeyPath&)
+RefPtr<SharedBuffer> serializeIDBKeyPath(const WebCore::IDBKeyPath& keyPath)
{
- // FIXME: Once we have a serialization solution appropriate for persistent storage to disk, use that here.
-
- return nullptr;
+ KeyedEncoder encoder;
+ keyPath.encode(encoder);
+ return encoder.finishEncoding();
}
-std::unique_ptr<WebCore::IDBKeyPath> deserializeIDBKeyPath(const uint8_t*, size_t)
+std::unique_ptr<WebCore::IDBKeyPath> deserializeIDBKeyPath(const uint8_t* data, size_t size)
{
- // FIXME: Once we have a serialization solution appropriate for persistent storage to disk, use that here.
+ KeyedDecoder decoder(data, size);
+ std::unique_ptr<IDBKeyPath> result = std::make_unique<IDBKeyPath>();
+ if (!IDBKeyPath::decode(decoder, *result))
+ return nullptr;
- return nullptr;
+ return result;
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.h (162147 => 162148)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.h 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.h 2014-01-16 21:45:34 UTC (rev 162148)
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
+#include <WebCore/SharedBuffer.h>
#include <wtf/Vector.h>
namespace WebCore {
@@ -36,7 +37,7 @@
namespace WebKit {
-std::unique_ptr<Vector<uint8_t>> serializeIDBKeyPath(const WebCore::IDBKeyPath&);
+RefPtr<WebCore::SharedBuffer> serializeIDBKeyPath(const WebCore::IDBKeyPath&);
std::unique_ptr<WebCore::IDBKeyPath> deserializeIDBKeyPath(const uint8_t* buffer, size_t bufferSize);
} // namespace WebKit
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp (162147 => 162148)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp 2014-01-16 21:45:34 UTC (rev 162148)
@@ -362,7 +362,7 @@
return false;
}
- std::unique_ptr<Vector<uint8_t>> keyPathBlob = serializeIDBKeyPath(metadata.keyPath);
+ RefPtr<SharedBuffer> keyPathBlob = serializeIDBKeyPath(metadata.keyPath);
if (!keyPathBlob) {
LOG_ERROR("Unable to serialize IDBKeyPath to save in database");
return false;
Added: trunk/Source/WebKit2/Shared/cf/KeyedDecoder.cpp (0 => 162148)
--- trunk/Source/WebKit2/Shared/cf/KeyedDecoder.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/cf/KeyedDecoder.cpp 2014-01-16 21:45:34 UTC (rev 162148)
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2014 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 "KeyedDecoder.h"
+
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+KeyedDecoder::KeyedDecoder(const uint8_t* data, size_t size)
+{
+ auto cfData = adoptCF(CFDataCreate(kCFAllocatorDefault, data, size));
+ m_rootDictionary = adoptCF(static_cast<CFDictionaryRef>(CFPropertyListCreateWithData(kCFAllocatorDefault, cfData.get(), kCFPropertyListImmutable, 0, 0)));
+
+ if (m_rootDictionary && CFGetTypeID(m_rootDictionary.get()) != CFDictionaryGetTypeID())
+ m_rootDictionary = nullptr;
+
+ if (m_rootDictionary)
+ m_dictionaryStack.append(m_rootDictionary.get());
+}
+
+KeyedDecoder::~KeyedDecoder()
+{
+ ASSERT(m_dictionaryStack.size() == 1);
+ ASSERT(m_dictionaryStack.last() == m_rootDictionary);
+ ASSERT(m_arrayStack.isEmpty());
+ ASSERT(m_arrayIndexStack.isEmpty());
+}
+
+bool KeyedDecoder::decodeInt64(const String& key, int64_t& result)
+{
+ if (!m_dictionaryStack.last())
+ return false;
+
+ CFNumberRef number = static_cast<CFNumberRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
+ if (!number || CFGetTypeID(number) != CFNumberGetTypeID() || CFNumberGetType(number) != kCFNumberSInt64Type)
+ return false;
+
+ return CFNumberGetValue(number, kCFNumberSInt64Type, &result);
+}
+
+bool KeyedDecoder::decodeUInt32(const String& key, uint32_t& result)
+{
+ if (!m_dictionaryStack.last())
+ return false;
+
+ CFNumberRef number = static_cast<CFNumberRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
+ if (!number || CFGetTypeID(number) != CFNumberGetTypeID() || CFNumberGetType(number) != kCFNumberSInt32Type)
+ return false;
+
+ return CFNumberGetValue(number, kCFNumberSInt32Type, &result);
+}
+
+bool KeyedDecoder::decodeString(const String& key, String& result)
+{
+ if (!m_dictionaryStack.last())
+ return false;
+
+ CFStringRef string = static_cast<CFStringRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
+ if (!string || CFGetTypeID(string) != CFStringGetTypeID())
+ return false;
+
+ result = string;
+ return true;
+}
+
+bool KeyedDecoder::beginObject(const String& key)
+{
+ if (!m_dictionaryStack.last())
+ return false;
+
+ CFDictionaryRef dictionary = static_cast<CFDictionaryRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
+ if (!dictionary || CFGetTypeID(dictionary) != CFDictionaryGetTypeID())
+ return false;
+
+ m_dictionaryStack.append(dictionary);
+ return true;
+}
+
+void KeyedDecoder::endObject()
+{
+ m_dictionaryStack.removeLast();
+}
+
+bool KeyedDecoder::beginArray(const String& key)
+{
+ if (!m_dictionaryStack.last())
+ return false;
+
+ CFArrayRef array = static_cast<CFArrayRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get()));
+ if (!array || CFGetTypeID(array) != CFArrayGetTypeID())
+ return false;
+
+ for (CFIndex i = 0; i < CFArrayGetCount(array); ++i) {
+ CFTypeRef object = CFArrayGetValueAtIndex(array, i);
+ if (CFGetTypeID(object) != CFDictionaryGetTypeID())
+ return false;
+ }
+
+ m_arrayStack.append(array);
+ m_arrayIndexStack.append(0);
+ return true;
+}
+
+bool KeyedDecoder::beginArrayElement()
+{
+ ASSERT(m_dictionaryStack.last());
+
+ if (m_arrayIndexStack.last() >= CFArrayGetCount(m_arrayStack.last()))
+ return false;
+
+ CFDictionaryRef dictionary = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(m_arrayStack.last(), m_arrayIndexStack.last()++));
+ m_dictionaryStack.append(dictionary);
+ return true;
+}
+
+void KeyedDecoder::endArrayElement()
+{
+ m_dictionaryStack.removeLast();
+}
+
+void KeyedDecoder::endArray()
+{
+ m_arrayStack.removeLast();
+ m_arrayIndexStack.removeLast();
+}
+
+} // namespace WebKit
Copied: trunk/Source/WebKit2/Shared/cf/KeyedDecoder.h (from rev 162147, trunk/Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.h) (0 => 162148)
--- trunk/Source/WebKit2/Shared/cf/KeyedDecoder.h (rev 0)
+++ trunk/Source/WebKit2/Shared/cf/KeyedDecoder.h 2014-01-16 21:45:34 UTC (rev 162148)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2014 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 KeyedDecoder_h
+#define KeyedDecoder_h
+
+#include <WebCore/KeyedCoding.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+
+class KeyedDecoder FINAL : public WebCore::KeyedDecoder {
+public:
+ KeyedDecoder(const uint8_t* data, size_t);
+ virtual ~KeyedDecoder();
+
+private:
+ virtual bool decodeInt64(const String& key, int64_t&);
+ virtual bool decodeUInt32(const String& key, uint32_t&);
+ virtual bool decodeString(const String& key, String&);
+
+ virtual bool beginObject(const String& key);
+ virtual void endObject();
+
+ virtual bool beginArray(const String& key);
+ virtual bool beginArrayElement();
+ virtual void endArrayElement();
+ virtual void endArray();
+
+ RetainPtr<CFDictionaryRef> m_rootDictionary;
+
+ Vector<CFDictionaryRef, 16> m_dictionaryStack;
+ Vector<CFArrayRef, 16> m_arrayStack;
+ Vector<CFIndex> m_arrayIndexStack;
+};
+
+} // namespace WebKit
+
+#endif // KeyedDecoder_h
Modified: trunk/Source/WebKit2/Shared/cf/KeyedEncoder.cpp (162147 => 162148)
--- trunk/Source/WebKit2/Shared/cf/KeyedEncoder.cpp 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebKit2/Shared/cf/KeyedEncoder.cpp 2014-01-16 21:45:34 UTC (rev 162148)
@@ -27,8 +27,11 @@
#include "KeyedEncoder.h"
#include <CoreFoundation/CoreFoundation.h>
+#include <WebCore/SharedBuffer.h>
#include <wtf/text/WTFString.h>
+using namespace WebCore;
+
namespace WebKit {
static RetainPtr<CFMutableDictionaryRef> createDictionary()
@@ -134,4 +137,14 @@
m_arrayStack.removeLast();
}
+PassRefPtr<SharedBuffer> KeyedEncoder::finishEncoding()
+{
+ CFErrorRef error = nullptr;
+ RetainPtr<CFDataRef> data = "" m_rootDictionary.get(), kCFPropertyListBinaryFormat_v1_0, 0, &error));
+ if (error)
+ return nullptr;
+
+ return SharedBuffer::wrapCFData(data.get());
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/cf/KeyedEncoder.h (162147 => 162148)
--- trunk/Source/WebKit2/Shared/cf/KeyedEncoder.h 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebKit2/Shared/cf/KeyedEncoder.h 2014-01-16 21:45:34 UTC (rev 162148)
@@ -37,6 +37,8 @@
KeyedEncoder();
~KeyedEncoder();
+ virtual PassRefPtr<WebCore::SharedBuffer> finishEncoding() OVERRIDE;
+
private:
virtual void encodeBytes(const String& key, const uint8_t*, size_t) override;
virtual void encodeBool(const String& key, bool) override;
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (162147 => 162148)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-01-16 21:30:55 UTC (rev 162147)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-01-16 21:45:34 UTC (rev 162148)
@@ -685,6 +685,8 @@
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 */; };
@@ -2338,6 +2340,8 @@
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>"; };
@@ -3833,6 +3837,8 @@
children = (
1AAF0C4912B16334008E49E2 /* ArgumentCodersCF.cpp */,
1AAF0C4812B16334008E49E2 /* ArgumentCodersCF.h */,
+ 518353DC1887128B00D9FE44 /* KeyedDecoder.cpp */,
+ 518353DD1887128B00D9FE44 /* KeyedDecoder.h */,
1AE00D5A182DADE100087DD7 /* KeyedEncoder.cpp */,
1AE00D5B182DADE100087DD7 /* KeyedEncoder.h */,
);
@@ -6043,6 +6049,7 @@
2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */,
29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */,
2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */,
+ 518353DF1887128B00D9FE44 /* KeyedDecoder.h in Headers */,
93FC67BE12D3CCF200A60610 /* DecoderAdapter.h in Headers */,
BCE81D99131AE02100241910 /* DictionaryPopupInfo.h in Headers */,
C58CDF2E1887609F00871536 /* InteractionInformationAtPosition.h in Headers */,
@@ -7871,6 +7878,7 @@
BCA0EF8012331E78007D3CFB /* WebUndoStep.cpp in Sources */,
2DA944AF1884E9BA00ED86DB /* WebPageProxyIOS.mm in Sources */,
BCE2315E122C30CA00D5C35A /* APIURLRequest.cpp in Sources */,
+ 518353DE1887128B00D9FE44 /* KeyedDecoder.cpp in Sources */,
BC90A1D3122DD55E00CC8C50 /* APIURLResponse.cpp in Sources */,
C0337DD1127A2980008FF4F4 /* WebWheelEvent.cpp in Sources */,
51FCB18517BBFE0300394CD8 /* AsynchronousNetworkLoaderClient.cpp in Sources */,