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

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

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: Moved transaction creation to SendObservations 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..7236d6392dcb6775f7597d586cee99fe5265d99d 100644
--- a/content/browser/indexed_db/indexed_db_transaction.cc
+++ b/content/browser/indexed_db/indexed_db_transaction.cc
@@ -227,6 +227,13 @@ void IndexedDBTransaction::Start() {
RunTasksIfStarted();
}
+void IndexedDBTransaction::GrabSnapshotThenStart() {
+ DCHECK(!backing_store_transaction_begun_);
+ transaction_->Begin();
+ backing_store_transaction_begun_ = true;
+ Start();
+}
+
class BlobWriteCallbackImpl : public IndexedDBBackingStore::BlobWriteCallback {
public:
explicit BlobWriteCallbackImpl(
@@ -364,10 +371,8 @@ leveldb::Status IndexedDBTransaction::CommitPhaseTwo() {
"txn.id", id());
callbacks_->OnComplete(*this);
}
- if (!pending_observers_.empty() && connection_) {
+ if (!pending_observers_.empty() && connection_)
connection_->ActivatePendingObservers(std::move(pending_observers_));
- pending_observers_.clear();
- }
database_->TransactionFinished(this, true);
// RemoveTransaction will delete |this|.
@@ -482,6 +487,7 @@ void IndexedDBTransaction::CloseOpenCursors() {
void IndexedDBTransaction::AddPendingObserver(
int32_t observer_id,
const IndexedDBObserver::Options& options) {
+ CHECK_NE(mode(), blink::WebIDBTransactionModeVersionChange);
jsbell 2017/01/13 00:14:12 It seems like DCHECK_NE would be fine here?
dmurph 2017/01/13 01:50:43 Sure.
pending_observers_.push_back(base::MakeUnique<IndexedDBObserver>(
observer_id, object_store_ids_, options));
}
@@ -510,13 +516,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*
+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