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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBDatabaseCallbacks.cpp

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Address last nits and fix leaks in unit tests. Created 4 years, 2 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/IDBDatabaseCallbacks.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabaseCallbacks.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBDatabaseCallbacks.cpp
index 972ec46b04f2dbebf2cff144c3b75967519d6136..4883a8630f424312a63b95c3fa5fb21499ecb4cd 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabaseCallbacks.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabaseCallbacks.cpp
@@ -26,6 +26,7 @@
#include "modules/indexeddb/IDBDatabaseCallbacks.h"
#include "modules/indexeddb/IDBDatabase.h"
+#include "modules/indexeddb/WebIDBDatabaseCallbacksImpl.h"
namespace blink {
@@ -52,12 +53,6 @@ void IDBDatabaseCallbacks::onVersionChange(int64_t oldVersion,
m_database->onVersionChange(oldVersion, newVersion);
}
-void IDBDatabaseCallbacks::connect(IDBDatabase* database) {
- ASSERT(!m_database);
- ASSERT(database);
- m_database = database;
-}
-
void IDBDatabaseCallbacks::onAbort(int64_t transactionId, DOMException* error) {
if (m_database)
m_database->onAbort(transactionId, error);
@@ -68,4 +63,31 @@ void IDBDatabaseCallbacks::onComplete(int64_t transactionId) {
m_database->onComplete(transactionId);
}
+void IDBDatabaseCallbacks::connect(IDBDatabase* database) {
+ DCHECK(!m_database);
+ DCHECK(database);
+ m_database = database;
+}
+
+std::unique_ptr<WebIDBDatabaseCallbacks>
+IDBDatabaseCallbacks::createWebCallbacks() {
+ DCHECK(!m_webCallbacks);
+ std::unique_ptr<WebIDBDatabaseCallbacks> callbacks =
+ WebIDBDatabaseCallbacksImpl::create(this);
+ m_webCallbacks = callbacks.get();
+ return callbacks;
+}
+
+void IDBDatabaseCallbacks::detachWebCallbacks() {
+ if (m_webCallbacks) {
+ m_webCallbacks->detach();
+ m_webCallbacks = nullptr;
+ }
+}
+
+void IDBDatabaseCallbacks::webCallbacksDestroyed() {
+ DCHECK(m_webCallbacks);
+ m_webCallbacks = nullptr;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698