WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-145867-20150711114819.patch (text/plain), 45.47 KB, created by
Gyuyoung Kim
on 2015-07-10 19:49:23 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Gyuyoung Kim
Created:
2015-07-10 19:49:23 PDT
Size:
45.47 KB
patch
obsolete
>Subversion Revision: 186671 >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 42e6cbc55358ed731a94c494ae2fd9fc7f13b947..ced43f9b0a8594d383dc74044bf9c6303b21a934 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,60 @@ >+2015-07-10 Gyuyoung Kim <gyuyoung.kim@webkit.org> >+ >+ [EFL] Support indexeddb for WK2 >+ https://bugs.webkit.org/show_bug.cgi?id=145867 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add stub implementation for indexeddb. Move KeyedDecoder and KeyedEncoder from gtk to glib >+ in order to share it between GTK and EFL ports. >+ >+ * DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp: >+ * DatabaseProcess/efl/DatabaseProcessMainEfl.cpp: Copied from Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp. >+ (WebKit::DatabaseProcessMainUnix): >+ * PlatformEfl.cmake: >+ * PlatformGTK.cmake: >+ * Shared/glib/KeyedDecoder.cpp: Renamed from Source/WebKit2/Shared/gtk/KeyedDecoder.cpp. >+ (WebKit::KeyedDecoder::KeyedDecoder): >+ (WebKit::KeyedDecoder::~KeyedDecoder): >+ (WebKit::KeyedDecoder::dictionaryFromGVariant): >+ (WebKit::KeyedDecoder::decodeBytes): >+ (WebKit::KeyedDecoder::decodeSimpleValue): >+ (WebKit::KeyedDecoder::decodeBool): >+ (WebKit::KeyedDecoder::decodeUInt32): >+ (WebKit::KeyedDecoder::decodeInt32): >+ (WebKit::KeyedDecoder::decodeInt64): >+ (WebKit::KeyedDecoder::decodeFloat): >+ (WebKit::KeyedDecoder::decodeDouble): >+ (WebKit::KeyedDecoder::decodeString): >+ (WebKit::KeyedDecoder::beginObject): >+ (WebKit::KeyedDecoder::endObject): >+ (WebKit::KeyedDecoder::beginArray): >+ (WebKit::KeyedDecoder::beginArrayElement): >+ (WebKit::KeyedDecoder::endArrayElement): >+ (WebKit::KeyedDecoder::endArray): >+ * Shared/glib/KeyedDecoder.h: Renamed from Source/WebKit2/Shared/gtk/KeyedDecoder.h. >+ * Shared/glib/KeyedEncoder.cpp: Renamed from Source/WebKit2/Shared/gtk/KeyedEncoder.cpp. >+ (WebKit::KeyedEncoder::KeyedEncoder): >+ (WebKit::KeyedEncoder::~KeyedEncoder): >+ (WebKit::KeyedEncoder::encodeBytes): >+ (WebKit::KeyedEncoder::encodeBool): >+ (WebKit::KeyedEncoder::encodeUInt32): >+ (WebKit::KeyedEncoder::encodeInt32): >+ (WebKit::KeyedEncoder::encodeInt64): >+ (WebKit::KeyedEncoder::encodeFloat): >+ (WebKit::KeyedEncoder::encodeDouble): >+ (WebKit::KeyedEncoder::encodeString): >+ (WebKit::KeyedEncoder::beginObject): >+ (WebKit::KeyedEncoder::endObject): >+ (WebKit::KeyedEncoder::beginArray): >+ (WebKit::KeyedEncoder::beginArrayElement): >+ (WebKit::KeyedEncoder::endArrayElement): >+ (WebKit::KeyedEncoder::endArray): >+ (WebKit::KeyedEncoder::finishEncoding): >+ * Shared/glib/KeyedEncoder.h: Renamed from Source/WebKit2/Shared/gtk/KeyedEncoder.h. >+ * UIProcess/Databases/efl/DatabaseProcessProxyEfl.cpp: Copied from Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp. >+ (WebKit::DatabaseProcessProxy::platformGetLaunchOptions): >+ > 2015-07-09 Dan Bernstein <mitz@apple.com> > > WebKit2 part of Track and expose policies for external URL schemes and App Links separately >diff --git a/Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp b/Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp >index 1d5522b4cd24d02f0174a6c973e246e8214fd192..9d8b818388a7d12d849802ad8e5db09050cd83c7 100644 >--- a/Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp >+++ b/Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp >@@ -23,6 +23,7 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >+#include "config.h" > #include "DatabaseProcessMainUnix.h" > > using namespace WebKit; >diff --git a/Source/WebKit2/DatabaseProcess/efl/DatabaseProcessMainEfl.cpp b/Source/WebKit2/DatabaseProcess/efl/DatabaseProcessMainEfl.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..04a12cea70789f474810aa2bcb25f40e08dfe142 >--- /dev/null >+++ b/Source/WebKit2/DatabaseProcess/efl/DatabaseProcessMainEfl.cpp >@@ -0,0 +1,53 @@ >+/* >+ * Copyright (C) 2015 Naver Corp. 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 "DatabaseProcess.h" >+ >+#if ENABLE(DATABASE_PROCESS) >+ >+#include "ChildProcessMain.h" >+#include "DatabaseProcessMainUnix.h" >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+class DatabaseProcessMain final: public ChildProcessMainBase { >+public: >+ bool platformInitialize() override >+ { >+ return true; >+ } >+}; >+ >+int DatabaseProcessMainUnix(int argc, char** argv) >+{ >+ return ChildProcessMain<DatabaseProcess, DatabaseProcessMain>(argc, argv); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(DATABASE_PROCESS) >diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake >index 9c1cd8145073ed10b576ed4cf6f39af35d383e28..042bcf65eeb0cf2425a7783998f52394402f59cf 100644 >--- a/Source/WebKit2/PlatformEfl.cmake >+++ b/Source/WebKit2/PlatformEfl.cmake >@@ -1,4 +1,6 @@ > list(APPEND WebKit2_SOURCES >+ DatabaseProcess/efl/DatabaseProcessMainEfl.cpp >+ > NetworkProcess/efl/NetworkProcessMainEfl.cpp > > NetworkProcess/soup/NetworkProcessSoup.cpp >@@ -43,6 +45,9 @@ 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 >@@ -121,6 +126,8 @@ list(APPEND WebKit2_SOURCES > UIProcess/CoordinatedGraphics/WebView.cpp > UIProcess/CoordinatedGraphics/WebViewClient.cpp > >+ UIProcess/Databases/efl/DatabaseProcessProxyEfl.cpp >+ > UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp > > UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp >@@ -228,6 +235,7 @@ list(APPEND WebKit2_INCLUDE_DIRECTORIES > "${WEBCORE_DIR}/platform/graphics/x11" > "${WEBCORE_DIR}/platform/network/soup" > "${WEBCORE_DIR}/platform/text/enchant" >+ "${WEBKIT2_DIR}/DatabaseProcess/unix" > "${WEBKIT2_DIR}/NetworkProcess/efl" > "${WEBKIT2_DIR}/NetworkProcess/unix" > "${WEBKIT2_DIR}/Platform/efl" >@@ -257,6 +265,8 @@ list(APPEND WebKit2_INCLUDE_DIRECTORIES > "${WEBKIT2_DIR}/WebProcess/WebPage/CoordinatedGraphics" > "${WTF_DIR}/wtf/efl" > "${WTF_DIR}/wtf/glib" >+ "${WTF_DIR}" >+ "${WEBKIT2_DIR}" > ) > > list(APPEND WebKit2_SYSTEM_INCLUDE_DIRECTORIES >@@ -313,6 +323,10 @@ list(APPEND NetworkProcess_SOURCES > NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp > ) > >+list(APPEND DatabaseProcess_SOURCES >+ DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp >+) >+ > list(APPEND WebProcess_LIBRARIES > ${CAIRO_LIBRARIES} > ${ECORE_IMF_EVAS_LIBRARIES} >diff --git a/Source/WebKit2/PlatformGTK.cmake b/Source/WebKit2/PlatformGTK.cmake >index 461183bfffcd016c977c0c31f7a44838f2f28962..63c63ab587af4e3408936c44c17469e62f216c49 100644 >--- a/Source/WebKit2/PlatformGTK.cmake >+++ b/Source/WebKit2/PlatformGTK.cmake >@@ -57,9 +57,9 @@ list(APPEND WebKit2_SOURCES > > Shared/cairo/ShareableBitmapCairo.cpp > >+ Shared/glib/KeyedDecoder.cpp >+ Shared/glib/KeyedEncoder.cpp > Shared/gtk/ArgumentCodersGtk.cpp >- Shared/gtk/KeyedDecoder.cpp >- Shared/gtk/KeyedEncoder.cpp > Shared/gtk/NativeContextMenuItemGtk.cpp > Shared/gtk/NativeWebKeyboardEventGtk.cpp > Shared/gtk/NativeWebMouseEventGtk.cpp >@@ -470,6 +470,7 @@ list(APPEND WebKit2_INCLUDE_DIRECTORIES > "${WEBKIT2_DIR}/Shared/API/c/gtk" > "${WEBKIT2_DIR}/Shared/Network/CustomProtocols/soup" > "${WEBKIT2_DIR}/Shared/Downloads/soup" >+ "${WEBKIT2_DIR}/Shared/glib" > "${WEBKIT2_DIR}/Shared/gtk" > "${WEBKIT2_DIR}/Shared/soup" > "${WEBKIT2_DIR}/Shared/unix" >diff --git a/Source/WebKit2/Shared/glib/KeyedDecoder.cpp b/Source/WebKit2/Shared/glib/KeyedDecoder.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..3d20d906694401b6ec2b316e0faabe79e7c2cf4d >--- /dev/null >+++ b/Source/WebKit2/Shared/glib/KeyedDecoder.cpp >@@ -0,0 +1,168 @@ >+/* >+ * Copyright (C) 2015 Igalia S.L. >+ * >+ * 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/CString.h> >+ >+namespace WebKit { >+ >+KeyedDecoder::KeyedDecoder(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() >+{ >+ 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>> dictionary; >+ GVariantIter iter; >+ g_variant_iter_init(&iter, variant); >+ const char* key; >+ GVariant* value; >+ while (g_variant_iter_loop(&iter, "{&sv}", &key, &value)) >+ dictionary.set(String::fromUTF8(key), value); >+ return WTF::move(dictionary); >+} >+ >+bool KeyedDecoder::decodeBytes(const String& key, const uint8_t*& bytes, size_t& size) >+{ >+ GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >+ if (!value) >+ return false; >+ >+ size = g_variant_get_size(value.get()); >+ bytes = static_cast<const uint8_t*>(g_variant_get_data(value.get())); >+ return true; >+} >+ >+template<typename T, typename F> >+bool KeyedDecoder::decodeSimpleValue(const String& key, T& result, F getFunction) >+{ >+ GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >+ if (!value) >+ return false; >+ >+ result = getFunction(value.get()); >+ return true; >+} >+ >+bool KeyedDecoder::decodeBool(const String& key, bool& result) >+{ >+ return decodeSimpleValue(key, result, g_variant_get_boolean); >+} >+ >+bool KeyedDecoder::decodeUInt32(const String& key, uint32_t& result) >+{ >+ return decodeSimpleValue(key, result, g_variant_get_uint32); >+} >+ >+bool KeyedDecoder::decodeInt32(const String& key, int32_t& result) >+{ >+ return decodeSimpleValue(key, result, g_variant_get_int32); >+} >+ >+bool KeyedDecoder::decodeInt64(const String& key, int64_t& result) >+{ >+ return decodeSimpleValue(key, result, g_variant_get_int64); >+} >+ >+bool KeyedDecoder::decodeFloat(const String& key, float& result) >+{ >+ return decodeSimpleValue(key, result, g_variant_get_double); >+} >+ >+bool KeyedDecoder::decodeDouble(const String& key, double& result) >+{ >+ return decodeSimpleValue(key, result, g_variant_get_double); >+} >+ >+bool KeyedDecoder::decodeString(const String& key, String& result) >+{ >+ GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >+ if (!value) >+ return false; >+ >+ result = String::fromUTF8(g_variant_get_string(value.get(), nullptr)); >+ return true; >+} >+ >+bool KeyedDecoder::beginObject(const String& key) >+{ >+ GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >+ if (!value) >+ return false; >+ >+ m_dictionaryStack.append(dictionaryFromGVariant(value.get())); >+ return true; >+} >+ >+void KeyedDecoder::endObject() >+{ >+ m_dictionaryStack.removeLast(); >+} >+ >+bool KeyedDecoder::beginArray(const String& key) >+{ >+ GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >+ if (!value) >+ return false; >+ >+ m_arrayStack.append(value.get()); >+ m_arrayIndexStack.append(0); >+ return true; >+} >+ >+bool KeyedDecoder::beginArrayElement() >+{ >+ if (m_arrayIndexStack.last() >= g_variant_n_children(m_arrayStack.last())) >+ return false; >+ >+ GRefPtr<GVariant> variant = adoptGRef(g_variant_get_child_value(m_arrayStack.last(), m_arrayIndexStack.last()++)); >+ m_dictionaryStack.append(dictionaryFromGVariant(variant.get())); >+ return true; >+} >+ >+void KeyedDecoder::endArrayElement() >+{ >+ m_dictionaryStack.removeLast(); >+} >+ >+void KeyedDecoder::endArray() >+{ >+ m_arrayStack.removeLast(); >+ m_arrayIndexStack.removeLast(); >+} >+ >+} // namespace WebKit >diff --git a/Source/WebKit2/Shared/glib/KeyedDecoder.h b/Source/WebKit2/Shared/glib/KeyedDecoder.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8eb1c6132c86ee4bb27c003be023f9fa38fb1845 >--- /dev/null >+++ b/Source/WebKit2/Shared/glib/KeyedDecoder.h >@@ -0,0 +1,71 @@ >+/* >+ * Copyright (C) 2015 Igaia S.L. >+ * >+ * 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 <glib.h> >+#include <wtf/HashMap.h> >+#include <wtf/glib/GRefPtr.h> >+#include <wtf/text/StringHash.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebKit { >+ >+class KeyedDecoder final : public WebCore::KeyedDecoder { >+public: >+ KeyedDecoder(const uint8_t* data, size_t); >+ virtual ~KeyedDecoder() override; >+ >+private: >+ virtual bool decodeBytes(const String& key, const uint8_t*&, size_t&) override; >+ virtual bool decodeBool(const String& key, bool&) override; >+ virtual bool decodeUInt32(const String& key, uint32_t&) override; >+ virtual bool decodeInt32(const String& key, int32_t&) override; >+ virtual bool decodeInt64(const String& key, int64_t&) override; >+ virtual bool decodeFloat(const String& key, float&) override; >+ virtual bool decodeDouble(const String& key, double&) override; >+ virtual bool decodeString(const String& key, String&) override; >+ >+ virtual bool beginObject(const String& key) override; >+ virtual void endObject() override; >+ >+ virtual bool beginArray(const String& key) override; >+ virtual bool beginArrayElement() override; >+ virtual void endArrayElement() override; >+ virtual void endArray() override; >+ >+ template<typename T, typename F> bool decodeSimpleValue(const String& key, T& result, F getFunction); >+ HashMap<String, GRefPtr<GVariant>> dictionaryFromGVariant(GVariant*); >+ >+ Vector<HashMap<String, GRefPtr<GVariant>>> m_dictionaryStack; >+ Vector<GVariant*, 16> m_arrayStack; >+ Vector<unsigned> m_arrayIndexStack; >+}; >+ >+} // namespace WebKit >+ >+#endif // KeyedDecoder_h >diff --git a/Source/WebKit2/Shared/glib/KeyedEncoder.cpp b/Source/WebKit2/Shared/glib/KeyedEncoder.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..fcdfd8d0a42469d95978d412311c027c95a30c3b >--- /dev/null >+++ b/Source/WebKit2/Shared/glib/KeyedEncoder.cpp >@@ -0,0 +1,135 @@ >+/* >+ * Copyright (C) 2015 Igalia S.L. >+ * >+ * 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 "KeyedEncoder.h" >+ >+#include <WebCore/SharedBuffer.h> >+#include <wtf/text/CString.h> >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+KeyedEncoder::KeyedEncoder() >+{ >+ g_variant_builder_init(&m_variantBuilder, G_VARIANT_TYPE("a{sv}")); >+ m_variantBuilderStack.append(&m_variantBuilder); >+} >+ >+KeyedEncoder::~KeyedEncoder() >+{ >+ ASSERT(m_variantBuilderStack.size() == 1); >+ ASSERT(m_variantBuilderStack.last() == &m_variantBuilder); >+ ASSERT(m_arrayStack.isEmpty()); >+ ASSERT(m_objectStack.isEmpty()); >+} >+ >+void KeyedEncoder::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) >+{ >+ 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) >+{ >+ 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) >+{ >+ 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) >+{ >+ g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_int64(value)); >+} >+ >+void KeyedEncoder::encodeFloat(const String& key, float value) >+{ >+ encodeDouble(key, value); >+} >+ >+void KeyedEncoder::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) >+{ >+ g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_string(value.utf8().data())); >+} >+ >+void KeyedEncoder::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() >+{ >+ 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) >+{ >+ m_arrayStack.append(std::make_pair(key, adoptGRef(g_variant_builder_new(G_VARIANT_TYPE("aa{sv}"))))); >+} >+ >+void KeyedEncoder::beginArrayElement() >+{ >+ m_variantBuilderStack.append(g_variant_builder_new(G_VARIANT_TYPE("a{sv}"))); >+} >+ >+void KeyedEncoder::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() >+{ >+ 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() >+{ >+ g_assert(m_variantBuilderStack.last() == &m_variantBuilder); >+ GRefPtr<GVariant> variant = g_variant_builder_end(&m_variantBuilder); >+ GRefPtr<GBytes> data = g_variant_get_data_as_bytes(variant.get()); >+ 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 >diff --git a/Source/WebKit2/Shared/glib/KeyedEncoder.h b/Source/WebKit2/Shared/glib/KeyedEncoder.h >new file mode 100644 >index 0000000000000000000000000000000000000000..acbb76b2fb81910242d2ab93db3f3109420a6bbd >--- /dev/null >+++ b/Source/WebKit2/Shared/glib/KeyedEncoder.h >@@ -0,0 +1,70 @@ >+/* >+ * Copyright (C) 2015 Igalia S.L. >+ * >+ * 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 KeyedEncoder_h >+#define KeyedEncoder_h >+ >+#include <WebCore/KeyedCoding.h> >+#include <glib.h> >+#include <wtf/Vector.h> >+#include <wtf/glib/GRefPtr.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebKit { >+ >+class KeyedEncoder final : public WebCore::KeyedEncoder { >+public: >+ 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; >+ virtual void encodeUInt32(const String& key, uint32_t) override; >+ virtual void encodeInt32(const String& key, int32_t) override; >+ virtual void encodeInt64(const String& key, int64_t) override; >+ virtual void encodeFloat(const String& key, float) override; >+ virtual void encodeDouble(const String& key, double) override; >+ virtual void encodeString(const String& key, const String&) override; >+ >+ virtual void beginObject(const String& key) override; >+ virtual void endObject() override; >+ >+ virtual void beginArray(const String& key) override; >+ virtual void beginArrayElement() override; >+ virtual void endArrayElement() override; >+ virtual void endArray() override; >+ >+ GVariantBuilder m_variantBuilder; >+ Vector<GVariantBuilder*, 16> m_variantBuilderStack; >+ Vector<std::pair<String, GRefPtr<GVariantBuilder>>, 16> m_arrayStack; >+ Vector<std::pair<String, GRefPtr<GVariantBuilder>>, 16> m_objectStack; >+}; >+ >+} // namespace WebKit >+ >+#endif // KeyedEncoder_h >diff --git a/Source/WebKit2/Shared/gtk/KeyedDecoder.cpp b/Source/WebKit2/Shared/gtk/KeyedDecoder.cpp >deleted file mode 100644 >index 3d20d906694401b6ec2b316e0faabe79e7c2cf4d..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/gtk/KeyedDecoder.cpp >+++ /dev/null >@@ -1,168 +0,0 @@ >-/* >- * Copyright (C) 2015 Igalia S.L. >- * >- * 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/CString.h> >- >-namespace WebKit { >- >-KeyedDecoder::KeyedDecoder(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() >-{ >- 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>> dictionary; >- GVariantIter iter; >- g_variant_iter_init(&iter, variant); >- const char* key; >- GVariant* value; >- while (g_variant_iter_loop(&iter, "{&sv}", &key, &value)) >- dictionary.set(String::fromUTF8(key), value); >- return WTF::move(dictionary); >-} >- >-bool KeyedDecoder::decodeBytes(const String& key, const uint8_t*& bytes, size_t& size) >-{ >- GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >- if (!value) >- return false; >- >- size = g_variant_get_size(value.get()); >- bytes = static_cast<const uint8_t*>(g_variant_get_data(value.get())); >- return true; >-} >- >-template<typename T, typename F> >-bool KeyedDecoder::decodeSimpleValue(const String& key, T& result, F getFunction) >-{ >- GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >- if (!value) >- return false; >- >- result = getFunction(value.get()); >- return true; >-} >- >-bool KeyedDecoder::decodeBool(const String& key, bool& result) >-{ >- return decodeSimpleValue(key, result, g_variant_get_boolean); >-} >- >-bool KeyedDecoder::decodeUInt32(const String& key, uint32_t& result) >-{ >- return decodeSimpleValue(key, result, g_variant_get_uint32); >-} >- >-bool KeyedDecoder::decodeInt32(const String& key, int32_t& result) >-{ >- return decodeSimpleValue(key, result, g_variant_get_int32); >-} >- >-bool KeyedDecoder::decodeInt64(const String& key, int64_t& result) >-{ >- return decodeSimpleValue(key, result, g_variant_get_int64); >-} >- >-bool KeyedDecoder::decodeFloat(const String& key, float& result) >-{ >- return decodeSimpleValue(key, result, g_variant_get_double); >-} >- >-bool KeyedDecoder::decodeDouble(const String& key, double& result) >-{ >- return decodeSimpleValue(key, result, g_variant_get_double); >-} >- >-bool KeyedDecoder::decodeString(const String& key, String& result) >-{ >- GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >- if (!value) >- return false; >- >- result = String::fromUTF8(g_variant_get_string(value.get(), nullptr)); >- return true; >-} >- >-bool KeyedDecoder::beginObject(const String& key) >-{ >- GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >- if (!value) >- return false; >- >- m_dictionaryStack.append(dictionaryFromGVariant(value.get())); >- return true; >-} >- >-void KeyedDecoder::endObject() >-{ >- m_dictionaryStack.removeLast(); >-} >- >-bool KeyedDecoder::beginArray(const String& key) >-{ >- GRefPtr<GVariant> value = m_dictionaryStack.last().get(key); >- if (!value) >- return false; >- >- m_arrayStack.append(value.get()); >- m_arrayIndexStack.append(0); >- return true; >-} >- >-bool KeyedDecoder::beginArrayElement() >-{ >- if (m_arrayIndexStack.last() >= g_variant_n_children(m_arrayStack.last())) >- return false; >- >- GRefPtr<GVariant> variant = adoptGRef(g_variant_get_child_value(m_arrayStack.last(), m_arrayIndexStack.last()++)); >- m_dictionaryStack.append(dictionaryFromGVariant(variant.get())); >- return true; >-} >- >-void KeyedDecoder::endArrayElement() >-{ >- m_dictionaryStack.removeLast(); >-} >- >-void KeyedDecoder::endArray() >-{ >- m_arrayStack.removeLast(); >- m_arrayIndexStack.removeLast(); >-} >- >-} // namespace WebKit >diff --git a/Source/WebKit2/Shared/gtk/KeyedDecoder.h b/Source/WebKit2/Shared/gtk/KeyedDecoder.h >deleted file mode 100644 >index 8eb1c6132c86ee4bb27c003be023f9fa38fb1845..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/gtk/KeyedDecoder.h >+++ /dev/null >@@ -1,71 +0,0 @@ >-/* >- * Copyright (C) 2015 Igaia S.L. >- * >- * 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 <glib.h> >-#include <wtf/HashMap.h> >-#include <wtf/glib/GRefPtr.h> >-#include <wtf/text/StringHash.h> >-#include <wtf/text/WTFString.h> >- >-namespace WebKit { >- >-class KeyedDecoder final : public WebCore::KeyedDecoder { >-public: >- KeyedDecoder(const uint8_t* data, size_t); >- virtual ~KeyedDecoder() override; >- >-private: >- virtual bool decodeBytes(const String& key, const uint8_t*&, size_t&) override; >- virtual bool decodeBool(const String& key, bool&) override; >- virtual bool decodeUInt32(const String& key, uint32_t&) override; >- virtual bool decodeInt32(const String& key, int32_t&) override; >- virtual bool decodeInt64(const String& key, int64_t&) override; >- virtual bool decodeFloat(const String& key, float&) override; >- virtual bool decodeDouble(const String& key, double&) override; >- virtual bool decodeString(const String& key, String&) override; >- >- virtual bool beginObject(const String& key) override; >- virtual void endObject() override; >- >- virtual bool beginArray(const String& key) override; >- virtual bool beginArrayElement() override; >- virtual void endArrayElement() override; >- virtual void endArray() override; >- >- template<typename T, typename F> bool decodeSimpleValue(const String& key, T& result, F getFunction); >- HashMap<String, GRefPtr<GVariant>> dictionaryFromGVariant(GVariant*); >- >- Vector<HashMap<String, GRefPtr<GVariant>>> m_dictionaryStack; >- Vector<GVariant*, 16> m_arrayStack; >- Vector<unsigned> m_arrayIndexStack; >-}; >- >-} // namespace WebKit >- >-#endif // KeyedDecoder_h >diff --git a/Source/WebKit2/Shared/gtk/KeyedEncoder.cpp b/Source/WebKit2/Shared/gtk/KeyedEncoder.cpp >deleted file mode 100644 >index fcdfd8d0a42469d95978d412311c027c95a30c3b..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/gtk/KeyedEncoder.cpp >+++ /dev/null >@@ -1,135 +0,0 @@ >-/* >- * Copyright (C) 2015 Igalia S.L. >- * >- * 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 "KeyedEncoder.h" >- >-#include <WebCore/SharedBuffer.h> >-#include <wtf/text/CString.h> >- >-using namespace WebCore; >- >-namespace WebKit { >- >-KeyedEncoder::KeyedEncoder() >-{ >- g_variant_builder_init(&m_variantBuilder, G_VARIANT_TYPE("a{sv}")); >- m_variantBuilderStack.append(&m_variantBuilder); >-} >- >-KeyedEncoder::~KeyedEncoder() >-{ >- ASSERT(m_variantBuilderStack.size() == 1); >- ASSERT(m_variantBuilderStack.last() == &m_variantBuilder); >- ASSERT(m_arrayStack.isEmpty()); >- ASSERT(m_objectStack.isEmpty()); >-} >- >-void KeyedEncoder::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) >-{ >- 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) >-{ >- 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) >-{ >- 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) >-{ >- g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_int64(value)); >-} >- >-void KeyedEncoder::encodeFloat(const String& key, float value) >-{ >- encodeDouble(key, value); >-} >- >-void KeyedEncoder::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) >-{ >- g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_string(value.utf8().data())); >-} >- >-void KeyedEncoder::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() >-{ >- 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) >-{ >- m_arrayStack.append(std::make_pair(key, adoptGRef(g_variant_builder_new(G_VARIANT_TYPE("aa{sv}"))))); >-} >- >-void KeyedEncoder::beginArrayElement() >-{ >- m_variantBuilderStack.append(g_variant_builder_new(G_VARIANT_TYPE("a{sv}"))); >-} >- >-void KeyedEncoder::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() >-{ >- 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() >-{ >- g_assert(m_variantBuilderStack.last() == &m_variantBuilder); >- GRefPtr<GVariant> variant = g_variant_builder_end(&m_variantBuilder); >- GRefPtr<GBytes> data = g_variant_get_data_as_bytes(variant.get()); >- 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 >diff --git a/Source/WebKit2/Shared/gtk/KeyedEncoder.h b/Source/WebKit2/Shared/gtk/KeyedEncoder.h >deleted file mode 100644 >index acbb76b2fb81910242d2ab93db3f3109420a6bbd..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/gtk/KeyedEncoder.h >+++ /dev/null >@@ -1,70 +0,0 @@ >-/* >- * Copyright (C) 2015 Igalia S.L. >- * >- * 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 KeyedEncoder_h >-#define KeyedEncoder_h >- >-#include <WebCore/KeyedCoding.h> >-#include <glib.h> >-#include <wtf/Vector.h> >-#include <wtf/glib/GRefPtr.h> >-#include <wtf/text/WTFString.h> >- >-namespace WebKit { >- >-class KeyedEncoder final : public WebCore::KeyedEncoder { >-public: >- 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; >- virtual void encodeUInt32(const String& key, uint32_t) override; >- virtual void encodeInt32(const String& key, int32_t) override; >- virtual void encodeInt64(const String& key, int64_t) override; >- virtual void encodeFloat(const String& key, float) override; >- virtual void encodeDouble(const String& key, double) override; >- virtual void encodeString(const String& key, const String&) override; >- >- virtual void beginObject(const String& key) override; >- virtual void endObject() override; >- >- virtual void beginArray(const String& key) override; >- virtual void beginArrayElement() override; >- virtual void endArrayElement() override; >- virtual void endArray() override; >- >- GVariantBuilder m_variantBuilder; >- Vector<GVariantBuilder*, 16> m_variantBuilderStack; >- Vector<std::pair<String, GRefPtr<GVariantBuilder>>, 16> m_arrayStack; >- Vector<std::pair<String, GRefPtr<GVariantBuilder>>, 16> m_objectStack; >-}; >- >-} // namespace WebKit >- >-#endif // KeyedEncoder_h >diff --git a/Source/WebKit2/UIProcess/Databases/efl/DatabaseProcessProxyEfl.cpp b/Source/WebKit2/UIProcess/Databases/efl/DatabaseProcessProxyEfl.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..96eedeeaf0817e50a5369455affbcd959360ed01 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/Databases/efl/DatabaseProcessProxyEfl.cpp >@@ -0,0 +1,39 @@ >+/* >+ * Copyright (C) 2015 Naver Corp. 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 "DatabaseProcessProxy.h" >+ >+#if ENABLE(DATABASE_PROCESS) >+ >+namespace WebKit { >+ >+void DatabaseProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions&) >+{ >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(DATABASE_PROCESS)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 145867
:
254701
|
255055
|
255084
|
256640
|
257267