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

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

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.h
diff --git a/content/browser/indexed_db/indexed_db_connection.h b/content/browser/indexed_db/indexed_db_connection.h
index 3c305f39d057147c8a8feb12654a0f826404b09a..82c8c18dc86b86d18d93afdedf0c3f597717366d 100644
--- a/content/browser/indexed_db/indexed_db_connection.h
+++ b/content/browser/indexed_db/indexed_db_connection.h
@@ -11,23 +11,23 @@
#include "content/browser/indexed_db/indexed_db_database.h"
#include "content/browser/indexed_db/indexed_db_database_callbacks.h"
#include "content/browser/indexed_db/indexed_db_observer.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/WebKit/public/platform/modules/indexeddb/indexed_db.mojom.h"
namespace content {
class IndexedDBDatabaseError;
-class CONTENT_EXPORT IndexedDBConnection {
+class CONTENT_EXPORT IndexedDBConnection
+ : public ::indexed_db::mojom::Database {
public:
IndexedDBConnection(scoped_refptr<IndexedDBDatabase> db,
scoped_refptr<IndexedDBDatabaseCallbacks> callbacks);
- virtual ~IndexedDBConnection();
+ ~IndexedDBConnection() override;
// These methods are virtual to allow subclassing in unit tests.
virtual void ForceClose();
- virtual void Close();
virtual bool IsConnected();
- void VersionChangeIgnored();
-
virtual void ActivatePendingObservers(
std::vector<std::unique_ptr<IndexedDBObserver>> pending_observers);
// Removes observer listed in |remove_observer_ids| from active_observer of
@@ -45,6 +45,100 @@ class CONTENT_EXPORT IndexedDBConnection {
return weak_factory_.GetWeakPtr();
}
+ // ::indexed_db::mojom::Database:
+ void CreateObjectStore(int64_t transaction_id,
+ int64_t object_store_id,
+ const mojo::String& name,
+ const IndexedDBKeyPath& key_path,
+ bool auto_increment) override;
+
+ void DeleteObjectStore(int64_t transaction_id,
+ int64_t object_store_id) override;
+
+ void CreateTransaction(
+ int64_t id,
+ mojo::Array<int64_t> scope,
+ ::indexed_db::mojom::TransactionMode transaction_mode) override;
+
+ void Close() override;
+
+ void VersionChangeIgnored() override;
+
+ void Abort(int64_t transaction_id) override;
+
+ void Commit(int64_t transaction_id) override;
+
+ void 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) override;
+
+ void DeleteIndex(int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id) override;
+
+ void Get(int64_t database_id,
+ int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ ::indexed_db::mojom::KeyRangePtr key_range,
+ bool key_only,
+ const GetCallback& callback) override;
+
+ void GetAll(int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ ::indexed_db::mojom::KeyRangePtr key_range,
+ int64_t max_count,
+ bool key_only) override;
+
+ void Put(int64_t transaction_id,
+ int64_t object_store_id,
+ mojo::Array<int8_t> value,
+ mojo::Array<::indexed_db::mojom::BlobInfoPtr> blob_info,
+ ::indexed_db::mojom::KeyPtr key,
+ ::indexed_db::mojom::PutMode put_mode,
+ mojo::Array<int64_t> index_ids,
+ mojo::Array<mojo::Array<::indexed_db::mojom::KeyPtr>> index_keys)
+ override;
+
+ void DeleteRange(int64_t transaction_id,
+ int64_t object_store_id,
+ ::indexed_db::mojom::KeyRangePtr key_range) override;
+
+ void Clear(int64_t transaction_id, int64_t object_store_id) override;
+
+ void SetIndexKeys(int64_t transaction_id,
+ int64_t object_store_id,
+ ::indexed_db::mojom::KeyPtr primary_key,
+ mojo::Array<int64_t> index_ids,
+ mojo::Array<mojo::Array<::indexed_db::mojom::KeyPtr>>
+ index_keys) override;
+
+ void SetIndexesReady(int64_t transaction_id,
+ int64_t object_store_id,
+ mojo::Array<int64_t> index_ids) override;
+
+ void OpenCursor(int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ ::indexed_db::mojom::KeyRangePtr key_range,
+ ::indexed_db::mojom::CursorDirection direction,
+ bool key_only,
+ ::indexed_db::mojom::TaskType task_type) override;
+
+ void Count(int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ ::indexed_db::mojom::KeyRangePtr key_range) override;
+
+ void AckReceivedBlobs(mojo::Array<mojo::String> uuids) override;
+
+ ::indexed_db::mojom::DatabasePtr CreateInterface();
+
private:
// NULL in some unit tests, and after the connection is closed.
scoped_refptr<IndexedDBDatabase> database_;
@@ -53,6 +147,7 @@ class CONTENT_EXPORT IndexedDBConnection {
// May be NULL in unit tests.
scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_;
std::vector<std::unique_ptr<IndexedDBObserver>> active_observers_;
+ mojo::StrongBinding<::indexed_db::mojom::Database> binding_;
base::WeakPtrFactory<IndexedDBConnection> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection);

Powered by Google App Engine
This is Rietveld 408576698