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 ec660ed553744a272d86fad093ad3266463d028b..f984de81928359521f514913bb76f1bc51eba8d2 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 { |
@@ -60,13 +61,6 @@ void IDBDatabaseCallbacks::onVersionChange(int64_t oldVersion, int64_t newVersio |
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) |
@@ -79,4 +73,33 @@ 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 |