Chromium Code Reviews| Index: content/child/indexed_db/indexed_db_dispatcher.cc |
| diff --git a/content/child/indexed_db/indexed_db_dispatcher.cc b/content/child/indexed_db/indexed_db_dispatcher.cc |
| index aa40cca350f2e8548188b939f202ec53a261f290..47e82099cae5ab3a835a15f17f03af79f46ce8a1 100644 |
| --- a/content/child/indexed_db/indexed_db_dispatcher.cc |
| +++ b/content/child/indexed_db/indexed_db_dispatcher.cc |
| @@ -30,6 +30,7 @@ using blink::WebIDBDatabaseCallbacks; |
| using blink::WebIDBDatabaseError; |
| using blink::WebIDBKey; |
| using blink::WebIDBMetadata; |
| +using blink::WebIDBObserver; |
| using blink::WebIDBValue; |
| using blink::WebString; |
| using blink::WebVector; |
| @@ -167,6 +168,39 @@ bool IndexedDBDispatcher::Send(IPC::Message* msg) { |
| return thread_safe_sender_->Send(msg); |
| } |
| +int32_t IndexedDBDispatcher::AddIDBObserver( |
| + int32_t ipc_database_id, |
| + int64_t transaction_id, |
| + std::unique_ptr<WebIDBObserver> observer) { |
| + int32_t observer_id = observers_.Add(observer.release()); |
| + Send(new IndexedDBHostMsg_DatabaseObserve(ipc_database_id, transaction_id, |
| + observer_id)); |
| + return observer_id; |
| +} |
| + |
| +std::vector<int32_t> IndexedDBDispatcher::RemoveIDBObserversFromDatabase( |
| + int32_t ipc_database_id, |
| + std::unique_ptr<WebIDBObserver> observer, |
| + const std::vector<int32_t>& database_observer_ids) { |
| + std::vector<int32_t> observer_ids_to_remove; |
| + for (uint32_t i = 0; i < database_observer_ids.size(); i++) { |
| + if (observers_.Lookup(database_observer_ids[i]) == observer.get()) { |
|
Marijn Kruisselbrink
2016/06/24 00:48:09
I'm confused about this check. observers_ owns Web
|
| + observers_.Remove(database_observer_ids[i]); |
| + observer_ids_to_remove.push_back(database_observer_ids[i]); |
| + } |
| + } |
| + Send(new IndexedDBHostMsg_DatabaseUnobserve(ipc_database_id, |
| + observer_ids_to_remove)); |
| + return observer_ids_to_remove; |
| +} |
| + |
| +void IndexedDBDispatcher::RemoveIDBObservers( |
| + const std::vector<int32_t>& observer_ids_to_remove) { |
| + for (uint32_t i = 0; i < observer_ids_to_remove.size(); i++) { |
| + observers_.Remove(observer_ids_to_remove[i]); |
| + } |
| +} |
| + |
| void IndexedDBDispatcher::RequestIDBCursorAdvance( |
| unsigned long count, |
| WebIDBCallbacks* callbacks_ptr, |