Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: content/browser/indexed_db/webidbdatabase_impl.cc

Issue 18221003: Convert WebIDBDatabaseImpl to IndexedDBConnection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/indexed_db/webidbdatabase_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/webidbdatabase_impl.cc
diff --git a/content/browser/indexed_db/webidbdatabase_impl.cc b/content/browser/indexed_db/webidbdatabase_impl.cc
deleted file mode 100644
index 04e6e858725c2f540d6c4e2213e1d9e76f51e123..0000000000000000000000000000000000000000
--- a/content/browser/indexed_db/webidbdatabase_impl.cc
+++ /dev/null
@@ -1,235 +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 "content/browser/indexed_db/webidbdatabase_impl.h"
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-#include "content/browser/indexed_db/indexed_db_callbacks.h"
-#include "content/browser/indexed_db/indexed_db_cursor.h"
-#include "content/browser/indexed_db/indexed_db_database_error.h"
-#include "content/browser/indexed_db/indexed_db_metadata.h"
-#include "content/common/indexed_db/indexed_db_key_range.h"
-
-namespace content {
-
-WebIDBDatabaseImpl::WebIDBDatabaseImpl(
- scoped_refptr<IndexedDBDatabase> database_backend,
- scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks)
- : database_backend_(database_backend),
- database_callbacks_(database_callbacks) {}
-
-WebIDBDatabaseImpl::~WebIDBDatabaseImpl() {}
-
-void WebIDBDatabaseImpl::createObjectStore(long long transaction_id,
- long long object_store_id,
- const string16& name,
- const IndexedDBKeyPath& key_path,
- bool auto_increment) {
- database_backend_->CreateObjectStore(transaction_id,
- object_store_id,
- name,
- IndexedDBKeyPath(key_path),
- auto_increment);
-}
-
-void WebIDBDatabaseImpl::deleteObjectStore(long long transaction_id,
- long long object_store_id) {
- database_backend_->DeleteObjectStore(transaction_id, object_store_id);
-}
-
-void WebIDBDatabaseImpl::createTransaction(
- long long id,
- const std::vector<int64>& object_store_ids,
- unsigned short mode) {
- if (!database_callbacks_.get())
- return;
- database_backend_->CreateTransaction(
- id, database_callbacks_.get(), object_store_ids, mode);
-}
-
-void WebIDBDatabaseImpl::close() {
- // Use the callbacks passed in to the constructor so that the backend in
- // multi-process chromium knows which database connection is closing.
- if (!database_callbacks_.get())
- return;
- database_backend_->Close(database_callbacks_);
- database_callbacks_ = NULL;
-}
-
-void WebIDBDatabaseImpl::forceClose() {
- if (!database_callbacks_.get())
- return;
- database_backend_->Close(database_callbacks_);
- database_callbacks_->OnForcedClose();
- database_callbacks_ = NULL;
-}
-
-void WebIDBDatabaseImpl::abort(long long transaction_id) {
- if (database_backend_.get())
- database_backend_->Abort(transaction_id);
-}
-
-void WebIDBDatabaseImpl::abort(long long transaction_id,
- const IndexedDBDatabaseError& error) {
- if (database_backend_.get())
- database_backend_->Abort(transaction_id, error);
-}
-
-void WebIDBDatabaseImpl::commit(long long transaction_id) {
- if (database_backend_.get())
- database_backend_->Commit(transaction_id);
-}
-
-void WebIDBDatabaseImpl::openCursor(
- long long transaction_id,
- long long object_store_id,
- long long index_id,
- const IndexedDBKeyRange& key_range,
- unsigned short direction,
- bool key_only,
- WebKit::WebIDBDatabase::TaskType task_type,
- scoped_refptr<IndexedDBCallbacks> callbacks) {
- if (database_backend_.get())
- database_backend_->OpenCursor(
- transaction_id,
- object_store_id,
- index_id,
- make_scoped_ptr(new IndexedDBKeyRange(key_range)),
- static_cast<indexed_db::CursorDirection>(direction),
- key_only,
- static_cast<IndexedDBDatabase::TaskType>(task_type),
- callbacks);
-}
-
-void WebIDBDatabaseImpl::count(long long transaction_id,
- long long object_store_id,
- long long index_id,
- const IndexedDBKeyRange& key_range,
- scoped_refptr<IndexedDBCallbacks> callbacks) {
- if (database_backend_.get())
- database_backend_->Count(transaction_id,
- object_store_id,
- index_id,
- make_scoped_ptr(new IndexedDBKeyRange(key_range)),
- callbacks);
-}
-
-void WebIDBDatabaseImpl::get(long long transaction_id,
- long long object_store_id,
- long long index_id,
- const IndexedDBKeyRange& key_range,
- bool key_only,
- scoped_refptr<IndexedDBCallbacks> callbacks) {
- if (database_backend_.get())
- database_backend_->Get(transaction_id,
- object_store_id,
- index_id,
- make_scoped_ptr(new IndexedDBKeyRange(key_range)),
- key_only,
- callbacks);
-}
-
-void WebIDBDatabaseImpl::put(long long transaction_id,
- long long object_store_id,
- std::vector<char>* value,
- const IndexedDBKey& key,
- WebKit::WebIDBDatabase::PutMode put_mode,
- scoped_refptr<IndexedDBCallbacks> callbacks,
- const std::vector<int64>& index_ids,
- const std::vector<IndexKeys>& index_keys) {
- if (!database_backend_.get())
- return;
-
- DCHECK_EQ(index_ids.size(), index_keys.size());
-
- database_backend_->Put(transaction_id,
- object_store_id,
- value,
- make_scoped_ptr(new IndexedDBKey(key)),
- static_cast<IndexedDBDatabase::PutMode>(put_mode),
- callbacks,
- index_ids,
- index_keys);
-}
-
-void WebIDBDatabaseImpl::setIndexKeys(
- long long transaction_id,
- long long object_store_id,
- const IndexedDBKey& primary_key,
- const std::vector<int64>& index_ids,
- const std::vector<IndexKeys>& index_keys) {
- if (!database_backend_.get())
- return;
-
- DCHECK_EQ(index_ids.size(), index_keys.size());
- database_backend_->SetIndexKeys(
- transaction_id,
- object_store_id,
- make_scoped_ptr(new IndexedDBKey(primary_key)),
- index_ids,
- index_keys);
-}
-
-void WebIDBDatabaseImpl::setIndexesReady(
- long long transaction_id,
- long long object_store_id,
- const std::vector<int64>& web_index_ids) {
- if (!database_backend_.get())
- return;
-
- std::vector<int64> index_ids(web_index_ids.size());
- for (size_t i = 0; i < web_index_ids.size(); ++i)
- index_ids[i] = web_index_ids[i];
- database_backend_->SetIndexesReady(
- transaction_id, object_store_id, index_ids);
-}
-
-void WebIDBDatabaseImpl::deleteRange(
- long long transaction_id,
- long long object_store_id,
- const IndexedDBKeyRange& key_range,
- scoped_refptr<IndexedDBCallbacks> callbacks) {
- if (database_backend_.get())
- database_backend_->DeleteRange(
- transaction_id,
- object_store_id,
- make_scoped_ptr(new IndexedDBKeyRange(key_range)),
- callbacks);
-}
-
-void WebIDBDatabaseImpl::clear(long long transaction_id,
- long long object_store_id,
- scoped_refptr<IndexedDBCallbacks> callbacks) {
- if (database_backend_.get())
- database_backend_->Clear(transaction_id, object_store_id, callbacks);
-}
-
-void WebIDBDatabaseImpl::createIndex(long long transaction_id,
- long long object_store_id,
- long long index_id,
- const string16& name,
- const IndexedDBKeyPath& key_path,
- bool unique,
- bool multi_entry) {
- if (database_backend_.get())
- database_backend_->CreateIndex(transaction_id,
- object_store_id,
- index_id,
- name,
- IndexedDBKeyPath(key_path),
- unique,
- multi_entry);
-}
-
-void WebIDBDatabaseImpl::deleteIndex(long long transaction_id,
- long long object_store_id,
- long long index_id) {
- if (database_backend_.get())
- database_backend_->DeleteIndex(transaction_id, object_store_id, index_id);
-}
-
-} // namespace WebKit
« no previous file with comments | « content/browser/indexed_db/webidbdatabase_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698