Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 5 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/threading/thread_local.h" | 12 #include "base/threading/thread_local.h" |
| 13 #include "content/child/indexed_db/indexed_db_key_builders.h" | 13 #include "content/child/indexed_db/indexed_db_key_builders.h" |
| 14 #include "content/child/indexed_db/webidbcursor_impl.h" | 14 #include "content/child/indexed_db/webidbcursor_impl.h" |
| 15 #include "content/child/indexed_db/webidbdatabase_impl.h" | 15 #include "content/child/indexed_db/webidbdatabase_impl.h" |
| 16 #include "content/child/thread_safe_sender.h" | 16 #include "content/child/thread_safe_sender.h" |
| 17 #include "content/common/indexed_db/indexed_db_messages.h" | 17 #include "content/common/indexed_db/indexed_db_messages.h" |
| 18 #include "ipc/ipc_channel.h" | 18 #include "ipc/ipc_channel.h" |
| 19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseCal lbacks.h" | 19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseCal lbacks.h" |
| 20 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseErr or.h" | 20 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseErr or.h" |
| 21 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc eption.h" | 21 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc eption.h" |
| 22 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBValue.h" | 22 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBValue.h" |
| 23 | 23 |
| 24 using blink::IDBObserver; | |
| 24 using blink::WebBlobInfo; | 25 using blink::WebBlobInfo; |
| 25 using blink::WebData; | 26 using blink::WebData; |
| 26 using blink::WebIDBCallbacks; | 27 using blink::WebIDBCallbacks; |
| 27 using blink::WebIDBCursor; | 28 using blink::WebIDBCursor; |
| 28 using blink::WebIDBDatabase; | 29 using blink::WebIDBDatabase; |
| 29 using blink::WebIDBDatabaseCallbacks; | 30 using blink::WebIDBDatabaseCallbacks; |
| 30 using blink::WebIDBDatabaseError; | 31 using blink::WebIDBDatabaseError; |
| 31 using blink::WebIDBKey; | 32 using blink::WebIDBKey; |
| 32 using blink::WebIDBMetadata; | 33 using blink::WebIDBMetadata; |
| 33 using blink::WebIDBValue; | 34 using blink::WebIDBValue; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 // If a message gets here, IndexedDBMessageFilter already determined that it | 161 // If a message gets here, IndexedDBMessageFilter already determined that it |
| 161 // is an IndexedDB message. | 162 // is an IndexedDB message. |
| 162 DCHECK(handled) << "Didn't handle a message defined at line " | 163 DCHECK(handled) << "Didn't handle a message defined at line " |
| 163 << IPC_MESSAGE_ID_LINE(msg.type()); | 164 << IPC_MESSAGE_ID_LINE(msg.type()); |
| 164 } | 165 } |
| 165 | 166 |
| 166 bool IndexedDBDispatcher::Send(IPC::Message* msg) { | 167 bool IndexedDBDispatcher::Send(IPC::Message* msg) { |
| 167 return thread_safe_sender_->Send(msg); | 168 return thread_safe_sender_->Send(msg); |
| 168 } | 169 } |
| 169 | 170 |
| 171 void IndexedDBDispatcher::AddIDBObserver(int32_t ipc_database_id, | |
| 172 int64_t transaction_id, | |
| 173 blink::IDBObserver* observer) { | |
| 174 int64_t observer_id = maxObserverId++; | |
|
dmurph
2016/06/15 12:49:43
If you change to IDMap, we get this id from the 'i
| |
| 175 observers_[observer_id] = observer; | |
| 176 IndexedDBHostMsg_DatabaseObserve_Params params; | |
| 177 params.ipc_thread_id = CurrentWorkerId(); | |
| 178 params.ipc_database_id = ipc_database_id; | |
| 179 params.transaction_id = transaction_id; | |
| 180 params.observer_id = observer_id; | |
| 181 Send(new IndexedDBHostMsg_DatabaseObserve(params)); | |
| 182 } | |
| 183 | |
| 170 void IndexedDBDispatcher::RequestIDBCursorAdvance( | 184 void IndexedDBDispatcher::RequestIDBCursorAdvance( |
| 171 unsigned long count, | 185 unsigned long count, |
| 172 WebIDBCallbacks* callbacks_ptr, | 186 WebIDBCallbacks* callbacks_ptr, |
| 173 int32_t ipc_cursor_id, | 187 int32_t ipc_cursor_id, |
| 174 int64_t transaction_id) { | 188 int64_t transaction_id) { |
| 175 // Reset all cursor prefetch caches except for this cursor. | 189 // Reset all cursor prefetch caches except for this cursor. |
| 176 ResetCursorPrefetchCaches(transaction_id, ipc_cursor_id); | 190 ResetCursorPrefetchCaches(transaction_id, ipc_cursor_id); |
| 177 | 191 |
| 178 std::unique_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 192 std::unique_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 179 | 193 |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 800 typedef std::map<int32_t, WebIDBCursorImpl*>::iterator Iterator; | 814 typedef std::map<int32_t, WebIDBCursorImpl*>::iterator Iterator; |
| 801 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 815 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
| 802 if (i->first == ipc_exception_cursor_id || | 816 if (i->first == ipc_exception_cursor_id || |
| 803 i->second->transaction_id() != transaction_id) | 817 i->second->transaction_id() != transaction_id) |
| 804 continue; | 818 continue; |
| 805 i->second->ResetPrefetchCache(); | 819 i->second->ResetPrefetchCache(); |
| 806 } | 820 } |
| 807 } | 821 } |
| 808 | 822 |
| 809 } // namespace content | 823 } // namespace content |
| OLD | NEW |