Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_database.cc |
| diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc |
| index 97f47a04d14cd726d5f86b16f2b6c7a9502a7995..6cabd70b3a8fd2b4c97a70a231e808fa99b0ddab 100644 |
| --- a/content/browser/indexed_db/indexed_db_database.cc |
| +++ b/content/browser/indexed_db/indexed_db_database.cc |
| @@ -541,6 +541,27 @@ void IndexedDBDatabase::Abort(int64_t transaction_id, |
| transaction->Abort(error); |
| } |
| +void IndexedDBDatabase::AddPendingObserver(int64_t transaction_id, |
| + int64_t observer_id) { |
| + IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| + if (!transaction) |
| + return; |
| + transaction->AddPendingObserver(observer_id); |
| +} |
| + |
| +void IndexedDBDatabase::RemovePendingObservers( |
| + IndexedDBConnection* connection, |
| + const std::vector<int32_t>& pending_observer_ids) { |
| + // TODO(palakj): Better Implementation needed. |
|
dmurph
2016/06/23 21:53:04
Remove this todo. This is fine.
palakj1
2016/06/24 00:03:00
Done
|
| + TransactionMap::iterator it; |
| + for (it = transactions_.begin(); it != transactions_.end(); it++) { |
| + // Avoid call to RemovePendingObservers for transactions on other |
| + // connections. |
| + if (it->second->getConnection() == connection) |
| + it->second->RemovePendingObservers(pending_observer_ids); |
| + } |
| +} |
| + |
| void IndexedDBDatabase::GetAll(int64_t transaction_id, |
| int64_t object_store_id, |
| int64_t index_id, |
| @@ -1665,7 +1686,7 @@ void IndexedDBDatabase::CreateTransaction( |
| // The transaction will add itself to this database's coordinator, which |
| // manages the lifetime of the object. |
| TransactionCreated(IndexedDBClassFactory::Get()->CreateIndexedDBTransaction( |
| - transaction_id, connection->callbacks(), |
| + transaction_id, connection->weakPtr(), connection->callbacks(), |
| std::set<int64_t>(object_store_ids.begin(), object_store_ids.end()), mode, |
| this, new IndexedDBBackingStore::Transaction(backing_store_.get()))); |
| } |