Chromium Code Reviews| 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 |