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

Unified Diff: content/child/indexed_db/webidbdatabase_impl.cc

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Post dmurph review Created 4 years, 6 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/child/indexed_db/webidbdatabase_impl.cc
diff --git a/content/child/indexed_db/webidbdatabase_impl.cc b/content/child/indexed_db/webidbdatabase_impl.cc
index fedb0e7333974ecdce6127249739b0b4ea4ccdae..c9e7414677b4a3407ca7c2ca89d2695e212f6adb 100644
--- a/content/child/indexed_db/webidbdatabase_impl.cc
+++ b/content/child/indexed_db/webidbdatabase_impl.cc
@@ -19,7 +19,9 @@
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBKeyPath.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBMetadata.h"
+// #include "third_party/WebKit/Source/modules/indexeddb/IDBObserver.h"
+using blink::IDBObserver;
using blink::WebBlobInfo;
using blink::WebIDBCallbacks;
using blink::WebIDBCursor;
@@ -100,6 +102,23 @@ void WebIDBDatabaseImpl::versionChangeIgnored() {
dispatcher->NotifyIDBDatabaseVersionChangeIgnored(ipc_database_id_);
}
+void WebIDBDatabaseImpl::observe(blink::IDBObserver* observer,
+ long long transaction_id) {
+ IndexedDBDispatcher* dispatcher =
+ IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
+ int32_t observer_id =
+ dispatcher->AddIDBObserver(ipc_database_id_, transaction_id, observer);
+ observers_id_.push_back(observer_id);
+}
+
+void WebIDBDatabaseImpl::unobserve(blink::IDBObserver* observer) {
+ IndexedDBDispatcher* dispatcher =
+ IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
+ std::vector<int32_t> remove_observers =
+ dispatcher->RemoveIDBObserver(ipc_database_id_, observer);
+ // TODO(palakj): Remove id from observes_id_
+}
+
void WebIDBDatabaseImpl::get(long long transaction_id,
long long object_store_id,
long long index_id,

Powered by Google App Engine
This is Rietveld 408576698