Chromium Code Reviews| 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 | 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; | |
|
jsbell
2012/12/14 23:04:34
This was only called "DeleteRange" when we had Del
| |
| 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 Loading... | |
| 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 OnDelete(const IndexedDBHostMsg_DatabaseDeleteRange_Params& params); | |
| 158 void OnClear(int32 ipc_thread_id, | |
| 159 int32 ipc_response_id, | |
| 160 int32 ipc_database_id, | |
| 161 int64 transaction_id, | |
| 162 int64 object_store_id); | |
| 138 IndexedDBDispatcherHost* parent_; | 163 IndexedDBDispatcherHost* parent_; |
| 139 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_; | 164 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_; |
| 140 WebIDBObjectIDToURLMap database_url_map_; | 165 WebIDBObjectIDToURLMap database_url_map_; |
| 166 WebIDBTransactionIDToSizeMap transaction_size_map_; | |
| 141 }; | 167 }; |
| 142 | 168 |
| 143 class IndexDispatcherHost { | 169 class IndexDispatcherHost { |
| 144 public: | 170 public: |
| 145 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent); | 171 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent); |
| 146 ~IndexDispatcherHost(); | 172 ~IndexDispatcherHost(); |
| 147 | 173 |
| 148 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); | 174 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); |
| 149 void Send(IPC::Message* message); | 175 void Send(IPC::Message* message); |
| 150 | 176 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 int64 object_store_id, | 295 int64 object_store_id, |
| 270 int32* ipc_object_store_id, | 296 int32* ipc_object_store_id, |
| 271 WebKit::WebExceptionCode* ec); | 297 WebKit::WebExceptionCode* ec); |
| 272 void OnDidCompleteTaskEvents(int ipc_transaction_id); | 298 void OnDidCompleteTaskEvents(int ipc_transaction_id); |
| 273 void OnDestroyed(int32 ipc_transaction_id); | 299 void OnDestroyed(int32 ipc_transaction_id); |
| 274 | 300 |
| 275 IndexedDBDispatcherHost* parent_; | 301 IndexedDBDispatcherHost* parent_; |
| 276 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; | 302 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; |
| 277 MapType map_; | 303 MapType map_; |
| 278 WebIDBObjectIDToURLMap transaction_url_map_; | 304 WebIDBObjectIDToURLMap transaction_url_map_; |
| 279 WebIDBTransactionIDToSizeMap transaction_size_map_; | 305 WebIDBTransactionIPCIDToSizeMap transaction_ipc_size_map_; |
| 280 }; | 306 }; |
| 281 | 307 |
| 282 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 308 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 283 | 309 |
| 284 // Only access on WebKit thread. | 310 // Only access on WebKit thread. |
| 285 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 311 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
| 286 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; | 312 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; |
| 287 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_; | 313 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_; |
| 288 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 314 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
| 289 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; | 315 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; |
| 290 | 316 |
| 291 // Used to dispatch messages to the correct view host. | 317 // Used to dispatch messages to the correct view host. |
| 292 int ipc_process_id_; | 318 int ipc_process_id_; |
| 293 | 319 |
| 294 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 320 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
| 295 }; | 321 }; |
| 296 | 322 |
| 297 } // namespace content | 323 } // namespace content |
| 298 | 324 |
| 299 #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 |