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..7dda86fb206efd46d8f14160656f38c06410f94b 100644 |
| --- a/content/browser/indexed_db/indexed_db_database.cc |
| +++ b/content/browser/indexed_db/indexed_db_database.cc |
| @@ -29,6 +29,7 @@ |
| #include "content/browser/indexed_db/indexed_db_cursor.h" |
| #include "content/browser/indexed_db/indexed_db_factory.h" |
| #include "content/browser/indexed_db/indexed_db_index_writer.h" |
| +#include "content/browser/indexed_db/indexed_db_observer.h" |
| #include "content/browser/indexed_db/indexed_db_pending_connection.h" |
| #include "content/browser/indexed_db/indexed_db_return_value.h" |
| #include "content/browser/indexed_db/indexed_db_tracing.h" |
| @@ -541,6 +542,23 @@ void IndexedDBDatabase::Abort(int64_t transaction_id, |
| transaction->Abort(error); |
| } |
| +void IndexedDBDatabase::Observe(int64_t transaction_id, int64_t observer_id) { |
| + IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| + if (!transaction) |
| + return; |
| + transaction->AddPendingObserver(observer_id, |
| + new IndexedDBObserver(observer_id)); |
| +} |
| + |
| +void IndexedDBDatabase::Unobserve(std::vector<int64_t> observersToRemove) { |
| + // TODO (palakj): Remove observer from pending_observer queue of transactions |
| + typedef std::map<int64_t, IndexedDBObserver*>::iterator Iterator; |
| + for (uint32_t i = 0; i < observersToRemove.size(); i++) { |
| + Iterator obs = active_observers_.find(observersToRemove[i]); |
|
dmurph
2016/06/17 09:05:06
replace these with active_observers_.erase(observe
palakj1
2016/06/18 05:13:40
Done
|
| + active_observers_.erase(obs); |
| + } |
| +} |
| + |
| void IndexedDBDatabase::GetAll(int64_t transaction_id, |
| int64_t object_store_id, |
| int64_t index_id, |