diff options
-rw-r--r-- | content/renderer/render_thread_impl.cc | 2 | ||||
-rw-r--r-- | content/renderer/renderer_webkitplatformsupport_impl.cc | 3 | ||||
-rw-r--r-- | content/worker/worker_thread.cc | 2 | ||||
-rw-r--r-- | webkit/support/test_webidbfactory.cc | 65 | ||||
-rw-r--r-- | webkit/support/test_webidbfactory.h | 52 | ||||
-rw-r--r-- | webkit/support/test_webkit_platform_support.cc | 6 | ||||
-rw-r--r-- | webkit/support/test_webkit_platform_support.h | 1 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 5 | ||||
-rw-r--r-- | webkit/support/webkit_support.gypi | 2 |
9 files changed, 8 insertions, 130 deletions
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index dc2e968..6a77ce2 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -741,8 +741,6 @@ void RenderThreadImpl::EnsureWebKitInitialized() { WebKit::initialize(webkit_platform_support_.get()); WebKit::setSharedWorkerRepository( webkit_platform_support_.get()->sharedWorkerRepository()); - WebKit::setIDBFactory( - webkit_platform_support_.get()->idbFactory()); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 1e189dc..855a2fd 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -362,9 +362,8 @@ RendererWebKitPlatformSupportImpl::createLocalStorageNamespace( //------------------------------------------------------------------------------ WebIDBFactory* RendererWebKitPlatformSupportImpl::idbFactory() { - if (!web_idb_factory_) { + if (!web_idb_factory_) web_idb_factory_.reset(new RendererWebIDBFactoryImpl()); - } return web_idb_factory_.get(); } diff --git a/content/worker/worker_thread.cc b/content/worker/worker_thread.cc index fa14b41..a5d1cc2 100644 --- a/content/worker/worker_thread.cc +++ b/content/worker/worker_thread.cc @@ -34,8 +34,6 @@ WorkerThread::WorkerThread() { webkit_platform_support_.reset( new WorkerWebKitPlatformSupportImpl(thread_safe_sender())); WebKit::initialize(webkit_platform_support_.get()); - WebKit::setIDBFactory( - webkit_platform_support_.get()->idbFactory()); appcache_dispatcher_.reset(new AppCacheDispatcher(this)); diff --git a/webkit/support/test_webidbfactory.cc b/webkit/support/test_webidbfactory.cc deleted file mode 100644 index 42dfc21..0000000 --- a/webkit/support/test_webidbfactory.cc +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2013 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/support/test_webidbfactory.h" - -#include "base/logging.h" -#include "webkit/base/file_path_string_conversions.h" -#include "webkit/support/webkit_support.h" - -TestWebIDBFactory::TestWebIDBFactory() { - // Create a new temp directory for Indexed DB storage, specific to this - // factory. If this fails, WebKit uses in-memory storage. - if (!indexed_db_dir_.CreateUniqueTempDir()) { - LOG(WARNING) << "Failed to create a temp dir for Indexed DB, " - "using in-memory storage."; - DCHECK(indexed_db_dir_.path().empty()); - } -} - -TestWebIDBFactory::~TestWebIDBFactory() { -} - -void TestWebIDBFactory::getDatabaseNames( - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebString& database_identifier, - const WebKit::WebString& data_dir) { - GetFactory()->getDatabaseNames(callbacks, database_identifier, - data_dir.isEmpty() ? GetDataDir() : data_dir); -} - -void TestWebIDBFactory::open( - const WebKit::WebString& name, - long long version, - long long transaction_id, - WebKit::WebIDBCallbacks* callbacks, - WebKit::WebIDBDatabaseCallbacks* database_callbacks, - const WebKit::WebString& database_identifier, - const WebKit::WebString& data_dir) { - GetFactory()->open(name, version, transaction_id, callbacks, - database_callbacks, database_identifier, - data_dir.isEmpty() ? GetDataDir() : data_dir); -} - -void TestWebIDBFactory::deleteDatabase( - const WebKit::WebString& name, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebString& database_identifier, - const WebKit::WebString& data_dir) { - GetFactory()->deleteDatabase(name, callbacks, database_identifier, - data_dir.isEmpty() ? GetDataDir() : data_dir); -} - -WebKit::WebIDBFactory* TestWebIDBFactory::GetFactory() { - WebKit::WebIDBFactory* factory = factories_.Get(); - if (!factory) { - factory = WebKit::WebIDBFactory::create(); - factories_.Set(factory); - } - return factory; -} - -WebKit::WebString TestWebIDBFactory::GetDataDir() const { - return webkit_base::FilePathToWebString(indexed_db_dir_.path()); -} diff --git a/webkit/support/test_webidbfactory.h b/webkit/support/test_webidbfactory.h deleted file mode 100644 index fb902ea..0000000 --- a/webkit/support/test_webidbfactory.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2013 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 WEBKIT_SUPPORT_TEST_WEBIDBFACTORY_H_ -#define WEBKIT_SUPPORT_TEST_WEBIDBFACTORY_H_ - -#include "base/files/scoped_temp_dir.h" -#include "base/threading/thread_local.h" -#include "third_party/WebKit/public/platform/WebIDBFactory.h" - -// Wrap a WebKit::WebIDBFactory to rewrite the data directory to -// a scoped temp directory. In multiprocess Chromium this is rewritten -// to a real profile directory during IPC. -class TestWebIDBFactory : public WebKit::WebIDBFactory { - public: - TestWebIDBFactory(); - virtual ~TestWebIDBFactory(); - - // WebIDBFactory methods: - virtual void getDatabaseNames(WebKit::WebIDBCallbacks*, - const WebKit::WebString& database_identifier, - const WebKit::WebString& data_dir); - virtual void open(const WebKit::WebString& name, - long long version, - long long transaction_id, - WebKit::WebIDBCallbacks*, - WebKit::WebIDBDatabaseCallbacks*, - const WebKit::WebString& database_identifier, - const WebKit::WebString& data_dir); - virtual void deleteDatabase(const WebKit::WebString& name, - WebKit::WebIDBCallbacks*, - const WebKit::WebString& database_identifier, - const WebKit::WebString& data_dir); - - private: - // Returns the WebIDBFactory implementation to use for the current thread. - WebKit::WebIDBFactory* GetFactory(); - - // Returns the data directory to use. - WebKit::WebString GetDataDir() const; - - // We allocate a separate WebIDBFactory instance per thread since the - // implementation is not thread-safe. We also intentionally leak the - // factory instances to avoid shutdown races. TODO(darin): Can we - // avoid leaking these? - base::ThreadLocalPointer<WebKit::WebIDBFactory> factories_; - - base::ScopedTempDir indexed_db_dir_; -}; - -#endif // WEBKIT_SUPPORT_TEST_WEBIDBFACTORY_H_ diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc index 6e352e1..806db54 100644 --- a/webkit/support/test_webkit_platform_support.cc +++ b/webkit/support/test_webkit_platform_support.cc @@ -199,6 +199,12 @@ WebKit::WebHyphenator* TestWebKitPlatformSupport::hyphenator() { return &hyphenator_; } +WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() { + NOTREACHED() << + "IndexedDB cannot be tested with in-process harnesses."; + return NULL; +} + bool TestWebKitPlatformSupport::sandboxEnabled() { return true; } diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h index 1a85dfa..5059031 100644 --- a/webkit/support/test_webkit_platform_support.h +++ b/webkit/support/test_webkit_platform_support.h @@ -51,6 +51,7 @@ class TestWebKitPlatformSupport : virtual WebKit::WebBlobRegistry* blobRegistry(); virtual WebKit::WebFileSystem* fileSystem(); virtual WebKit::WebHyphenator* hyphenator(); + virtual WebKit::WebIDBFactory* idbFactory(); virtual bool sandboxEnabled(); virtual WebKit::Platform::FileHandle databaseOpenFile( diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index 0da75ba..03408df 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -76,7 +76,6 @@ #include "webkit/support/simple_dom_storage_system.h" #include "webkit/support/simple_file_system.h" #include "webkit/support/simple_resource_loader_bridge.h" -#include "webkit/support/test_webidbfactory.h" #include "webkit/support/test_webkit_platform_support.h" #include "webkit/support/test_webplugin_page_delegate.h" #include "webkit/support/web_layer_tree_view_impl_for_testing.h" @@ -172,9 +171,6 @@ class TestEnvironment { webkit_platform_support_.reset( new TestWebKitPlatformSupport(unit_test_mode, shadow_platform_delegate)); - - idb_factory_.reset(new TestWebIDBFactory()); - WebKit::setIDBFactory(idb_factory_.get()); } ~TestEnvironment() { @@ -216,7 +212,6 @@ class TestEnvironment { scoped_ptr<base::AtExitManager> at_exit_manager_; scoped_ptr<MessageLoopType> main_message_loop_; scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; - scoped_ptr<TestWebIDBFactory> idb_factory_; #if defined(OS_ANDROID) base::FilePath mock_current_directory_; diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi index a949875..0740a24 100644 --- a/webkit/support/webkit_support.gypi +++ b/webkit/support/webkit_support.gypi @@ -61,8 +61,6 @@ 'test_stream_texture_factory_android.h', 'test_webkit_platform_support.cc', 'test_webkit_platform_support.h', - 'test_webidbfactory.cc', - 'test_webidbfactory.h', 'test_webmessageportchannel.cc', 'test_webmessageportchannel.h', 'test_webplugin_page_delegate.cc', |