diff options
author | alecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-22 23:48:57 +0000 |
---|---|---|
committer | alecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-22 23:48:57 +0000 |
commit | 8374250ef7bc60bd9329e6b039777d776e0de45a (patch) | |
tree | 45900dc062916cf0fb72d10d1438b6c9fa8396ab | |
parent | de56c47982b4cb163f5f29fadd02878f9b485ad1 (diff) | |
download | chromium_src-8374250ef7bc60bd9329e6b039777d776e0de45a.zip chromium_src-8374250ef7bc60bd9329e6b039777d776e0de45a.tar.gz chromium_src-8374250ef7bc60bd9329e6b039777d776e0de45a.tar.bz2 |
Remove all the indexeddb-related utility process code
BUG=129471
Review URL: https://chromiumcodereview.appspot.com/10834350
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152873 0039d316-1c4b-4281-b951-d872f2087c98
23 files changed, 0 insertions, 1232 deletions
diff --git a/content/browser/browser_process_sub_thread.cc b/content/browser/browser_process_sub_thread.cc index 4a705ed..4b25f70 100644 --- a/content/browser/browser_process_sub_thread.cc +++ b/content/browser/browser_process_sub_thread.cc @@ -12,7 +12,6 @@ #include "base/threading/thread_restrictions.h" #include "build/build_config.h" #include "content/browser/browser_child_process_host_impl.h" -#include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" #include "content/browser/notification_service_impl.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request.h" @@ -70,8 +69,6 @@ void BrowserProcessSubThread::IOThreadPreCleanUp() { // Destroy all URLRequests started by URLFetchers. net::URLFetcher::CancelAll(); - IndexedDBKeyUtilityClient::Shutdown(); - // If any child processes are still running, terminate them and // and delete the BrowserChildProcessHost instances to release whatever // IO thread only resources they are referencing. diff --git a/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.cc b/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.cc index fdbec8c..93ab39c 100644 --- a/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.cc +++ b/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.cc @@ -7,20 +7,12 @@ #include "base/file_util.h" #include "base/logging.h" #include "content/browser/gpu/browser_gpu_channel_host_factory.h" -#include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" -#include "content/common/indexed_db/indexed_db_key.h" -#include "content/common/indexed_db/indexed_db_key_path.h" #include "content/public/common/serialized_script_value.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "webkit/glue/webkit_glue.h" -using content::IndexedDBKey; -using content::IndexedDBKeyPath; -using content::SerializedScriptValue; - BrowserWebKitPlatformSupportImpl::BrowserWebKitPlatformSupportImpl() { file_utilities_.set_sandbox_enabled(false); } @@ -132,35 +124,6 @@ int BrowserWebKitPlatformSupportImpl::databaseDeleteFile( return file_util::Delete(path, false) ? 0 : 1; } -void -BrowserWebKitPlatformSupportImpl::createIDBKeysFromSerializedValuesAndKeyPath( - const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, - const WebKit::WebIDBKeyPath& keyPath, - WebKit::WebVector<WebKit::WebIDBKey>& keys) { - - std::vector<SerializedScriptValue> std_values; - size_t size = values.size(); - std_values.reserve(size); - for (size_t i = 0; i < size; ++i) - std_values.push_back(SerializedScriptValue(values[i])); - - std::vector<IndexedDBKey> std_keys; - IndexedDBKeyUtilityClient:: - CreateIDBKeysFromSerializedValuesAndKeyPath( - std_values, IndexedDBKeyPath(keyPath), &std_keys); - - keys = std_keys; -} - -WebKit::WebSerializedScriptValue -BrowserWebKitPlatformSupportImpl::injectIDBKeyIntoSerializedValue( - const WebKit::WebIDBKey& key, const WebKit::WebSerializedScriptValue& value, - const WebKit::WebIDBKeyPath& keyPath) { - return IndexedDBKeyUtilityClient::InjectIDBKeyIntoSerializedValue( - IndexedDBKey(key), SerializedScriptValue(value), - IndexedDBKeyPath(keyPath)); -} - GpuChannelHostFactory* BrowserWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { return content::BrowserGpuChannelHostFactory::instance(); diff --git a/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.h b/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.h index ee162b9..878704d 100644 --- a/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.h +++ b/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.h @@ -40,14 +40,6 @@ class BrowserWebKitPlatformSupportImpl : virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository(); virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name, bool sync_dir); - virtual void createIDBKeysFromSerializedValuesAndKeyPath( - const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, - const WebKit::WebIDBKeyPath& keyPath, - WebKit::WebVector<WebKit::WebIDBKey>& keys); - virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue( - const WebKit::WebIDBKey& key, - const WebKit::WebSerializedScriptValue& value, - const WebKit::WebIDBKeyPath& keyPath); protected: virtual GpuChannelHostFactory* GetGpuChannelHostFactory() OVERRIDE; diff --git a/content/browser/in_process_webkit/indexed_db_key_utility_client.cc b/content/browser/in_process_webkit/indexed_db_key_utility_client.cc deleted file mode 100644 index 7ca3667..0000000 --- a/content/browser/in_process_webkit/indexed_db_key_utility_client.cc +++ /dev/null @@ -1,408 +0,0 @@ -// 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 "content/browser/in_process_webkit/indexed_db_key_utility_client.h" - -#include "base/bind.h" -#include "base/lazy_instance.h" -#include "base/synchronization/waitable_event.h" -#include "content/browser/utility_process_host_impl.h" -#include "content/common/indexed_db/indexed_db_key.h" -#include "content/common/indexed_db/indexed_db_key_path.h" -#include "content/common/indexed_db/indexed_db_messages.h" -#include "content/common/utility_messages.h" -#include "content/public/browser/utility_process_host_client.h" -#include "content/public/common/serialized_script_value.h" - -using content::BrowserThread; -using content::IndexedDBKey; -using content::IndexedDBKeyPath; -using content::UtilityProcessHostClient; -using content::SerializedScriptValue; - -// This class is used to obtain IndexedDBKeys from SerializedScriptValues -// given an IDBKeyPath. It uses UtilityProcess to do this inside a sandbox -// (a V8 lock is required there). At this level, all methods are synchronous -// as required by the caller. The public API is used on WEBKIT thread, -// but internally it moves around to UI and IO as needed. -class KeyUtilityClientImpl - : public base::RefCountedThreadSafe<KeyUtilityClientImpl> { - public: - KeyUtilityClientImpl(); - - // Starts the UtilityProcess. Must be called before any other method. - void StartUtilityProcess(); - - // Stops the UtilityProcess. No further keys can be created after this. - void Shutdown(); - - // Synchronously obtain the |keys| from |values| for the given |key_path|. - void CreateIDBKeysFromSerializedValuesAndKeyPath( - const std::vector<SerializedScriptValue>& values, - const IndexedDBKeyPath& key_path, - std::vector<IndexedDBKey>* keys); - - // Synchronously inject |key| into |value| using the given |key_path|, - // returning the new value. - SerializedScriptValue InjectIDBKeyIntoSerializedValue( - const IndexedDBKey& key, - const SerializedScriptValue& value, - const IndexedDBKeyPath& key_path); - - private: - class Client : public UtilityProcessHostClient { - public: - explicit Client(KeyUtilityClientImpl* parent); - - // UtilityProcessHostClient - virtual void OnProcessCrashed(int exit_code); - virtual bool OnMessageReceived(const IPC::Message& message); - - // IPC message handlers - void OnIDBKeysFromValuesAndKeyPathSucceeded( - int id, const std::vector<IndexedDBKey>& keys); - void OnIDBKeysFromValuesAndKeyPathFailed(int id); - void OnInjectIDBKeyFinished(const SerializedScriptValue& value); - - private: - virtual ~Client() {} - - KeyUtilityClientImpl* parent_; - - DISALLOW_COPY_AND_ASSIGN(Client); - }; - - friend class base::RefCountedThreadSafe<KeyUtilityClientImpl>; - ~KeyUtilityClientImpl(); - - void GetRDHAndStartUtilityProcess(); - void StartUtilityProcessInternal(); - void EndUtilityProcessInternal(); - void CallStartIDBKeyFromValueAndKeyPathFromIOThread( - const std::vector<SerializedScriptValue>& values, - const IndexedDBKeyPath& key_path); - void CallStartInjectIDBKeyFromIOThread( - const IndexedDBKey& key, - const SerializedScriptValue& value, - const IndexedDBKeyPath& key_path); - - void SetKeys(const std::vector<IndexedDBKey>& keys); - void FinishCreatingKeys(); - void SetValueAfterInjection(const SerializedScriptValue& value); - void FinishInjectingKey(); - - base::WaitableEvent waitable_event_; - - // Used in both IO and WEBKIT threads, but guarded by WaitableEvent, i.e., - // these members are only set / read when the other thread is blocked. - enum State { - STATE_UNINITIALIZED, - STATE_INITIALIZED, - STATE_CREATING_KEYS, - STATE_INJECTING_KEY, - STATE_SHUTDOWN, - }; - State state_; - std::vector<IndexedDBKey> keys_; - SerializedScriptValue value_after_injection_; - - // Used in the IO thread. - base::WeakPtr<content::UtilityProcessHost> utility_process_host_; - scoped_refptr<Client> client_; - - DISALLOW_COPY_AND_ASSIGN(KeyUtilityClientImpl); -}; - -// IndexedDBKeyUtilityClient definitions. - -static base::LazyInstance<IndexedDBKeyUtilityClient> client_instance = - LAZY_INSTANCE_INITIALIZER; - -IndexedDBKeyUtilityClient::IndexedDBKeyUtilityClient() - : is_shutdown_(false) { - // Note that creating the impl_ object is deferred until it is first needed, - // as this class can be constructed even though it never gets used. -} - -IndexedDBKeyUtilityClient::~IndexedDBKeyUtilityClient() { - DCHECK(!impl_ || is_shutdown_); -} - -// static -void IndexedDBKeyUtilityClient::Shutdown() { - IndexedDBKeyUtilityClient* instance = client_instance.Pointer(); - if (!instance->impl_) - return; - - instance->is_shutdown_ = true; - instance->impl_->Shutdown(); -} - -// static -void IndexedDBKeyUtilityClient::CreateIDBKeysFromSerializedValuesAndKeyPath( - const std::vector<SerializedScriptValue>& values, - const IndexedDBKeyPath& key_path, - std::vector<IndexedDBKey>* keys) { - IndexedDBKeyUtilityClient* instance = client_instance.Pointer(); - - if (instance->is_shutdown_) { - keys->clear(); - return; - } - - if (!instance->impl_) { - instance->impl_ = new KeyUtilityClientImpl(); - instance->impl_->StartUtilityProcess(); - } - - instance->impl_->CreateIDBKeysFromSerializedValuesAndKeyPath(values, key_path, - keys); -} - -// static -SerializedScriptValue -IndexedDBKeyUtilityClient::InjectIDBKeyIntoSerializedValue( - const IndexedDBKey& key, const SerializedScriptValue& value, - const IndexedDBKeyPath& key_path) { - IndexedDBKeyUtilityClient* instance = client_instance.Pointer(); - - if (instance->is_shutdown_) - return SerializedScriptValue(); - - if (!instance->impl_) { - instance->impl_ = new KeyUtilityClientImpl(); - instance->impl_->StartUtilityProcess(); - } - - return instance->impl_->InjectIDBKeyIntoSerializedValue(key, value, key_path); -} - - - -// KeyUtilityClientImpl definitions. - -void KeyUtilityClientImpl::Shutdown() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - - if (utility_process_host_) { - utility_process_host_->EndBatchMode(); - utility_process_host_.reset(); - } - client_ = NULL; - state_ = STATE_SHUTDOWN; -} - -KeyUtilityClientImpl::KeyUtilityClientImpl() - : waitable_event_(false, false), - state_(STATE_UNINITIALIZED) { -} - -KeyUtilityClientImpl::~KeyUtilityClientImpl() { - DCHECK(state_ == STATE_UNINITIALIZED || state_ == STATE_SHUTDOWN); - DCHECK(!utility_process_host_); - DCHECK(!client_.get()); -} - -void KeyUtilityClientImpl::StartUtilityProcess() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); - DCHECK(state_ == STATE_UNINITIALIZED); - - GetRDHAndStartUtilityProcess(); - waitable_event_.Wait(); - - DCHECK(state_ == STATE_INITIALIZED); -} - -void KeyUtilityClientImpl::CreateIDBKeysFromSerializedValuesAndKeyPath( - const std::vector<SerializedScriptValue>& values, - const IndexedDBKeyPath& key_path, - std::vector<IndexedDBKey>* keys) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); - if (state_ == STATE_SHUTDOWN) { - keys->clear(); - return; - } - - DCHECK(state_ == STATE_INITIALIZED); - - state_ = STATE_CREATING_KEYS; - CallStartIDBKeyFromValueAndKeyPathFromIOThread(values, key_path); - waitable_event_.Wait(); - DCHECK(state_ == STATE_INITIALIZED); - - *keys = keys_; -} - -SerializedScriptValue KeyUtilityClientImpl::InjectIDBKeyIntoSerializedValue( - const IndexedDBKey& key, - const SerializedScriptValue& value, - const IndexedDBKeyPath& key_path) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); - if (state_ == STATE_SHUTDOWN) - return SerializedScriptValue(); - - DCHECK(state_ == STATE_INITIALIZED); - - state_ = STATE_INJECTING_KEY; - CallStartInjectIDBKeyFromIOThread(key, value, key_path); - - waitable_event_.Wait(); - DCHECK(state_ == STATE_INITIALIZED); - - return value_after_injection_; -} - - -void KeyUtilityClientImpl::GetRDHAndStartUtilityProcess() { - // In order to start the UtilityProcess, we need to grab - // a pointer to the ResourceDispatcherHost. This can only - // be done on the UI thread. See the comment at the top of - // browser_process.h - if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&KeyUtilityClientImpl::GetRDHAndStartUtilityProcess, this)); - return; - } - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - StartUtilityProcessInternal(); -} - -void KeyUtilityClientImpl::StartUtilityProcessInternal() { - // The ResourceDispatcherHost can only be used on the IO thread. - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&KeyUtilityClientImpl::StartUtilityProcessInternal, this)); - return; - } - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(state_ == STATE_UNINITIALIZED); - - client_ = new KeyUtilityClientImpl::Client(this); - utility_process_host_ = (new UtilityProcessHostImpl( - client_.get(), BrowserThread::IO))->AsWeakPtr(); - utility_process_host_->EnableZygote(); - utility_process_host_->StartBatchMode(); - state_ = STATE_INITIALIZED; - waitable_event_.Signal(); -} - -void KeyUtilityClientImpl::EndUtilityProcessInternal() { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&KeyUtilityClientImpl::EndUtilityProcessInternal, this)); - return; - } - - if (utility_process_host_) { - utility_process_host_->EndBatchMode(); - utility_process_host_.reset(); - } - client_ = NULL; - state_ = STATE_SHUTDOWN; - waitable_event_.Signal(); -} - -void KeyUtilityClientImpl::CallStartIDBKeyFromValueAndKeyPathFromIOThread( - const std::vector<SerializedScriptValue>& values, - const IndexedDBKeyPath& key_path) { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&KeyUtilityClientImpl:: - CallStartIDBKeyFromValueAndKeyPathFromIOThread, - this, values, key_path)); - return; - } - - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (utility_process_host_) { - utility_process_host_->Send(new UtilityMsg_IDBKeysFromValuesAndKeyPath( - 0, values, key_path)); - } -} - -void KeyUtilityClientImpl::CallStartInjectIDBKeyFromIOThread( - const IndexedDBKey& key, - const SerializedScriptValue& value, - const IndexedDBKeyPath& key_path) { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&KeyUtilityClientImpl::CallStartInjectIDBKeyFromIOThread, - this, key, value, key_path)); - return; - } - - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (utility_process_host_) - utility_process_host_->Send(new UtilityMsg_InjectIDBKey( - key, value, key_path)); -} - -void KeyUtilityClientImpl::SetKeys(const std::vector<IndexedDBKey>& keys) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - keys_ = keys; -} - -void KeyUtilityClientImpl::FinishCreatingKeys() { - DCHECK(state_ == STATE_CREATING_KEYS); - state_ = STATE_INITIALIZED; - waitable_event_.Signal(); -} - -void KeyUtilityClientImpl::SetValueAfterInjection( - const SerializedScriptValue& value) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - value_after_injection_ = value; -} - -void KeyUtilityClientImpl::FinishInjectingKey() { - DCHECK(state_ == STATE_INJECTING_KEY); - state_ = STATE_INITIALIZED; - waitable_event_.Signal(); -} - -KeyUtilityClientImpl::Client::Client(KeyUtilityClientImpl* parent) - : parent_(parent) { -} - -void KeyUtilityClientImpl::Client::OnProcessCrashed(int exit_code) { - if (parent_->state_ == STATE_CREATING_KEYS) - parent_->FinishCreatingKeys(); - parent_->Shutdown(); -} - -bool KeyUtilityClientImpl::Client::OnMessageReceived( - const IPC::Message& message) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(KeyUtilityClientImpl::Client, message) - IPC_MESSAGE_HANDLER(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded, - OnIDBKeysFromValuesAndKeyPathSucceeded) - IPC_MESSAGE_HANDLER(UtilityHostMsg_InjectIDBKey_Finished, - OnInjectIDBKeyFinished) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; -} - -void KeyUtilityClientImpl::Client::OnIDBKeysFromValuesAndKeyPathSucceeded( - int id, const std::vector<IndexedDBKey>& keys) { - parent_->SetKeys(keys); - parent_->FinishCreatingKeys(); -} - -void KeyUtilityClientImpl::Client::OnInjectIDBKeyFinished( - const SerializedScriptValue& value) { - parent_->SetValueAfterInjection(value); - parent_->FinishInjectingKey(); -} - -void KeyUtilityClientImpl::Client::OnIDBKeysFromValuesAndKeyPathFailed( - int id) { - parent_->FinishCreatingKeys(); -} diff --git a/content/browser/in_process_webkit/indexed_db_key_utility_client.h b/content/browser/in_process_webkit/indexed_db_key_utility_client.h deleted file mode 100644 index 67c0aa4..0000000 --- a/content/browser/in_process_webkit/indexed_db_key_utility_client.h +++ /dev/null @@ -1,58 +0,0 @@ -// 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. - -#ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_KEY_UTILITY_CLIENT_H_ -#define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_KEY_UTILITY_CLIENT_H_ - -#include <vector> - -#include "base/memory/ref_counted.h" -#include "content/common/content_export.h" - -class KeyUtilityClientImpl; - -namespace base { -template <typename T> -struct DefaultLazyInstanceTraits; -} // namespace base - -namespace content { -class IndexedDBKey; -class IndexedDBKeyPath; -class SerializedScriptValue; -} - -// Class for obtaining IndexedDBKeys from the SerializedScriptValues given -// an IDBKeyPath. This class is a thin singleton wrapper around the -// KeyUtilityClientImpl, which does the real work. -class IndexedDBKeyUtilityClient { - public: - // Synchronously obtain the |keys| from |values| for the given |key_path|. - static void CreateIDBKeysFromSerializedValuesAndKeyPath( - const std::vector<content::SerializedScriptValue>& values, - const content::IndexedDBKeyPath& key_path, - std::vector<content::IndexedDBKey>* keys); - - // Synchronously inject |key| into |value| using |key_path|. Returns the new - // value. - static content::SerializedScriptValue InjectIDBKeyIntoSerializedValue( - const content::IndexedDBKey& key, - const content::SerializedScriptValue& value, - const content::IndexedDBKeyPath& key_path); - - // Shut down the underlying implementation. Must be called on the IO thread. - static void Shutdown(); - - private: - friend struct base::DefaultLazyInstanceTraits<IndexedDBKeyUtilityClient>; - IndexedDBKeyUtilityClient(); - ~IndexedDBKeyUtilityClient(); - - bool is_shutdown_; - - // The real client; laziliy instantiated. - scoped_refptr<KeyUtilityClientImpl> impl_; -}; - -#endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_KEY_UTILITY_CLIENT_H_ diff --git a/content/browser/indexed_db/OWNERS b/content/browser/indexed_db/OWNERS deleted file mode 100644 index 65287b4..0000000 --- a/content/browser/indexed_db/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -dgrogan@chromium.org -hans@chromium.org -michaeln@chromium.org -jsbell@chromium.org diff --git a/content/browser/indexed_db/idbbindingutilities_browsertest.cc b/content/browser/indexed_db/idbbindingutilities_browsertest.cc deleted file mode 100644 index d23dd99..0000000 --- a/content/browser/indexed_db/idbbindingutilities_browsertest.cc +++ /dev/null @@ -1,440 +0,0 @@ -// 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 "base/bind.h" -#include "base/message_loop.h" -#include "base/utf_string_conversions.h" -#include "content/browser/utility_process_host_impl.h" -#include "content/public/browser/utility_process_host_client.h" -#include "content/common/indexed_db/indexed_db_key.h" -#include "content/common/indexed_db/indexed_db_key_path.h" -#include "content/common/utility_messages.h" -#include "content/common/webkitplatformsupport_impl.h" -#include "content/public/common/serialized_script_value.h" -#include "content/public/test/test_utils.h" -#include "content/test/content_browser_test.h" -#include "googleurl/src/gurl.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h" -#include "webkit/glue/idb_bindings.h" -#include "webkit/glue/web_io_operators.h" - -using WebKit::WebSerializedScriptValue; -using WebKit::WebIDBKeyPath; - -namespace content { - -// Enables calling WebKit::shutdown no matter where a "return" happens. -class ScopedShutdownWebKit { - public: - ScopedShutdownWebKit() { - } - - ~ScopedShutdownWebKit() { - WebKit::shutdown(); - } - - private: - DISALLOW_COPY_AND_ASSIGN(ScopedShutdownWebKit); -}; - -// Sanity test, check the function call directly outside the sandbox. -TEST(IDBKeyPathWithoutSandbox, Value) { - WebKitPlatformSupportImpl webkit_platform_support; - WebKit::initialize(&webkit_platform_support); - ScopedShutdownWebKit shutdown_webkit; - - // {foo: "zoo"} - char16 data_foo_zoo[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; - std::vector<WebSerializedScriptValue> serialized_values; - serialized_values.push_back( - WebSerializedScriptValue::fromString(string16(data_foo_zoo, - arraysize(data_foo_zoo)))); - - // {foo: null} - char16 data_foo_null[] = {0x0353, 0x6f66, 0x306f, 0x017b}; - serialized_values.push_back(SerializedScriptValue( - false, false, string16(data_foo_null, arraysize(data_foo_null)))); - - // {} - char16 data_object[] = {0x017b}; - serialized_values.push_back(SerializedScriptValue( - false, false, string16(data_object, arraysize(data_object)))); - - // null - serialized_values.push_back( - WebSerializedScriptValue::fromString(string16())); - - std::vector<WebKit::WebIDBKey> values; - IndexedDBKeyPath key_path; - - key_path.SetString(UTF8ToUTF16("foo")); - webkit_glue::IDBKeysFromValuesAndKeyPath( - serialized_values, key_path, &values); - - ASSERT_EQ(size_t(4), values.size()); - ASSERT_EQ(WebKit::WebIDBKey::StringType, values[0].type()); - ASSERT_EQ(UTF8ToUTF16("zoo"), values[0].string()); - ASSERT_EQ(WebKit::WebIDBKey::InvalidType, values[1].type()); - ASSERT_EQ(WebKit::WebIDBKey::NullType, values[2].type()); - ASSERT_EQ(WebKit::WebIDBKey::NullType, values[3].type()); - - values.clear(); - key_path.SetString(UTF8ToUTF16("PropertyNotAvailable")); - webkit_glue::IDBKeysFromValuesAndKeyPath( - serialized_values, key_path, &values); - - ASSERT_EQ(size_t(4), values.size()); - ASSERT_EQ(WebKit::WebIDBKey::NullType, values[0].type()); - ASSERT_EQ(WebKit::WebIDBKey::NullType, values[1].type()); - ASSERT_EQ(WebKit::WebIDBKey::NullType, values[2].type()); - ASSERT_EQ(WebKit::WebIDBKey::NullType, values[3].type()); - - values.clear(); - key_path.SetString(UTF8ToUTF16("!+Invalid[KeyPath[[[")); - ASSERT_FALSE(key_path.IsValid()); -} - -class IDBKeyPathHelper : public UtilityProcessHostClient { - public: - IDBKeyPathHelper() - : expected_id_(0), - value_for_key_path_failed_(false) { - } - - void CreateUtilityProcess() { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&IDBKeyPathHelper::CreateUtilityProcess, this)); - return; - } - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - utility_process_host_ = - (new UtilityProcessHostImpl(this, BrowserThread::IO))->AsWeakPtr(); - utility_process_host_->EnableZygote(); - utility_process_host_->StartBatchMode(); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - MessageLoop::QuitClosure()); - } - - void DestroyUtilityProcess() { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&IDBKeyPathHelper::DestroyUtilityProcess, this)); - return; - } - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - utility_process_host_->EndBatchMode(); - utility_process_host_.reset(); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - MessageLoop::QuitClosure()); - } - - void SetExpectedKeys(int expected_id, - const std::vector<IndexedDBKey>& expected_keys, - bool failed) { - expected_id_ = expected_id; - expected_keys_ = expected_keys; - value_for_key_path_failed_ = failed; - } - - void SetExpectedValue(const SerializedScriptValue& expected_value) { - expected_value_ = expected_value; - } - - void CheckValuesForKeyPath( - int id, - const std::vector<SerializedScriptValue>& serialized_values, - const IndexedDBKeyPath& key_path) { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&IDBKeyPathHelper::CheckValuesForKeyPath, this, id, - serialized_values, key_path)); - return; - } - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - bool ret = utility_process_host_->Send( - new UtilityMsg_IDBKeysFromValuesAndKeyPath( - id, serialized_values, key_path)); - ASSERT_TRUE(ret); - } - - void CheckInjectValue(const IndexedDBKey& key, - const SerializedScriptValue& value, - const IndexedDBKeyPath& key_path) { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&IDBKeyPathHelper::CheckInjectValue, this, key, value, - key_path)); - return; - } - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - bool ret = utility_process_host_->Send(new UtilityMsg_InjectIDBKey( - key, value, key_path)); - ASSERT_TRUE(ret); - } - - // UtilityProcessHostClient - bool OnMessageReceived(const IPC::Message& message) { - bool msg_is_ok = true; - bool handled = true; - IPC_BEGIN_MESSAGE_MAP_EX(IDBKeyPathHelper, message, msg_is_ok) - IPC_MESSAGE_HANDLER(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded, - OnIDBKeysFromValuesAndKeyPathSucceeded) - IPC_MESSAGE_HANDLER(UtilityHostMsg_InjectIDBKey_Finished, - OnInjectIDBKeyFinished) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP_EX() - return handled; - } - - void OnIDBKeysFromValuesAndKeyPathSucceeded( - int id, const std::vector<IndexedDBKey>& values) { - EXPECT_EQ(expected_id_, id); - EXPECT_FALSE(value_for_key_path_failed_); - ASSERT_EQ(expected_keys_.size(), values.size()); - size_t pos = 0; - for (std::vector<IndexedDBKey>::const_iterator i(values.begin()); - i != values.end(); ++i, ++pos) { - ASSERT_EQ(expected_keys_[pos].type(), i->type()); - if (i->type() == WebKit::WebIDBKey::StringType) { - ASSERT_EQ(expected_keys_[pos].string(), i->string()); - } else if (i->type() == WebKit::WebIDBKey::NumberType) { - ASSERT_EQ(expected_keys_[pos].number(), i->number()); - } - } - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - MessageLoop::QuitClosure()); - } - - void OnIDBKeysFromValuesAndKeyPathFailed(int id) { - EXPECT_TRUE(value_for_key_path_failed_); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - MessageLoop::QuitClosure()); - } - - void OnInjectIDBKeyFinished(const SerializedScriptValue& new_value) { - EXPECT_EQ(expected_value_.data(), new_value.data()); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - MessageLoop::QuitClosure()); - } - - - private: - virtual ~IDBKeyPathHelper() {} - - int expected_id_; - std::vector<IndexedDBKey> expected_keys_; - base::WeakPtr<UtilityProcessHost> utility_process_host_; - bool value_for_key_path_failed_; - SerializedScriptValue expected_value_; -}; - -// This test fixture runs in the UI thread. However, most of the work done by -// UtilityProcessHost (and wrapped by IDBKeyPathHelper above) happens on the IO -// thread. This fixture delegates to IDBKeyPathHelper and blocks via -// "RunMessageLoop()", until IDBKeyPathHelper posts a quit -// message the MessageLoop. -class ScopedIDBKeyPathHelper { - public: - ScopedIDBKeyPathHelper() { - key_path_helper_ = new IDBKeyPathHelper(); - key_path_helper_->CreateUtilityProcess(); - RunMessageLoop(); - } - - ~ScopedIDBKeyPathHelper() { - key_path_helper_->DestroyUtilityProcess(); - RunMessageLoop(); - } - - void SetExpectedKeys(int id, - const std::vector<IndexedDBKey>& expected_keys, - bool failed) { - key_path_helper_->SetExpectedKeys(id, expected_keys, failed); - } - - void SetExpectedValue(const SerializedScriptValue& expected_value) { - key_path_helper_->SetExpectedValue(expected_value); - } - - void CheckValuesForKeyPath( - int id, - const std::vector<SerializedScriptValue>& - serialized_script_values, - const IndexedDBKeyPath& key_path) { - key_path_helper_->CheckValuesForKeyPath(id, serialized_script_values, - key_path); - RunMessageLoop(); - } - - void CheckInjectValue(const IndexedDBKey& key, - const SerializedScriptValue& value, - const IndexedDBKeyPath& key_path) { - key_path_helper_->CheckInjectValue(key, value, key_path); - RunMessageLoop(); - } - - private: - scoped_refptr<IDBKeyPathHelper> key_path_helper_; -}; - -// Cases: -IN_PROC_BROWSER_TEST_F(ContentBrowserTest, IDBKeyPathExtract) { - ScopedIDBKeyPathHelper scoped_helper; - const int kId = 7; - std::vector<IndexedDBKey> expected_keys; - std::vector<SerializedScriptValue> serialized_values; - - IndexedDBKey string_zoo_key; - string_zoo_key.SetString(UTF8ToUTF16("zoo")); - IndexedDBKey null_key; - null_key.SetNull(); - IndexedDBKey invalid_key; - invalid_key.SetInvalid(); - - // keypath: "foo", value: {foo: "zoo"}, expected: "zoo" - char16 data_foo_zoo[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; - serialized_values.push_back(SerializedScriptValue( - false, false, string16(data_foo_zoo, arraysize(data_foo_zoo)))); - expected_keys.push_back(string_zoo_key); - - // keypath: "foo", value: {foo: null}, expected: invalid - char16 data_foo_null[] = {0x0353, 0x6f66, 0x306f, 0x017b}; - serialized_values.push_back(SerializedScriptValue( - false, false, string16(data_foo_null, arraysize(data_foo_null)))); - expected_keys.push_back(invalid_key); - - // keypath: "foo", value: {}, expected: null - char16 data_object[] = {0x017b}; - serialized_values.push_back(SerializedScriptValue( - false, false, string16(data_object, arraysize(data_object)))); - expected_keys.push_back(null_key); - - // keypath: "foo", value: null, expected: null - serialized_values.push_back( - SerializedScriptValue(true, false, string16())); - expected_keys.push_back(null_key); - - scoped_helper.SetExpectedKeys(kId, expected_keys, false); - - IndexedDBKeyPath key_path; - key_path.SetString(UTF8ToUTF16("foo")); - scoped_helper.CheckValuesForKeyPath( - kId, serialized_values, key_path); -} - -IN_PROC_BROWSER_TEST_F(ContentBrowserTest, IDBKeyPathPropertyNotAvailable) { - ScopedIDBKeyPathHelper scoped_helper; - const int kId = 7; - std::vector<IndexedDBKey> expected_keys; - IndexedDBKey null_value; - null_value.SetNull(); - expected_keys.push_back(null_value); - expected_keys.push_back(null_value); - - scoped_helper.SetExpectedKeys(kId, expected_keys, false); - - std::vector<SerializedScriptValue> serialized_values; - // {foo: "zoo", bar: null} - char16 data[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x0353, 0x6162, - 0x3072, 0x027b}; - serialized_values.push_back(SerializedScriptValue( - false, false, string16(data, arraysize(data)))); - - // null - serialized_values.push_back( - SerializedScriptValue(true, false, string16())); - - IndexedDBKeyPath key_path; - key_path.SetString(UTF8ToUTF16("PropertyNotAvailable")); - scoped_helper.CheckValuesForKeyPath(kId, serialized_values, key_path); -} - -IN_PROC_BROWSER_TEST_F(ContentBrowserTest, IDBKeyPathMultipleCalls) { - ScopedIDBKeyPathHelper scoped_helper; - const int kId = 7; - std::vector<IndexedDBKey> expected_keys; - - IndexedDBKey null_value; - null_value.SetNull(); - expected_keys.push_back(null_value); - expected_keys.push_back(null_value); - scoped_helper.SetExpectedKeys(kId, expected_keys, false); - - std::vector<SerializedScriptValue> serialized_values; - - // {foo: "zoo", bar: null} - char16 data[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x0353, 0x6162, - 0x3072, 0x027b}; - serialized_values.push_back(SerializedScriptValue( - false, false, string16(data, arraysize(data)))); - - // null - serialized_values.push_back( - SerializedScriptValue(true, false, string16())); - - IndexedDBKeyPath key_path; - key_path.SetString(UTF8ToUTF16("PropertyNotAvailable")); - scoped_helper.CheckValuesForKeyPath(kId, serialized_values, key_path); - - // Call again with the Utility process in batch mode and with valid keys. - expected_keys.clear(); - IndexedDBKey value; - value.SetString(UTF8ToUTF16("zoo")); - expected_keys.push_back(value); - expected_keys.push_back(null_value); - scoped_helper.SetExpectedKeys(kId + 1, expected_keys, false); - key_path.SetString(UTF8ToUTF16("foo")); - scoped_helper.CheckValuesForKeyPath(kId + 1, serialized_values, key_path); -} - -IN_PROC_BROWSER_TEST_F(ContentBrowserTest, InjectIDBKey) { - // {foo: 'zoo'} - const char16 initial_data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; - SerializedScriptValue value( - false, false, string16(initial_data, arraysize(initial_data))); - IndexedDBKey key; - key.SetString(UTF8ToUTF16("myNewKey")); - - ScopedIDBKeyPathHelper scoped_helper; - - // {foo: 'zoo', bar: 'myNewKey'} - const char16 expected_data[] = {0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603, - 0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f, - 0x5301, 0x6203, 0x7261, 0x013f, 0x0853, - 0x796d, 0x654e, 0x4b77, 0x7965, 0x027b}; - SerializedScriptValue expected_value( - false, false, string16(expected_data, arraysize(expected_data))); - scoped_helper.SetExpectedValue(expected_value); - IndexedDBKeyPath key_path; - key_path.SetString(UTF8ToUTF16("bar")); - scoped_helper.CheckInjectValue(key, value, key_path); - - // Should fail - can't apply properties to string value of key foo - const SerializedScriptValue failure_value; - scoped_helper.SetExpectedValue(failure_value); - key_path.SetString(UTF8ToUTF16("foo.bad.path")); - scoped_helper.CheckInjectValue(key, value, key_path); - - // {foo: 'zoo', bar: {baz: 'myNewKey'}} - const char16 expected_data2[] = {0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603, - 0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f, - 0x5301, 0x6203, 0x7261, 0x013f, 0x3f6f, - 0x5302, 0x6203, 0x7a61, 0x023f, 0x0853, - 0x796d, 0x654e, 0x4b77, 0x7965, 0x017b, - 0x027b}; - SerializedScriptValue expected_value2( - false, false, string16(expected_data2, arraysize(expected_data2))); - scoped_helper.SetExpectedValue(expected_value2); - key_path.SetString(UTF8ToUTF16("bar.baz")); - scoped_helper.CheckInjectValue(key, value, key_path); -} - -} // namespace content diff --git a/content/common/utility_messages.h b/content/common/utility_messages.h index f90297d..3425220 100644 --- a/content/common/utility_messages.h +++ b/content/common/utility_messages.h @@ -9,9 +9,6 @@ #include "base/basictypes.h" #include "content/common/content_export.h" -#include "content/common/indexed_db/indexed_db_key.h" -#include "content/common/indexed_db/indexed_db_key_path.h" -#include "content/common/indexed_db/indexed_db_param_traits.h" #include "content/public/common/common_param_traits.h" #include "content/public/common/serialized_script_value.h" #include "ipc/ipc_message_macros.h" @@ -25,18 +22,6 @@ // Utility process messages: // These are messages from the browser to the utility process. -// Tell the utility process to extract the given IDBKeyPath from the -// SerializedScriptValue vector and reply with the corresponding IDBKeys. -IPC_MESSAGE_CONTROL3(UtilityMsg_IDBKeysFromValuesAndKeyPath, - int, // id - std::vector<content::SerializedScriptValue>, - content::IndexedDBKeyPath) - -IPC_MESSAGE_CONTROL3(UtilityMsg_InjectIDBKey, - content::IndexedDBKey /* key */, - content::SerializedScriptValue /* value */, - content::IndexedDBKeyPath) - // Tells the utility process that it's running in batch mode. IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Started) @@ -54,17 +39,6 @@ IPC_MESSAGE_CONTROL1(UtilityMsg_LoadPlugins, // Utility process host messages: // These are messages from the utility process to the browser. -// Reply when the utility process has succeeded in obtaining the value for -// IDBKeyPath. -IPC_MESSAGE_CONTROL2(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded, - int /* id */, - std::vector<content::IndexedDBKey> /* value */) - -// Reply when the utility process has finished injecting an IDBKey into -// a SerializedScriptValue. -IPC_MESSAGE_CONTROL1(UtilityHostMsg_InjectIDBKey_Finished, - content::SerializedScriptValue /* new value */) - #if defined(OS_POSIX) // Notifies the browser when a plugin failed to load so the two processes can // keep the canonical list in sync. diff --git a/content/content_browser.gypi b/content/content_browser.gypi index efc8ab9..95b9610 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -456,8 +456,6 @@ 'browser/in_process_webkit/indexed_db_database_callbacks.h', 'browser/in_process_webkit/indexed_db_dispatcher_host.cc', 'browser/in_process_webkit/indexed_db_dispatcher_host.h', - 'browser/in_process_webkit/indexed_db_key_utility_client.cc', - 'browser/in_process_webkit/indexed_db_key_utility_client.h', 'browser/in_process_webkit/indexed_db_quota_client.cc', 'browser/in_process_webkit/indexed_db_quota_client.h', 'browser/in_process_webkit/indexed_db_transaction_callbacks.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 4169432..c038f46 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -574,7 +574,6 @@ 'browser/fileapi/file_system_browsertest.cc', 'browser/in_process_webkit/indexed_db_browsertest.cc', 'browser/in_process_webkit/indexed_db_layout_browsertest.cc', - 'browser/indexed_db/idbbindingutilities_browsertest.cc', 'browser/media_browsertest.cc', 'browser/plugin_data_remover_impl_browsertest.cc', 'browser/plugin_browsertest.cc', diff --git a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc index 2f526fd..a97167e 100644 --- a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc +++ b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc @@ -259,19 +259,3 @@ int PpapiWebKitPlatformSupportImpl::databaseDeleteFile( NOTREACHED(); return 0; } - -void PpapiWebKitPlatformSupportImpl::createIDBKeysFromSerializedValuesAndKeyPath( - const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, - const WebKit::WebIDBKeyPath& keyPath, - WebKit::WebVector<WebKit::WebIDBKey>& keys) { - NOTREACHED(); -} - -WebKit::WebSerializedScriptValue -PpapiWebKitPlatformSupportImpl::injectIDBKeyIntoSerializedValue( - const WebKit::WebIDBKey& key, - const WebKit::WebSerializedScriptValue& value, - const WebKit::WebIDBKeyPath& keyPath) { - NOTREACHED(); - return WebKit::WebSerializedScriptValue(); -} diff --git a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h index b12da15..a75d21d 100644 --- a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h +++ b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h @@ -47,14 +47,6 @@ class PpapiWebKitPlatformSupportImpl : virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository(); virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name, bool sync_dir); - virtual void createIDBKeysFromSerializedValuesAndKeyPath( - const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, - const WebKit::WebIDBKeyPath& keyPath, - WebKit::WebVector<WebKit::WebIDBKey>& keys); - virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue( - const WebKit::WebIDBKey& key, - const WebKit::WebSerializedScriptValue& value, - const WebKit::WebIDBKeyPath& keyPath); private: class SandboxSupport; diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index c7e2747..b2096ac 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -39,14 +39,11 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.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/platform/WebMediaStreamCenter.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "webkit/glue/simple_webmimeregistry_impl.h" @@ -87,8 +84,6 @@ using WebKit::WebFileSystem; using WebKit::WebFrame; using WebKit::WebGamepads; using WebKit::WebIDBFactory; -using WebKit::WebIDBKey; -using WebKit::WebIDBKeyPath; using WebKit::WebKitPlatformSupport; using WebKit::WebMediaStreamCenter; using WebKit::WebMediaStreamCenterClient; @@ -96,7 +91,6 @@ using WebKit::WebPeerConnection00Handler; using WebKit::WebPeerConnection00HandlerClient; using WebKit::WebPeerConnectionHandler; using WebKit::WebPeerConnectionHandlerClient; -using WebKit::WebSerializedScriptValue; using WebKit::WebStorageNamespace; using WebKit::WebString; using WebKit::WebURL; @@ -345,29 +339,6 @@ WebIDBFactory* RendererWebKitPlatformSupportImpl::idbFactory() { return web_idb_factory_.get(); } -void RendererWebKitPlatformSupportImpl::createIDBKeysFromSerializedValuesAndKeyPath( - const WebVector<WebSerializedScriptValue>& values, - const WebIDBKeyPath& keyPath, - WebVector<WebIDBKey>& keys_out) { - DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); - WebVector<WebIDBKey> keys(values.size()); - for (size_t i = 0; i < values.size(); ++i) { - keys[i] = WebIDBKey::createFromValueAndKeyPath( - values[i], keyPath); - } - keys_out.swap(keys); -} - -WebSerializedScriptValue -RendererWebKitPlatformSupportImpl::injectIDBKeyIntoSerializedValue( - const WebIDBKey& key, - const WebSerializedScriptValue& value, - const WebIDBKeyPath& keyPath) { - DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); - return WebIDBKey::injectIDBKeyIntoSerializedValue( - key, value, keyPath); -} - //------------------------------------------------------------------------------ WebFileSystem* RendererWebKitPlatformSupportImpl::fileSystem() { diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h index 6446604..62bd512 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.h +++ b/content/renderer/renderer_webkitplatformsupport_impl.h @@ -67,14 +67,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl const WebKit::WebURL& url) OVERRIDE; virtual void screenColorProfile(WebKit::WebVector<char>* to_profile) OVERRIDE; virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE; - virtual void createIDBKeysFromSerializedValuesAndKeyPath( - const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, - const WebKit::WebIDBKeyPath& keyPath, - WebKit::WebVector<WebKit::WebIDBKey>& keys) OVERRIDE; - virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue( - const WebKit::WebIDBKey& key, - const WebKit::WebSerializedScriptValue& value, - const WebKit::WebIDBKeyPath& keyPath) OVERRIDE; virtual WebKit::WebFileSystem* fileSystem() OVERRIDE; virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository() OVERRIDE; virtual bool canAccelerate2dCanvas(); diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc index 421d24a..813d673 100644 --- a/content/utility/utility_thread_impl.cc +++ b/content/utility/utility_thread_impl.cc @@ -11,15 +11,11 @@ #include "base/memory/scoped_vector.h" #include "content/common/child_process.h" #include "content/common/child_process_messages.h" -#include "content/common/indexed_db/indexed_db_key.h" -#include "content/common/indexed_db/indexed_db_key_path.h" #include "content/common/utility_messages.h" #include "content/common/webkitplatformsupport_impl.h" #include "content/public/utility/content_utility_client.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h" -#include "webkit/glue/idb_bindings.h" #include "webkit/plugins/npapi/plugin_list.h" #if defined(TOOLKIT_GTK) @@ -79,9 +75,6 @@ bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) - IPC_MESSAGE_HANDLER(UtilityMsg_IDBKeysFromValuesAndKeyPath, - OnIDBKeysFromValuesAndKeyPath) - IPC_MESSAGE_HANDLER(UtilityMsg_InjectIDBKey, OnInjectIDBKey) IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) #if defined(OS_POSIX) @@ -92,31 +85,6 @@ bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { return handled; } -void UtilityThreadImpl::OnIDBKeysFromValuesAndKeyPath( - int id, - const std::vector<content::SerializedScriptValue>& serialized_script_values, - const content::IndexedDBKeyPath& idb_key_path) { - std::vector<WebKit::WebSerializedScriptValue> web_values; - ConvertVector(serialized_script_values, &web_values); - std::vector<WebKit::WebIDBKey> web_keys; - webkit_glue::IDBKeysFromValuesAndKeyPath( - web_values, idb_key_path, &web_keys); - std::vector<content::IndexedDBKey> keys; - ConvertVector(web_keys, &keys); - Send(new UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded(id, keys)); - ReleaseProcessIfNeeded(); -} - -void UtilityThreadImpl::OnInjectIDBKey( - const content::IndexedDBKey& key, - const content::SerializedScriptValue& value, - const content::IndexedDBKeyPath& key_path) { - content::SerializedScriptValue new_value( - webkit_glue::InjectIDBKey(key, value, key_path)); - Send(new UtilityHostMsg_InjectIDBKey_Finished(new_value)); - ReleaseProcessIfNeeded(); -} - void UtilityThreadImpl::OnBatchModeStarted() { batch_mode_ = true; } diff --git a/content/utility/utility_thread_impl.h b/content/utility/utility_thread_impl.h index 45f7a8b..3e7fd9c 100644 --- a/content/utility/utility_thread_impl.h +++ b/content/utility/utility_thread_impl.h @@ -17,9 +17,6 @@ class FilePath; namespace content { -class IndexedDBKey; -class IndexedDBKeyPath; -class SerializedScriptValue; class WebKitPlatformSupportImpl; } @@ -42,14 +39,6 @@ class UtilityThreadImpl : public content::UtilityThread, virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; // IPC message handlers. - void OnIDBKeysFromValuesAndKeyPath( - int id, - const std::vector<content::SerializedScriptValue>& - serialized_script_values, - const content::IndexedDBKeyPath& idb_key_path); - void OnInjectIDBKey(const content::IndexedDBKey& key, - const content::SerializedScriptValue& value, - const content::IndexedDBKeyPath& key_path); void OnBatchModeStarted(); void OnBatchModeFinished(); diff --git a/webkit/glue/idb_bindings.cc b/webkit/glue/idb_bindings.cc deleted file mode 100644 index 57b8eb4..0000000 --- a/webkit/glue/idb_bindings.cc +++ /dev/null @@ -1,42 +0,0 @@ -// 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<WebSerializedScriptValue>& serialized_script_values, - const WebIDBKeyPath& idb_key_path, - std::vector<WebIDBKey>* values) { - for (std::vector<WebSerializedScriptValue>::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 deleted file mode 100644 index 5b98757..0000000 --- a/webkit/glue/idb_bindings.h +++ /dev/null @@ -1,31 +0,0 @@ -// 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 <vector> - -#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<WebKit::WebSerializedScriptValue>& - serialized_script_values, - const WebKit::WebIDBKeyPath& idb_key_path, - std::vector<WebKit::WebIDBKey>* 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 f7b6bed..94a791a 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -362,8 +362,6 @@ '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 1a98ab2..1d0ea22 100644 --- a/webkit/support/test_webkit_platform_support.cc +++ b/webkit/support/test_webkit_platform_support.cc @@ -20,13 +20,10 @@ #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" @@ -380,27 +377,6 @@ WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() { return new TestWebIDBFactory(); } -void TestWebKitPlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath( - const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, - const WebKit::WebIDBKeyPath& keyPath, - WebKit::WebVector<WebKit::WebIDBKey>& keys_out) { - WebKit::WebVector<WebKit::WebIDBKey> 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 e525f12..77c1979 100644 --- a/webkit/support/test_webkit_platform_support.h +++ b/webkit/support/test_webkit_platform_support.h @@ -73,14 +73,6 @@ class TestWebKitPlatformSupport : const WebKit::WebString& path, unsigned quota) OVERRIDE; virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE; - virtual void createIDBKeysFromSerializedValuesAndKeyPath( - const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, - const WebKit::WebIDBKeyPath& keyPath, - WebKit::WebVector<WebKit::WebIDBKey>& 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 0d69802..91e1736 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.cc +++ b/webkit/tools/test_shell/test_shell_webkit_init.cc @@ -264,26 +264,6 @@ WebKit::WebIDBFactory* TestShellWebKitInit::idbFactory() { return WebKit::WebIDBFactory::create(); } -void TestShellWebKitInit::createIDBKeysFromSerializedValuesAndKeyPath( - const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, - const WebKit::WebIDBKeyPath& keyPath, - WebKit::WebVector<WebKit::WebIDBKey>& keys_out) { - WebKit::WebVector<WebKit::WebIDBKey> 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 7f0eb93..951fc74 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.h +++ b/webkit/tools/test_shell/test_shell_webkit_init.h @@ -8,10 +8,7 @@ #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" @@ -78,17 +75,6 @@ class TestShellWebKitInit : public webkit_glue::WebKitPlatformSupportImpl { virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE; - virtual void createIDBKeysFromSerializedValuesAndKeyPath( - const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, - const WebKit::WebIDBKeyPath& keyPath, - WebKit::WebVector<WebKit::WebIDBKey>& 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 ? |