OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
11 #include "content/browser/in_process_webkit/webkit_context.h" | |
12 #include "content/public/browser/browser_message_filter.h" | 11 #include "content/public/browser/browser_message_filter.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
14 | 13 |
15 class GURL; | 14 class GURL; |
| 15 class IndexedDBContextImpl; |
16 class IndexedDBKey; | 16 class IndexedDBKey; |
17 class IndexedDBKeyRange; | 17 class IndexedDBKeyRange; |
18 class NullableString16; | 18 class NullableString16; |
19 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; | 19 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; |
20 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; | 20 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; |
21 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; | 21 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; |
22 struct IndexedDBHostMsg_FactoryOpen_Params; | 22 struct IndexedDBHostMsg_FactoryOpen_Params; |
23 struct IndexedDBHostMsg_IndexCount_Params; | 23 struct IndexedDBHostMsg_IndexCount_Params; |
24 struct IndexedDBHostMsg_IndexOpenCursor_Params; | 24 struct IndexedDBHostMsg_IndexOpenCursor_Params; |
25 struct IndexedDBHostMsg_ObjectStoreCount_Params; | 25 struct IndexedDBHostMsg_ObjectStoreCount_Params; |
(...skipping 11 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 namespace content { | 39 namespace content { |
40 class SerializedScriptValue; | 40 class SerializedScriptValue; |
41 } | 41 } |
42 | 42 |
43 // Handles all IndexedDB related messages from a particular renderer process. | 43 // Handles all IndexedDB related messages from a particular renderer process. |
44 class IndexedDBDispatcherHost : public content::BrowserMessageFilter { | 44 class IndexedDBDispatcherHost : public content::BrowserMessageFilter { |
45 public: | 45 public: |
46 // Only call the constructor from the UI thread. | 46 // Only call the constructor from the UI thread. |
47 IndexedDBDispatcherHost(int process_id, WebKitContext* webkit_context); | 47 IndexedDBDispatcherHost(int process_id, |
| 48 IndexedDBContextImpl* indexed_db_context); |
48 | 49 |
49 // content::BrowserMessageFilter implementation. | 50 // content::BrowserMessageFilter implementation. |
50 virtual void OnChannelClosing() OVERRIDE; | 51 virtual void OnChannelClosing() OVERRIDE; |
51 virtual void OverrideThreadForMessage( | 52 virtual void OverrideThreadForMessage( |
52 const IPC::Message& message, | 53 const IPC::Message& message, |
53 content::BrowserThread::ID* thread) OVERRIDE; | 54 content::BrowserThread::ID* thread) OVERRIDE; |
54 virtual bool OnMessageReceived(const IPC::Message& message, | 55 virtual bool OnMessageReceived(const IPC::Message& message, |
55 bool* message_was_ok) OVERRIDE; | 56 bool* message_was_ok) OVERRIDE; |
56 | 57 |
57 void TransactionComplete(int32 transaction_id); | 58 void TransactionComplete(int32 transaction_id); |
58 | 59 |
59 // A shortcut for accessing our context. | 60 // A shortcut for accessing our context. |
60 IndexedDBContextImpl* Context() { | 61 IndexedDBContextImpl* Context() { return indexed_db_context_; } |
61 return webkit_context_->indexed_db_context(); | |
62 } | |
63 | 62 |
64 // The various IndexedDBCallbacks children call these methods to add the | 63 // The various IndexedDBCallbacks children call these methods to add the |
65 // results into the applicable map. See below for more details. | 64 // results into the applicable map. See below for more details. |
66 int32 Add(WebKit::WebIDBCursor* idb_cursor); | 65 int32 Add(WebKit::WebIDBCursor* idb_cursor); |
67 int32 Add(WebKit::WebIDBDatabase* idb_database, | 66 int32 Add(WebKit::WebIDBDatabase* idb_database, |
68 int32 thread_id, | 67 int32 thread_id, |
69 const GURL& origin_url); | 68 const GURL& origin_url); |
70 int32 Add(WebKit::WebIDBIndex* idb_index); | 69 int32 Add(WebKit::WebIDBIndex* idb_index); |
71 int32 Add(WebKit::WebIDBObjectStore* idb_object_store); | 70 int32 Add(WebKit::WebIDBObjectStore* idb_object_store); |
72 int32 Add(WebKit::WebIDBTransaction* idb_transaction, | 71 int32 Add(WebKit::WebIDBTransaction* idb_transaction, |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void OnDidCompleteTaskEvents(int transaction_id); | 300 void OnDidCompleteTaskEvents(int transaction_id); |
302 void OnDestroyed(int32 idb_transaction_id); | 301 void OnDestroyed(int32 idb_transaction_id); |
303 | 302 |
304 IndexedDBDispatcherHost* parent_; | 303 IndexedDBDispatcherHost* parent_; |
305 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; | 304 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; |
306 MapType map_; | 305 MapType map_; |
307 WebIDBObjectIDToURLMap transaction_url_map_; | 306 WebIDBObjectIDToURLMap transaction_url_map_; |
308 WebIDBTransactionIDToSizeMap transaction_size_map_; | 307 WebIDBTransactionIDToSizeMap transaction_size_map_; |
309 }; | 308 }; |
310 | 309 |
311 // Data shared between renderer processes with the same browser context. | 310 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
312 scoped_refptr<WebKitContext> webkit_context_; | |
313 | 311 |
314 // Only access on WebKit thread. | 312 // Only access on WebKit thread. |
315 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 313 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
316 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; | 314 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; |
317 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_; | 315 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_; |
318 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 316 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
319 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; | 317 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; |
320 | 318 |
321 // Used to dispatch messages to the correct view host. | 319 // Used to dispatch messages to the correct view host. |
322 int process_id_; | 320 int process_id_; |
323 | 321 |
324 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 322 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
325 }; | 323 }; |
326 | 324 |
327 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 325 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
OLD | NEW |