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

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

Issue 11567029: Proxy new objectstore/index methods through IPC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix nits, use faster copies Created 7 years, 11 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
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_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 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 "content/public/browser/browser_message_filter.h" 13 #include "content/public/browser/browser_message_filter.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h"
15 15
16 class GURL; 16 class GURL;
17 struct IndexedDBDatabaseMetadata; 17 struct IndexedDBDatabaseMetadata;
18 struct IndexedDBHostMsg_DatabaseCount_Params;
18 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; 19 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params;
20 struct IndexedDBHostMsg_DatabaseDeleteRange_Params;
21 struct IndexedDBHostMsg_DatabaseGet_Params;
22 struct IndexedDBHostMsg_DatabaseOpenCursor_Params;
23 struct IndexedDBHostMsg_DatabasePut_Params;
24 struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params;
19 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; 25 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params;
20 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; 26 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params;
21 struct IndexedDBHostMsg_FactoryOpen_Params; 27 struct IndexedDBHostMsg_FactoryOpen_Params;
22 struct IndexedDBHostMsg_IndexCount_Params; 28 struct IndexedDBHostMsg_IndexCount_Params;
23 struct IndexedDBHostMsg_IndexOpenCursor_Params; 29 struct IndexedDBHostMsg_IndexOpenCursor_Params;
24 struct IndexedDBHostMsg_ObjectStoreCount_Params; 30 struct IndexedDBHostMsg_ObjectStoreCount_Params;
25 struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params; 31 struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params;
26 struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params; 32 struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params;
27 struct IndexedDBHostMsg_ObjectStorePut_Params; 33 struct IndexedDBHostMsg_ObjectStorePut_Params;
28 34
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 template <class ReturnType> 104 template <class ReturnType>
99 ReturnType* GetOrTerminateProcess( 105 ReturnType* GetOrTerminateProcess(
100 IDMap<ReturnType, IDMapOwnPointer>* map, int32 ipc_return_object_id); 106 IDMap<ReturnType, IDMapOwnPointer>* map, int32 ipc_return_object_id);
101 107
102 template <typename ObjectType> 108 template <typename ObjectType>
103 void DestroyObject(IDMap<ObjectType, IDMapOwnPointer>* map, 109 void DestroyObject(IDMap<ObjectType, IDMapOwnPointer>* map,
104 int32 ipc_object_id); 110 int32 ipc_object_id);
105 111
106 // Used in nested classes. 112 // Used in nested classes.
107 typedef std::map<int32, GURL> WebIDBObjectIDToURLMap; 113 typedef std::map<int32, GURL> WebIDBObjectIDToURLMap;
108 typedef std::map<int32, int64> WebIDBTransactionIDToSizeMap; 114 typedef std::map<int32, uint64> WebIDBTransactionIPCIDToSizeMap;
115 typedef std::map<int64, uint64> WebIDBTransactionIDToSizeMap;
109 116
110 class DatabaseDispatcherHost { 117 class DatabaseDispatcherHost {
111 public: 118 public:
112 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent); 119 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent);
113 ~DatabaseDispatcherHost(); 120 ~DatabaseDispatcherHost();
114 121
115 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); 122 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok);
116 void Send(IPC::Message* message); 123 void Send(IPC::Message* message);
117 124
118 void OnMetadata(int32 ipc_database_id, 125 void OnMetadata(int32 ipc_database_id,
119 IndexedDBDatabaseMetadata* metadata); 126 IndexedDBDatabaseMetadata* metadata);
120 void OnCreateObjectStore( 127 void OnCreateObjectStore(
121 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params, 128 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params,
122 int32* object_store_id, WebKit::WebExceptionCode* ec); 129 int32* object_store_id, WebKit::WebExceptionCode* ec);
123 void OnDeleteObjectStore(int32 ipc_database_id, 130 void OnDeleteObjectStore(int32 ipc_database_id,
124 int64 object_store_id, 131 int64 object_store_id,
125 int32 ipc_transaction_id, 132 int32 ipc_transaction_id,
126 WebKit::WebExceptionCode* ec); 133 WebKit::WebExceptionCode* ec);
127 void OnCreateTransaction(int32 ipc_thread_id, 134 void OnCreateTransaction(int32 ipc_thread_id,
128 int32 ipc_database_id, 135 int32 ipc_database_id,
129 int64 transaction_id, 136 int64 transaction_id,
130 const std::vector<int64>& scope, 137 const std::vector<int64>& scope,
131 int32 mode, 138 int32 mode,
132 int32* ipc_transaction_id); 139 int32* ipc_transaction_id);
133 void OnOpen(int32 ipc_database_id, int32 ipc_thread_id, 140 void OnOpen(int32 ipc_database_id, int32 ipc_thread_id,
134 int32 ipc_response_id); 141 int32 ipc_response_id);
135 void OnClose(int32 ipc_database_id); 142 void OnClose(int32 ipc_database_id);
136 void OnDestroyed(int32 ipc_database_id); 143 void OnDestroyed(int32 ipc_database_id);
137 144
145 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params);
146 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params);
147 void OnSetIndexKeys(
148 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params);
149 void OnSetIndexesReady(
150 int32 ipc_database_id,
151 int64 transaction_id,
152 int64 object_store_id,
153 const std::vector<int64>& ids);
154 void OnOpenCursor(
155 const IndexedDBHostMsg_DatabaseOpenCursor_Params& params);
156 void OnCount(const IndexedDBHostMsg_DatabaseCount_Params& params);
157 void OnDeleteRange(
158 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params);
159 void OnClear(int32 ipc_thread_id,
160 int32 ipc_response_id,
161 int32 ipc_database_id,
162 int64 transaction_id,
163 int64 object_store_id);
138 IndexedDBDispatcherHost* parent_; 164 IndexedDBDispatcherHost* parent_;
139 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_; 165 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_;
140 WebIDBObjectIDToURLMap database_url_map_; 166 WebIDBObjectIDToURLMap database_url_map_;
167 WebIDBTransactionIDToSizeMap transaction_size_map_;
141 }; 168 };
142 169
143 class IndexDispatcherHost { 170 class IndexDispatcherHost {
144 public: 171 public:
145 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent); 172 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent);
146 ~IndexDispatcherHost(); 173 ~IndexDispatcherHost();
147 174
148 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); 175 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok);
149 void Send(IPC::Message* message); 176 void Send(IPC::Message* message);
150 177
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 int64 object_store_id, 296 int64 object_store_id,
270 int32* ipc_object_store_id, 297 int32* ipc_object_store_id,
271 WebKit::WebExceptionCode* ec); 298 WebKit::WebExceptionCode* ec);
272 void OnDidCompleteTaskEvents(int ipc_transaction_id); 299 void OnDidCompleteTaskEvents(int ipc_transaction_id);
273 void OnDestroyed(int32 ipc_transaction_id); 300 void OnDestroyed(int32 ipc_transaction_id);
274 301
275 IndexedDBDispatcherHost* parent_; 302 IndexedDBDispatcherHost* parent_;
276 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; 303 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType;
277 MapType map_; 304 MapType map_;
278 WebIDBObjectIDToURLMap transaction_url_map_; 305 WebIDBObjectIDToURLMap transaction_url_map_;
279 WebIDBTransactionIDToSizeMap transaction_size_map_; 306 WebIDBTransactionIPCIDToSizeMap transaction_ipc_size_map_;
280 }; 307 };
281 308
282 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; 309 scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
283 310
284 // Only access on WebKit thread. 311 // Only access on WebKit thread.
285 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; 312 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_;
286 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; 313 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_;
287 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_; 314 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_;
288 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; 315 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_;
289 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; 316 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_;
290 317
291 // Used to dispatch messages to the correct view host. 318 // Used to dispatch messages to the correct view host.
292 int ipc_process_id_; 319 int ipc_process_id_;
293 320
294 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 321 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
295 }; 322 };
296 323
297 } // namespace content 324 } // namespace content
298 325
299 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ 326 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698