summaryrefslogtreecommitdiffstats
path: root/content/browser/indexed_db/webidbfactory_impl.cc
diff options
context:
space:
mode:
authorjsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 18:22:58 +0000
committerjsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 18:22:58 +0000
commit4d9d3bc75c7e6598f8c3b3341f8b9d05afcb821d (patch)
treed1cfc4b93f7716d60db658369a0c6a0309f26c96 /content/browser/indexed_db/webidbfactory_impl.cc
parent5772630103e70aba61dbb547cc23d2c8ad0aa793 (diff)
downloadchromium_src-4d9d3bc75c7e6598f8c3b3341f8b9d05afcb821d.zip
chromium_src-4d9d3bc75c7e6598f8c3b3341f8b9d05afcb821d.tar.gz
chromium_src-4d9d3bc75c7e6598f8c3b3341f8b9d05afcb821d.tar.bz2
Migrate the IndexedDB backend from Blink to Chromium
To get the IDB backend off the (deprecated) WebKit thread, remove intermediate proxying, and let us take advantage of base utilities, we're moving the code from Blink to Chromium. This patch is basically a glorified copy/paste of the Blink IDB backend code, with Chromium coding style applied, WTF dependencies replaced with STL and base/, redundant classes removed, etc. It introduces some new temporary proxy classes (content/browser/webidb*_impl.*) to allow us build both the old and new backends. The new backend is currently disabled by default. It can be enabled using a new (and temporary) command line switch: --new-indexeddb Once we've done some further cleanup and are confident that the new backend is stable, and the bots have moved from DumpRenderTree to content_shell, we'll switch to the new backend by default. Once that has survived through a dev channel release, we'll delete the Blink code and eliminate unnecessary proxy classes. BUG=234278 R=alecflett@chromium.org, dgrogan@chromium.org, piman@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=202215 Review URL: https://codereview.chromium.org/15564008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/indexed_db/webidbfactory_impl.cc')
-rw-r--r--content/browser/indexed_db/webidbfactory_impl.cc68
1 files changed, 68 insertions, 0 deletions
diff --git a/content/browser/indexed_db/webidbfactory_impl.cc b/content/browser/indexed_db/webidbfactory_impl.cc
new file mode 100644
index 0000000..2805935
--- /dev/null
+++ b/content/browser/indexed_db/webidbfactory_impl.cc
@@ -0,0 +1,68 @@
+// 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 "content/browser/indexed_db/webidbfactory_impl.h"
+
+#include "base/memory/scoped_ptr.h"
+#include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h"
+#include "content/browser/indexed_db/indexed_db_factory.h"
+#include "content/browser/indexed_db/indexed_db_factory_impl.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebIDBDatabaseCallbacks.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebIDBDatabaseError.h"
+
+using WebKit::WebIDBCallbacks;
+using WebKit::WebIDBDatabaseCallbacks;
+using WebKit::WebIDBFactory;
+using WebKit::WebString;
+
+namespace content {
+
+WebIDBFactoryImpl::WebIDBFactoryImpl()
+ : idb_factory_backend_(IndexedDBFactoryImpl::Create()) {}
+
+WebIDBFactoryImpl::~WebIDBFactoryImpl() {}
+
+void WebIDBFactoryImpl::getDatabaseNames(WebIDBCallbacks* callbacks,
+ const WebString& database_identifier,
+ const WebString& data_dir) {
+ idb_factory_backend_->GetDatabaseNames(
+ IndexedDBCallbacksWrapper::Create(callbacks),
+ database_identifier,
+ data_dir);
+}
+
+void WebIDBFactoryImpl::open(const WebString& name,
+ long long version,
+ long long transaction_id,
+ WebIDBCallbacks* callbacks,
+ WebIDBDatabaseCallbacks* database_callbacks,
+ const WebString& database_identifier,
+ const WebString& data_dir) {
+ scoped_refptr<IndexedDBCallbacksWrapper> callbacks_proxy =
+ IndexedDBCallbacksWrapper::Create(callbacks);
+ scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks_proxy =
+ IndexedDBDatabaseCallbacksWrapper::Create(database_callbacks);
+
+ callbacks_proxy->SetDatabaseCallbacks(database_callbacks_proxy);
+ idb_factory_backend_->Open(name,
+ version,
+ transaction_id,
+ callbacks_proxy.get(),
+ database_callbacks_proxy.get(),
+ database_identifier,
+ data_dir);
+}
+
+void WebIDBFactoryImpl::deleteDatabase(const WebString& name,
+ WebIDBCallbacks* callbacks,
+ const WebString& database_identifier,
+ const WebString& data_dir) {
+ idb_factory_backend_->DeleteDatabase(
+ name,
+ IndexedDBCallbacksWrapper::Create(callbacks),
+ database_identifier,
+ data_dir);
+}
+
+} // namespace WebKit