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

Unified Diff: content/browser/indexed_db/indexed_db_dispatcher_host.cc

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Observer moved to connection 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/browser/indexed_db/indexed_db_dispatcher_host.cc
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
index 96cad054d68c0110179e1aeb1e3a8c516ae73e60..07d63247e4e95aaa7e402c976ce29093d9cf9ef0 100644
--- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc
+++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
@@ -520,6 +520,7 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived(
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseVersionChangeIgnored,
OnVersionChangeIgnored)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed)
+ IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseObserve, OnObserve)
dmurph 2016/06/22 01:09:49 Also add OnUnobserve
palakj1 2016/06/23 20:56:29 Oops! added.
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGet, OnGet)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGetAll, OnGetAll)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabasePut, OnPutWrapper)
@@ -629,6 +630,30 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed(
parent_->DestroyObject(&map_, ipc_object_id);
}
+void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnObserve(
+ int32_t ipc_database_id,
+ int64_t transaction_id,
+ int32_t observer_id) {
+ DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread());
+ IndexedDBConnection* connection =
+ parent_->GetOrTerminateProcess(&map_, ipc_database_id);
+ if (!connection || !connection->IsConnected())
+ return;
+ connection->database()->Observe(parent_->HostTransactionId(transaction_id),
+ observer_id);
+}
+
+void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnUnobserve(
+ int32_t ipc_database_id,
+ std::vector<int32_t> observersToRemove) {
+ DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread());
+ IndexedDBConnection* connection =
+ parent_->GetOrTerminateProcess(&map_, ipc_database_id);
+ if (!connection || !connection->IsConnected())
+ return;
+ connection->Unobserve(observersToRemove);
+}
+
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGet(
const IndexedDBHostMsg_DatabaseGet_Params& params) {
DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread());

Powered by Google App Engine
This is Rietveld 408576698