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

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

Issue 2511403003: Send IndexedDB observations through IDBDatabaseCallbacks. (Closed)
Patch Set: Remove unnecessary forward declaration. Created 4 years, 1 month 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/IDBObserver.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
index b8adb4a94c92f6afb9f49013da45065bb2e1673e..fed28f8d42f6484d9681430357ac369efb277fe2 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
@@ -16,7 +16,6 @@
#include "modules/indexeddb/IDBObserverChanges.h"
#include "modules/indexeddb/IDBObserverInit.h"
#include "modules/indexeddb/IDBTransaction.h"
-#include "modules/indexeddb/WebIDBObserverImpl.h"
namespace blink {
@@ -73,14 +72,10 @@ void IDBObserver::observe(IDBDatabase* database,
}
}
- std::unique_ptr<WebIDBObserverImpl> observer =
- WebIDBObserverImpl::create(this, options.transaction(), options.values(),
- options.noRecords(), types);
- WebIDBObserverImpl* observerPtr = observer.get();
int32_t observerId =
- database->backend()->addObserver(std::move(observer), transaction->id());
+ database->addObserver(this, transaction->id(), options.transaction(),
+ options.values(), options.noRecords(), types);
m_observerIds.add(observerId, database);
- observerPtr->setId(observerId);
}
void IDBObserver::unobserve(IDBDatabase* database,
@@ -99,20 +94,7 @@ void IDBObserver::unobserve(IDBDatabase* database,
m_observerIds.removeAll(observerIdsToRemove);
if (!observerIdsToRemove.isEmpty())
- database->backend()->removeObservers(observerIdsToRemove);
-}
-
-void IDBObserver::removeObserver(int32_t id) {
- m_observerIds.remove(id);
-}
-
-void IDBObserver::onChange(int32_t id,
- const WebVector<WebIDBObservation>& observations,
- const WebVector<int32_t>& observationIndex) {
- auto it = m_observerIds.find(id);
- DCHECK(it != m_observerIds.end());
- m_callback->call(this, IDBObserverChanges::create(it->value, observations,
- observationIndex));
+ database->removeObservers(observerIdsToRemove);
}
DEFINE_TRACE(IDBObserver) {

Powered by Google App Engine
This is Rietveld 408576698