Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: content/browser/indexed_db/indexed_db_dispatcher_host.h

Issue 18023022: Blob support for IDB [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge fixes [builds, untested] Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/id_map.h" 12 #include "base/id_map.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "content/public/browser/browser_message_filter.h" 14 #include "content/public/browser/browser_message_filter.h"
15 #include "net/url_request/url_request_context_getter.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 struct IndexedDBDatabaseMetadata; 18 struct IndexedDBDatabaseMetadata;
18 struct IndexedDBHostMsg_DatabaseCount_Params; 19 struct IndexedDBHostMsg_DatabaseCount_Params;
19 struct IndexedDBHostMsg_DatabaseCreateIndex_Params; 20 struct IndexedDBHostMsg_DatabaseCreateIndex_Params;
20 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; 21 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params;
21 struct IndexedDBHostMsg_DatabaseCreateTransaction_Params; 22 struct IndexedDBHostMsg_DatabaseCreateTransaction_Params;
22 struct IndexedDBHostMsg_DatabaseDeleteRange_Params; 23 struct IndexedDBHostMsg_DatabaseDeleteRange_Params;
23 struct IndexedDBHostMsg_DatabaseGet_Params; 24 struct IndexedDBHostMsg_DatabaseGet_Params;
24 struct IndexedDBHostMsg_DatabaseOpenCursor_Params; 25 struct IndexedDBHostMsg_DatabaseOpenCursor_Params;
25 struct IndexedDBHostMsg_DatabasePut_Params; 26 struct IndexedDBHostMsg_DatabasePut_Params;
26 struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params; 27 struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params;
27 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; 28 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params;
28 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; 29 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params;
29 struct IndexedDBHostMsg_FactoryOpen_Params; 30 struct IndexedDBHostMsg_FactoryOpen_Params;
30 31
31 namespace content { 32 namespace content {
33 class FileAPIMessageFilter;
32 class IndexedDBConnection; 34 class IndexedDBConnection;
33 class IndexedDBContextImpl; 35 class IndexedDBContextImpl;
34 class IndexedDBCursor; 36 class IndexedDBCursor;
35 class IndexedDBKey; 37 class IndexedDBKey;
36 class IndexedDBKeyPath; 38 class IndexedDBKeyPath;
37 class IndexedDBKeyRange; 39 class IndexedDBKeyRange;
38 struct IndexedDBDatabaseMetadata; 40 struct IndexedDBDatabaseMetadata;
39 41
40 // Handles all IndexedDB related messages from a particular renderer process. 42 // Handles all IndexedDB related messages from a particular renderer process.
41 class IndexedDBDispatcherHost : public BrowserMessageFilter { 43 class IndexedDBDispatcherHost : public BrowserMessageFilter {
42 public: 44 public:
43 // Only call the constructor from the UI thread. 45 // Only call the constructor from the UI thread.
44 IndexedDBDispatcherHost(int ipc_process_id, 46 IndexedDBDispatcherHost(int ipc_process_id,
45 IndexedDBContextImpl* indexed_db_context); 47 net::URLRequestContextGetter* request_context_getter,
48 IndexedDBContextImpl* indexed_db_context,
49 FileAPIMessageFilter* file_api_message_filter);
50 IndexedDBDispatcherHost(int ipc_process_id,
51 net::URLRequestContext* request_context,
52 IndexedDBContextImpl* indexed_db_context,
53 FileAPIMessageFilter* file_api_message_filter);
46 54
47 static ::IndexedDBDatabaseMetadata ConvertMetadata( 55 static ::IndexedDBDatabaseMetadata ConvertMetadata(
48 const content::IndexedDBDatabaseMetadata& metadata); 56 const content::IndexedDBDatabaseMetadata& metadata);
49 57
50 // BrowserMessageFilter implementation. 58 // BrowserMessageFilter implementation.
59 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
51 virtual void OnChannelClosing() OVERRIDE; 60 virtual void OnChannelClosing() OVERRIDE;
52 virtual void OnDestruct() const OVERRIDE; 61 virtual void OnDestruct() const OVERRIDE;
53 virtual base::TaskRunner* OverrideTaskRunnerForMessage( 62 virtual base::TaskRunner* OverrideTaskRunnerForMessage(
54 const IPC::Message& message) OVERRIDE; 63 const IPC::Message& message) OVERRIDE;
55 virtual bool OnMessageReceived(const IPC::Message& message, 64 virtual bool OnMessageReceived(const IPC::Message& message,
56 bool* message_was_ok) OVERRIDE; 65 bool* message_was_ok) OVERRIDE;
57 66
58 void FinishTransaction(int64 host_transaction_id, bool committed); 67 void FinishTransaction(int64 host_transaction_id, bool committed);
59 68
60 // A shortcut for accessing our context. 69 // A shortcut for accessing our context.
61 IndexedDBContextImpl* Context() { return indexed_db_context_; } 70 IndexedDBContextImpl* Context() { return indexed_db_context_; }
71 FileAPIMessageFilter* file_api_message_filter() {
72 return file_api_message_filter_;
73 }
62 74
63 // IndexedDBCallbacks call these methods to add the results into the 75 // IndexedDBCallbacks call these methods to add the results into the
64 // applicable map. See below for more details. 76 // applicable map. See below for more details.
65 int32 Add(IndexedDBCursor* cursor); 77 int32 Add(IndexedDBCursor* cursor);
66 int32 Add(IndexedDBConnection* connection, 78 int32 Add(IndexedDBConnection* connection,
67 int32 ipc_thread_id, 79 int32 ipc_thread_id,
68 const GURL& origin_url); 80 const GURL& origin_url);
69 81
70 void RegisterTransactionId(int64 host_transaction_id, const GURL& origin_url); 82 void RegisterTransactionId(int64 host_transaction_id, const GURL& origin_url);
71 83
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 int n); 231 int n);
220 void OnPrefetchReset(int32 ipc_cursor_id, 232 void OnPrefetchReset(int32 ipc_cursor_id,
221 int used_prefetches, 233 int used_prefetches,
222 int unused_prefetches); 234 int unused_prefetches);
223 void OnDestroyed(int32 ipc_cursor_id); 235 void OnDestroyed(int32 ipc_cursor_id);
224 236
225 IndexedDBDispatcherHost* parent_; 237 IndexedDBDispatcherHost* parent_;
226 RefIDMap<IndexedDBCursor> map_; 238 RefIDMap<IndexedDBCursor> map_;
227 }; 239 };
228 240
241 // The getter holds the context until OnChannelConnected() can be called from
242 // the IO thread, which will extract the net::URLRequestContext from it.
243 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
244 net::URLRequestContext* request_context_;
229 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; 245 scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
246 FileAPIMessageFilter* file_api_message_filter_;
230 247
231 // Only access on IndexedDB thread. 248 // Only access on IndexedDB thread.
232 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; 249 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_;
233 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; 250 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_;
234 251
235 // Used to dispatch messages to the correct view host. 252 // Used to dispatch messages to the correct view host.
236 int ipc_process_id_; 253 int ipc_process_id_;
237 254
238 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 255 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
239 }; 256 };
240 257
241 } // namespace content 258 } // namespace content
242 259
243 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 260 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698