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

Unified Diff: content/browser/indexed_db/indexed_db_transaction.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/browser/indexed_db/indexed_db_transaction.cc
diff --git a/content/browser/indexed_db/indexed_db_transaction.cc b/content/browser/indexed_db/indexed_db_transaction.cc
index a7f17b6178c24bf5c0675393ed399c392177d648..67677a46d11097dcb0c458399aea2145a47e81b2 100644
--- a/content/browser/indexed_db/indexed_db_transaction.cc
+++ b/content/browser/indexed_db/indexed_db_transaction.cc
@@ -14,6 +14,7 @@
#include "content/browser/indexed_db/indexed_db_cursor.h"
#include "content/browser/indexed_db/indexed_db_database.h"
#include "content/browser/indexed_db/indexed_db_database_callbacks.h"
+#include "content/browser/indexed_db/indexed_db_observer.h"
#include "content/browser/indexed_db/indexed_db_tracing.h"
#include "content/browser/indexed_db/indexed_db_transaction_coordinator.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseException.h"
@@ -314,6 +315,9 @@ leveldb::Status IndexedDBTransaction::CommitPhaseTwo() {
database_->transaction_coordinator().DidFinishTransaction(this);
if (committed) {
+ // TODO (palakj) : Send Observations to observers
+ if (!pending_observers_.empty())
+ ActivatePendingObserver();
abort_task_stack_.clear();
{
IDB_TRACE1(
@@ -420,4 +424,14 @@ void IndexedDBTransaction::CloseOpenCursors() {
open_cursors_.clear();
}
+void IndexedDBTransaction::AddPendingObserver(int64_t observer_id,
+ IndexedDBObserver* observer) {
+ pending_observers_[observer_id] = observer;
+}
+
+void IndexedDBTransaction::ActivatePendingObserver() {
+ database_->active_observers_.insert(pending_observers_.begin(),
+ pending_observers_.end());
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698