From f6c57d4e7314812cd196e221462e15f57532f72f Mon Sep 17 00:00:00 2001 From: "ricow@chromium.org" Date: Thu, 23 Aug 2012 10:47:07 +0000 Subject: Revert 152873 - Remove all the indexeddb-related utility process code BUG=129471 Review URL: https://chromiumcodereview.appspot.com/10834350 This seems to be causing test failure on Linux Tests (dbg)(1), first hit here: http://build.chromium.org/p/chromium/builders/Linux%20Tests%20%28dbg%29%281%29/builds/20655/steps/browser_tests/logs/stdio TBR=alecflett@chromium.org Review URL: https://chromiumcodereview.appspot.com/10873028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152980 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/idb_bindings.cc | 42 +++++++++++++++++++++++ webkit/glue/idb_bindings.h | 31 +++++++++++++++++ webkit/glue/webkit_glue.gypi | 2 ++ webkit/support/test_webkit_platform_support.cc | 24 +++++++++++++ webkit/support/test_webkit_platform_support.h | 8 +++++ webkit/tools/test_shell/test_shell_webkit_init.cc | 20 +++++++++++ webkit/tools/test_shell/test_shell_webkit_init.h | 14 ++++++++ 7 files changed, 141 insertions(+) create mode 100644 webkit/glue/idb_bindings.cc create mode 100644 webkit/glue/idb_bindings.h (limited to 'webkit') diff --git a/webkit/glue/idb_bindings.cc b/webkit/glue/idb_bindings.cc new file mode 100644 index 0000000..57b8eb4 --- /dev/null +++ b/webkit/glue/idb_bindings.cc @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/glue/idb_bindings.h" + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "base/utf_string_conversions.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" + +namespace webkit_glue { + +using WebKit::WebIDBKey; +using WebKit::WebIDBKeyPath; +using WebKit::WebSerializedScriptValue; +using WebKit::WebString; + +void IDBKeysFromValuesAndKeyPath( + const std::vector& serialized_script_values, + const WebIDBKeyPath& idb_key_path, + std::vector* values) { + for (std::vector::const_iterator i = + serialized_script_values.begin(); + i != serialized_script_values.end(); ++i) { + values->push_back( + WebIDBKey::createFromValueAndKeyPath(*i, idb_key_path)); + } +} + +WebSerializedScriptValue InjectIDBKey( + const WebIDBKey& key, + const WebSerializedScriptValue& value, + const WebIDBKeyPath& idb_key_path) { + return WebIDBKey::injectIDBKeyIntoSerializedValue( + key, value, idb_key_path); +} + +} // namespace webkit_glue diff --git a/webkit/glue/idb_bindings.h b/webkit/glue/idb_bindings.h new file mode 100644 index 0000000..5b98757 --- /dev/null +++ b/webkit/glue/idb_bindings.h @@ -0,0 +1,31 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +#include "base/basictypes.h" +#include "webkit/glue/webkit_glue_export.h" + +namespace WebKit { +class WebIDBKey; +class WebIDBKeyPath; +class WebSerializedScriptValue; +} + +namespace webkit_glue { + +// Warning: this method holds a V8 lock, it should only be called within a +// sandbox. +WEBKIT_GLUE_EXPORT void IDBKeysFromValuesAndKeyPath( + const std::vector& + serialized_script_values, + const WebKit::WebIDBKeyPath& idb_key_path, + std::vector* values); + +WEBKIT_GLUE_EXPORT WebKit::WebSerializedScriptValue InjectIDBKey( + const WebKit::WebIDBKey& key, + const WebKit::WebSerializedScriptValue& value, + const WebKit::WebIDBKeyPath& idb_key_path); + +} // namespace webkit_glue diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 94a791a..f7b6bed 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -362,6 +362,8 @@ 'gl_bindings_skia_cmd_buffer.h', 'glue_serialize.cc', 'glue_serialize.h', + 'idb_bindings.cc', + 'idb_bindings.h', 'image_decoder.cc', 'image_decoder.h', 'image_resource_fetcher.cc', diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc index 1d0ea22..1a98ab2 100644 --- a/webkit/support/test_webkit_platform_support.cc +++ b/webkit/support/test_webkit_platform_support.cc @@ -20,10 +20,13 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGamepads.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispatcher.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h" @@ -377,6 +380,27 @@ WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() { return new TestWebIDBFactory(); } +void TestWebKitPlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath( + const WebKit::WebVector& values, + const WebKit::WebIDBKeyPath& keyPath, + WebKit::WebVector& keys_out) { + WebKit::WebVector keys(values.size()); + for (size_t i = 0; i < values.size(); ++i) { + keys[i] = WebKit::WebIDBKey::createFromValueAndKeyPath( + values[i], keyPath); + } + keys_out.swap(keys); +} + +WebKit::WebSerializedScriptValue +TestWebKitPlatformSupport::injectIDBKeyIntoSerializedValue( + const WebKit::WebIDBKey& key, + const WebKit::WebSerializedScriptValue& value, + const WebKit::WebIDBKeyPath& keyPath) { + return WebKit::WebIDBKey::injectIDBKeyIntoSerializedValue( + key, value, keyPath); +} + #if defined(OS_WIN) || defined(OS_MACOSX) void TestWebKitPlatformSupport::SetThemeEngine(WebKit::WebThemeEngine* engine) { active_theme_engine_ = engine ? diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h index 77c1979..e525f12 100644 --- a/webkit/support/test_webkit_platform_support.h +++ b/webkit/support/test_webkit_platform_support.h @@ -73,6 +73,14 @@ class TestWebKitPlatformSupport : const WebKit::WebString& path, unsigned quota) OVERRIDE; virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE; + virtual void createIDBKeysFromSerializedValuesAndKeyPath( + const WebKit::WebVector& values, + const WebKit::WebIDBKeyPath& keyPath, + WebKit::WebVector& keys_out) OVERRIDE; + virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue( + const WebKit::WebIDBKey& key, + const WebKit::WebSerializedScriptValue& value, + const WebKit::WebIDBKeyPath& keyPath) OVERRIDE; #if defined(OS_WIN) || defined(OS_MACOSX) void SetThemeEngine(WebKit::WebThemeEngine* engine); diff --git a/webkit/tools/test_shell/test_shell_webkit_init.cc b/webkit/tools/test_shell/test_shell_webkit_init.cc index 91e1736..0d69802 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.cc +++ b/webkit/tools/test_shell/test_shell_webkit_init.cc @@ -264,6 +264,26 @@ WebKit::WebIDBFactory* TestShellWebKitInit::idbFactory() { return WebKit::WebIDBFactory::create(); } +void TestShellWebKitInit::createIDBKeysFromSerializedValuesAndKeyPath( + const WebKit::WebVector& values, + const WebKit::WebIDBKeyPath& keyPath, + WebKit::WebVector& keys_out) { + WebKit::WebVector keys(values.size()); + for (size_t i = 0; i < values.size(); ++i) { + keys[i] = WebKit::WebIDBKey::createFromValueAndKeyPath( + values[i], keyPath); + } + keys_out.swap(keys); +} + +WebKit::WebSerializedScriptValue +TestShellWebKitInit::injectIDBKeyIntoSerializedValue( + const WebKit::WebIDBKey& key, const WebKit::WebSerializedScriptValue& value, + const WebKit::WebIDBKeyPath& keyPath) { + return WebKit::WebIDBKey::injectIDBKeyIntoSerializedValue( + key, value, keyPath); +} + WebKit::WebSharedWorkerRepository* TestShellWebKitInit::sharedWorkerRepository() { return NULL; diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h index 951fc74..7f0eb93 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.h +++ b/webkit/tools/test_shell/test_shell_webkit_init.h @@ -8,7 +8,10 @@ #include "base/compiler_specific.h" #include "base/utf_string_conversions.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h" #include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webfileutilities_impl.h" #include "webkit/glue/webkit_glue.h" @@ -75,6 +78,17 @@ class TestShellWebKitInit : public webkit_glue::WebKitPlatformSupportImpl { virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE; + virtual void createIDBKeysFromSerializedValuesAndKeyPath( + const WebKit::WebVector& values, + const WebKit::WebIDBKeyPath& keyPath, + WebKit::WebVector& keys_out) OVERRIDE; + + virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue( + const WebKit::WebIDBKey& key, + const WebKit::WebSerializedScriptValue& value, + const WebKit::WebIDBKeyPath& keyPath) OVERRIDE; + + #if defined(OS_WIN) void SetThemeEngine(WebKit::WebThemeEngine* engine) { active_theme_engine_ = engine ? -- cgit v1.1