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

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

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some (incomplete) work on struct traits. Created 4 years, 5 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
Index: content/browser/indexed_db/indexed_db_connection.cc
diff --git a/content/browser/indexed_db/indexed_db_connection.cc b/content/browser/indexed_db/indexed_db_connection.cc
index c2c7ebd266df6df2f445818775ad260965660cbb..c19d395beadb1ab1c89733223d6498fd9eda6b68 100644
--- a/content/browser/indexed_db/indexed_db_connection.cc
+++ b/content/browser/indexed_db/indexed_db_connection.cc
@@ -7,41 +7,69 @@
#include "base/logging.h"
#include "base/stl_util.h"
+using ::indexed_db::mojom::BlobInfoPtr;
+using ::indexed_db::mojom::CursorDirection;
+using ::indexed_db::mojom::KeyPtr;
+using ::indexed_db::mojom::KeyRangePtr;
+using ::indexed_db::mojom::PutMode;
+using ::indexed_db::mojom::TaskType;
+using ::indexed_db::mojom::TransactionMode;
+
namespace content {
IndexedDBConnection::IndexedDBConnection(
scoped_refptr<IndexedDBDatabase> database,
scoped_refptr<IndexedDBDatabaseCallbacks> callbacks)
- : database_(database), callbacks_(callbacks), weak_factory_(this) {}
+ : database_(database),
+ callbacks_(callbacks),
+ binding_(this),
+ weak_factory_(this) {}
IndexedDBConnection::~IndexedDBConnection() {}
-void IndexedDBConnection::Close() {
+void IndexedDBConnection::ForceClose() {
if (!callbacks_.get())
return;
+
+ // IndexedDBDatabase::Close() can delete this instance.
base::WeakPtr<IndexedDBConnection> this_obj = weak_factory_.GetWeakPtr();
- database_->Close(this, false /* forced */);
+ scoped_refptr<IndexedDBDatabaseCallbacks> callbacks(callbacks_);
+ database_->Close(this, true /* forced */);
if (this_obj) {
database_ = nullptr;
callbacks_ = nullptr;
active_observers_.clear();
}
+ callbacks->OnForcedClose();
}
-void IndexedDBConnection::ForceClose() {
+bool IndexedDBConnection::IsConnected() {
+ return database_.get() != NULL;
+}
+
+void IndexedDBConnection::CreateObjectStore(int64_t transaction_id,
+ int64_t object_store_id,
+ const mojo::String& name,
+ const IndexedDBKeyPath& key_path,
+ bool auto_increment) {}
+
+void IndexedDBConnection::DeleteObjectStore(int64_t transaction_id,
+ int64_t object_store_id) {}
+
+void IndexedDBConnection::CreateTransaction(int64_t id,
+ mojo::Array<int64_t> scope,
+ TransactionMode transaction_mode) {}
+
+void IndexedDBConnection::Close() {
if (!callbacks_.get())
return;
-
- // IndexedDBDatabase::Close() can delete this instance.
base::WeakPtr<IndexedDBConnection> this_obj = weak_factory_.GetWeakPtr();
- scoped_refptr<IndexedDBDatabaseCallbacks> callbacks(callbacks_);
- database_->Close(this, true /* forced */);
+ database_->Close(this, false /* forced */);
if (this_obj) {
database_ = nullptr;
callbacks_ = nullptr;
active_observers_.clear();
}
- callbacks->OnForcedClose();
}
void IndexedDBConnection::VersionChangeIgnored() {
@@ -50,8 +78,114 @@ void IndexedDBConnection::VersionChangeIgnored() {
database_->VersionChangeIgnored();
}
-bool IndexedDBConnection::IsConnected() {
- return database_.get() != NULL;
+void IndexedDBConnection::Abort(int64_t transaction_id) {}
+
+void IndexedDBConnection::Commit(int64_t transaction_id) {}
+
+void IndexedDBConnection::CreateIndex(int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ const mojo::String& name,
+ const IndexedDBKeyPath& key_path,
+ bool unique,
+ bool multi_entry) {}
+
+void IndexedDBConnection::DeleteIndex(int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id) {}
+
+void IndexedDBConnection::Get(int64_t database_id,
+ int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ KeyRangePtr key_range,
+ bool key_only,
+ const GetCallback& callback) {
+ if (!IsConnected())
+ return;
+
+#if 0
+ connection->database()->Get(
+ HostTransactionId(transaction_id), object_store_id,
+ index_id,
+ base::WrapUnique(new IndexedDBKeyRange(key_range)),
+ params.key_only, callbacks);
+#endif
+#if 0
+ DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread());
+ IndexedDBConnection* connection =
+ parent_->GetOrTerminateProcess(&map_, params.ipc_database_id);
+ if (!connection || !connection->IsConnected())
+ return;
+
+ scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks(
+ parent_, params.ipc_thread_id, params.ipc_callbacks_id));
+ connection->database()->Get(
+ parent_->HostTransactionId(params.transaction_id), params.object_store_id,
+ params.index_id,
+ base::WrapUnique(new IndexedDBKeyRange(params.key_range)),
+ params.key_only, callbacks);
+#endif
+
+ ::indexed_db::mojom::GetResultPtr result =
+ ::indexed_db::mojom::GetResult::New();
+ result->type = ::indexed_db::mojom::ResultType::Error;
+ callback.Run(std::move(result));
+}
+
+void IndexedDBConnection::GetAll(int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ KeyRangePtr key_range,
+ int64_t max_count,
+ bool key_only) {}
+
+void IndexedDBConnection::Put(int64_t transaction_id,
+ int64_t object_store_id,
+ mojo::Array<int8_t> value,
+ mojo::Array<BlobInfoPtr> blob_info,
+ KeyPtr key,
+ PutMode put_mode,
+ mojo::Array<int64_t> index_ids,
+ mojo::Array<mojo::Array<KeyPtr>> index_keys) {}
+
+void IndexedDBConnection::DeleteRange(int64_t transaction_id,
+ int64_t object_store_id,
+ KeyRangePtr key_range) {}
+
+void IndexedDBConnection::Clear(int64_t transaction_id,
+ int64_t object_store_id) {}
+
+void IndexedDBConnection::SetIndexKeys(
+ int64_t transaction_id,
+ int64_t object_store_id,
+ KeyPtr primary_key,
+ mojo::Array<int64_t> index_ids,
+ mojo::Array<mojo::Array<KeyPtr>> index_keys) {}
+
+void IndexedDBConnection::SetIndexesReady(int64_t transaction_id,
+ int64_t object_store_id,
+ mojo::Array<int64_t> index_ids) {}
+
+void IndexedDBConnection::OpenCursor(int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ KeyRangePtr key_range,
+ CursorDirection direction,
+ bool key_only,
+ TaskType task_type) {}
+
+void IndexedDBConnection::Count(int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ KeyRangePtr key_range) {}
+
+void IndexedDBConnection::AckReceivedBlobs(mojo::Array<mojo::String> uuids) {}
+
+::indexed_db::mojom::DatabasePtr IndexedDBConnection::CreateInterface() {
+ ::indexed_db::mojom::DatabasePtr interface;
+ binding_.Bind(&interface);
+ return interface;
}
// The observers begin listening to changes only once they are activated.

Powered by Google App Engine
This is Rietveld 408576698