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

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

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: Transactions working Created 3 years, 11 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 4c43f9953238e3cb1ab028edfe08ed49cad9afd0..7fa24567ae611fb9e3d7916613f161016ef2ba00 100644
--- a/content/browser/indexed_db/indexed_db_transaction.cc
+++ b/content/browser/indexed_db/indexed_db_transaction.cc
@@ -365,6 +365,16 @@ leveldb::Status IndexedDBTransaction::CommitPhaseTwo() {
callbacks_->OnComplete(*this);
}
if (!pending_observers_.empty() && connection_) {
+ // Observers observe all stores for a version change transaction.
+ if (mode_ == blink::WebIDBTransactionModeVersionChange) {
+ std::set<int64_t> object_stores;
cmumford 2017/01/09 21:31:25 object_store_ids
dmurph 2017/01/10 00:17:39 removed.
+ for (const auto& store_metadata : database_->metadata().object_stores) {
+ object_stores.insert(store_metadata.first);
+ }
+ for (auto& pending_observer : pending_observers_) {
+ pending_observer->set_object_store_ids(std::move(object_stores));
cmumford 2017/01/09 21:31:26 Won't this only set the first pending observer's s
dmurph 2017/01/10 00:17:39 Removed this feature as per https://github.com/WIC
+ }
+ }
connection_->ActivatePendingObservers(std::move(pending_observers_));
pending_observers_.clear();
}
@@ -510,13 +520,12 @@ void IndexedDBTransaction::AddObservation(
it->second->observations.push_back(std::move(observation));
}
-void IndexedDBTransaction::RecordObserverForLastObservation(
- int32_t connection_id,
- int32_t observer_id) {
+::indexed_db::mojom::ObserverChangesPtr*
cmumford 2017/01/09 21:31:26 function should be const, *and* return a const Obs
dmurph 2017/01/10 00:17:39 Neither can be const, as I need to modify the retu
+IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) {
auto it = connection_changes_map_.find(connection_id);
- DCHECK(it != connection_changes_map_.end());
- it->second->observation_index_map[observer_id].push_back(
- it->second->observations.size() - 1);
+ if (it != connection_changes_map_.end())
+ return &it->second;
+ return nullptr;
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698