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..d90726b94f1a00de86fc0b3d4805966a3e7dd545 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,35 @@ 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, |
| + WebIDBObserver* observer_ptr) { |
| + std::unique_ptr<WebIDBObserver> observer(observer_ptr); |
|
dmurph
2016/06/28 18:53:50
This is weird, just pass the observer_ptr to the o
palakj1
2016/06/29 23:02:40
I had been imitating the previous styles. But, you
|
| + int32_t observer_id = observers_.Add(observer.release()); |
| + Send(new IndexedDBHostMsg_DatabaseObserve(ipc_database_id, transaction_id, |
| + observer_id)); |
| + return observer_id; |
| +} |
| + |
| +void IndexedDBDispatcher::RemoveIDBObserversFromDatabase( |
| + int32_t ipc_database_id, |
| + const std::vector<int32_t>& observer_ids_to_remove) { |
| + for (int32_t id_to_remove : observer_ids_to_remove) { |
| + observers_.Remove(id_to_remove); |
| + } |
| + Send(new IndexedDBHostMsg_DatabaseUnobserve(ipc_database_id, |
| + observer_ids_to_remove)); |
| +} |
| + |
| +void IndexedDBDispatcher::RemoveIDBObservers( |
| + const std::set<int32_t>& observer_ids_to_remove) { |
| + for (int32_t id : observer_ids_to_remove) { |
| + WebIDBObserver* observer = observers_.Lookup(id); |
| + observer->removeObserver(id); |
| + observers_.Remove(id); |
| + } |
| +} |
| + |
| void IndexedDBDispatcher::RequestIDBCursorAdvance( |
| unsigned long count, |
| WebIDBCallbacks* callbacks_ptr, |