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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h

Issue 2320213004: Port IndexedDB open() and database callbacks to Mojo. (Closed)
Patch Set: Make DatabaseClient an associated interface. Created 4 years, 3 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: third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h
index 57ac964577ab29916c8e9e5e6d3c04b0c559dddb..705c26ac8aaf4ef6849c6e8db218fcb1bf7069d6 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h
@@ -34,15 +34,16 @@
#include "modules/EventModules.h"
#include "modules/EventTargetModules.h"
#include "modules/ModulesExport.h"
-#include "modules/indexeddb/IDBDatabaseCallbacks.h"
#include "modules/indexeddb/IDBHistograms.h"
#include "modules/indexeddb/IDBMetadata.h"
#include "modules/indexeddb/IDBObjectStore.h"
#include "modules/indexeddb/IDBObjectStoreParameters.h"
#include "modules/indexeddb/IDBTransaction.h"
#include "modules/indexeddb/IndexedDB.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
#include "platform/heap/Handle.h"
#include "public/platform/modules/indexeddb/WebIDBDatabase.h"
+#include "public/platform/modules/indexeddb/indexed_db.mojom-blink.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
#include <memory>
@@ -56,14 +57,19 @@ class ExecutionContext;
class MODULES_EXPORT IDBDatabase final
: public EventTargetWithInlineData
, public ActiveScriptWrappable
- , public ActiveDOMObject {
+ , public ActiveDOMObject
+ , public indexed_db::mojom::blink::DatabaseClient {
USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase);
DEFINE_WRAPPERTYPEINFO();
+ USING_PRE_FINALIZER(IDBDatabase, dispose);
+
public:
- static IDBDatabase* create(ExecutionContext*, std::unique_ptr<WebIDBDatabase>, IDBDatabaseCallbacks*);
+ static IDBDatabase* create(ExecutionContext*, std::unique_ptr<WebIDBDatabase>, indexed_db::mojom::blink::DatabaseClientAssociatedRequest);
~IDBDatabase() override;
DECLARE_VIRTUAL_TRACE();
+ void dispose();
+
void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadata; }
void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&);
void indexDeleted(int64_t objectStoreId, int64_t indexId);
@@ -86,10 +92,11 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
DEFINE_ATTRIBUTE_EVENT_LISTENER(versionchange);
- // IDBDatabaseCallbacks
- void onVersionChange(int64_t oldVersion, int64_t newVersion);
- void onAbort(int64_t, DOMException*);
- void onComplete(int64_t);
+ // indexed_db::mojom::blink::DatabaseClient
+ void OnTransactionAborted(int64_t transactionId, indexed_db::mojom::blink::ErrorInfoPtr) override;
+ void OnTransactionCompleted(int64_t transactionId) override;
+ void OnForcedClosed() override;
+ void OnVersionChange(int64_t oldVersion, int64_t newVersion) override;
// ScriptWrappable
bool hasPendingActivity() const final;
@@ -140,7 +147,7 @@ protected:
DispatchEventResult dispatchEventInternal(Event*) override;
private:
- IDBDatabase(ExecutionContext*, std::unique_ptr<WebIDBDatabase>, IDBDatabaseCallbacks*);
+ IDBDatabase(ExecutionContext*, std::unique_ptr<WebIDBDatabase>, indexed_db::mojom::blink::DatabaseClientAssociatedRequest);
IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, ExceptionState&);
void closeConnection();
@@ -157,7 +164,7 @@ private:
// database so that we can cancel them if the database closes.
HeapVector<Member<Event>> m_enqueuedEvents;
- Member<IDBDatabaseCallbacks> m_databaseCallbacks;
+ mojo::AssociatedBinding<indexed_db::mojom::blink::DatabaseClient> m_clientBinding;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/DEPS ('k') | third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698