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

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: 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/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 be044833f4016c04a9e2f57348ba05707d7b7fb4..67677a46d11097dcb0c458399aea2145a47e81b2 100644
--- a/content/browser/indexed_db/indexed_db_transaction.cc
+++ b/content/browser/indexed_db/indexed_db_transaction.cc
@@ -424,15 +424,14 @@ void IndexedDBTransaction::CloseOpenCursors() {
open_cursors_.clear();
}
-void IndexedDBTransaction::AddPendingObserver(
- std::unique_ptr<IndexedDBObserver> observer) {
- pending_observers_.push_back(std::move(observer));
+void IndexedDBTransaction::AddPendingObserver(int64_t observer_id,
+ IndexedDBObserver* observer) {
+ pending_observers_[observer_id] = observer;
}
void IndexedDBTransaction::ActivatePendingObserver() {
- for (size_t i = 0; i < pending_observers_.size(); i++) {
- database_->active_observers_.push_back(std::move(pending_observers_[i]));
- }
+ database_->active_observers_.insert(pending_observers_.begin(),
+ pending_observers_.end());
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698