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

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

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unobserve functionality 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/indexed_db_dispatcher.cc
diff --git a/content/child/indexed_db/indexed_db_dispatcher.cc b/content/child/indexed_db/indexed_db_dispatcher.cc
index 242e6066df968baaf59265c24f4037a087255bb1..ac558066c80a89fd8ae35a88310279e8ee14e278 100644
--- a/content/child/indexed_db/indexed_db_dispatcher.cc
+++ b/content/child/indexed_db/indexed_db_dispatcher.cc
@@ -168,20 +168,29 @@ bool IndexedDBDispatcher::Send(IPC::Message* msg) {
return thread_safe_sender_->Send(msg);
}
-void IndexedDBDispatcher::AddIDBObserver(int32_t ipc_database_id,
- int64_t transaction_id,
- blink::IDBObserver* observer) {
- int64_t observer_id = maxObserverId++;
- observers_[observer_id] = observer;
- // params.ipc_thread_id = CurrentWorkerId();
- // params.ipc_database_id = ipc_database_id;
- // params.transaction_id = transaction_id;
- // params.observer_id = observer_id;
+int32_t IndexedDBDispatcher::AddIDBObserver(int32_t ipc_database_id,
+ int64_t transaction_id,
+ blink::IDBObserver* observer) {
+ // TODO(palakj): generate id through IDMap here.
+ int32_t observer_id = 0;
Send(new IndexedDBHostMsg_DatabaseObserve(
CurrentWorkerId(),
ipc_database_id,
transaction_id,
observer_id));
+ return observer_id;
+}
+
+std::vector<int32_t> IndexedDBDispatcher::RemoveIDBObserver(
+ int32_t ipc_database_id,
+ blink::IDBObserver* observer) {
+ std::vector<int32_t> remove_observers;
+ // TODO(palakj): iterate over map to find observer and collect id's in
+ // remove_observers
+
+ Send(new IndexedDBHostMsg_DatabaseUnobserve(
+ CurrentWorkerId(), ipc_database_id, remove_observers));
+ return remove_observers;
}
void IndexedDBDispatcher::RequestIDBCursorAdvance(

Powered by Google App Engine
This is Rietveld 408576698