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

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

Issue 2125213002: [IndexedDB] Propogating changes to observers : Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifetime
Patch Set: Post dmurph review Created 4 years, 5 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 5de620da9bdbddf97f98f36f3b4703c6f583b6e2..2a45ac4fd287af714ad85673bc6f3bbf156bbc2b 100644
--- a/content/browser/indexed_db/indexed_db_transaction.cc
+++ b/content/browser/indexed_db/indexed_db_transaction.cc
@@ -16,7 +16,9 @@
#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_observation.h"
#include "content/browser/indexed_db/indexed_db_observer.h"
+#include "content/browser/indexed_db/indexed_db_observer_changes.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"
@@ -346,9 +348,6 @@ leveldb::Status IndexedDBTransaction::CommitPhaseTwo() {
database_->transaction_coordinator().DidFinishTransaction(this);
if (committed) {
- // TODO (palakj) : Send Observations to observers
- if (!pending_observers_.empty() && connection_)
- connection_->ActivatePendingObservers(std::move(pending_observers_));
abort_task_stack_.clear();
{
IDB_TRACE1(
@@ -356,6 +355,9 @@ leveldb::Status IndexedDBTransaction::CommitPhaseTwo() {
"txn.id", id());
callbacks_->OnComplete(id_);
}
+ database_->SendObservations(std::move(connection_changes_map_));
Marijn Kruisselbrink 2016/07/08 23:57:57 I don't think the c++ standard technically guarant
palakj1 2016/07/11 05:33:26 Done. Should i be clearing every time I'm moving m
+ if (!pending_observers_.empty() && connection_)
+ connection_->ActivatePendingObservers(std::move(pending_observers_));
database_->TransactionFinished(this, true);
} else {
while (!abort_task_stack_.empty())
@@ -457,7 +459,7 @@ void IndexedDBTransaction::CloseOpenCursors() {
void IndexedDBTransaction::AddPendingObserver(int32_t observer_id) {
pending_observers_.push_back(
- base::WrapUnique(new IndexedDBObserver(observer_id)));
+ base::WrapUnique(new IndexedDBObserver(observer_id, object_store_ids_)));
}
void IndexedDBTransaction::RemovePendingObservers(
@@ -471,4 +473,18 @@ void IndexedDBTransaction::RemovePendingObservers(
pending_observers_.erase(it, pending_observers_.end());
}
+void IndexedDBTransaction::AddObservation(
+ int32_t connection_id,
+ std::unique_ptr<IndexedDBObservation> observation) {
+ connection_changes_map_[connection_id]->AddObservation(
+ std::move(observation));
+}
+
+void IndexedDBTransaction::RecordObserverForLastObservation(
+ int32_t observer_id,
+ int32_t connection_id) {
+ connection_changes_map_[connection_id]->RecordObserverForLastObservation(
+ observer_id);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698