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 a7f17b6178c24bf5c0675393ed399c392177d648..e9c251b2f7568aff43758dd8d926acd21d591e50 100644 |
| --- a/content/browser/indexed_db/indexed_db_transaction.cc |
| +++ b/content/browser/indexed_db/indexed_db_transaction.cc |
| @@ -14,6 +14,7 @@ |
| #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_observer.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" |
| @@ -55,6 +56,7 @@ IndexedDBTransaction::Operation IndexedDBTransaction::TaskStack::pop() { |
| IndexedDBTransaction::IndexedDBTransaction( |
| int64_t id, |
| + IndexedDBConnection* connection, |
| scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, |
| const std::set<int64_t>& object_store_ids, |
| blink::WebIDBTransactionMode mode, |
| @@ -66,6 +68,7 @@ IndexedDBTransaction::IndexedDBTransaction( |
| used_(false), |
| state_(CREATED), |
| commit_pending_(false), |
| + connection_(connection), |
| callbacks_(callbacks), |
| database_(database), |
| transaction_(backing_store_transaction), |
| @@ -180,6 +183,7 @@ void IndexedDBTransaction::Abort(const IndexedDBDatabaseError& error) { |
| database_->TransactionFinished(this, false); |
| database_ = NULL; |
| + connection_ = nullptr; |
| } |
| bool IndexedDBTransaction::IsTaskQueueEmpty() const { |
| @@ -314,6 +318,9 @@ leveldb::Status IndexedDBTransaction::CommitPhaseTwo() { |
| database_->transaction_coordinator().DidFinishTransaction(this); |
| if (committed) { |
| + // TODO (palakj) : Send Observations to observers |
| + if (!pending_observers_.empty()) |
| + ActivatePendingObserver(); |
| abort_task_stack_.clear(); |
| { |
| IDB_TRACE1( |
| @@ -420,4 +427,16 @@ void IndexedDBTransaction::CloseOpenCursors() { |
| open_cursors_.clear(); |
| } |
| +void IndexedDBTransaction::AddPendingObserver( |
| + std::unique_ptr<IndexedDBObserver> observer) { |
| + pending_observers_.push_back(std::move(observer)); |
| +} |
| + |
| +void IndexedDBTransaction::ActivatePendingObserver() { |
| + for (uint32_t i = 0; i < pending_observers_.size(); i++) { |
| + connection_->active_observers_.push_back(std::move(pending_observers_[i])); |
|
dmurph
2016/06/22 01:09:49
Maybe make this a method, so we're not calling int
|
| + ; |
|
dmurph
2016/06/22 01:09:49
remove extra semicolon
palakj1
2016/06/23 20:56:30
Done
|
| + } |
| +} |
| + |
| } // namespace content |