| 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 <map> | 9 #include <map> |
| 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 class IndexedDBContextImpl; | 17 class IndexedDBContextImpl; |
| 18 class IndexedDBKey; | |
| 19 class IndexedDBKeyRange; | |
| 20 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; | 18 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; |
| 21 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; | 19 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; |
| 22 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; | 20 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; |
| 23 struct IndexedDBHostMsg_FactoryOpen_Params; | 21 struct IndexedDBHostMsg_FactoryOpen_Params; |
| 24 struct IndexedDBHostMsg_IndexCount_Params; | 22 struct IndexedDBHostMsg_IndexCount_Params; |
| 25 struct IndexedDBHostMsg_IndexOpenCursor_Params; | 23 struct IndexedDBHostMsg_IndexOpenCursor_Params; |
| 26 struct IndexedDBHostMsg_ObjectStoreCount_Params; | 24 struct IndexedDBHostMsg_ObjectStoreCount_Params; |
| 27 struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params; | 25 struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params; |
| 28 struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params; | 26 struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params; |
| 29 struct IndexedDBHostMsg_ObjectStorePut_Params; | 27 struct IndexedDBHostMsg_ObjectStorePut_Params; |
| 30 | 28 |
| 31 namespace WebKit { | 29 namespace WebKit { |
| 32 class WebDOMStringList; | 30 class WebDOMStringList; |
| 33 class WebIDBCursor; | 31 class WebIDBCursor; |
| 34 class WebIDBDatabase; | 32 class WebIDBDatabase; |
| 35 class WebIDBIndex; | 33 class WebIDBIndex; |
| 36 class WebIDBObjectStore; | 34 class WebIDBObjectStore; |
| 37 class WebIDBTransaction; | 35 class WebIDBTransaction; |
| 38 } | 36 } |
| 39 | 37 |
| 40 namespace content { | 38 namespace content { |
| 39 class IndexedDBKey; |
| 41 class IndexedDBKeyPath; | 40 class IndexedDBKeyPath; |
| 41 class IndexedDBKeyRange; |
| 42 class SerializedScriptValue; | 42 class SerializedScriptValue; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Handles all IndexedDB related messages from a particular renderer process. | 45 // Handles all IndexedDB related messages from a particular renderer process. |
| 46 class IndexedDBDispatcherHost : public content::BrowserMessageFilter { | 46 class IndexedDBDispatcherHost : public content::BrowserMessageFilter { |
| 47 public: | 47 public: |
| 48 // Only call the constructor from the UI thread. | 48 // Only call the constructor from the UI thread. |
| 49 IndexedDBDispatcherHost(int process_id, | 49 IndexedDBDispatcherHost(int process_id, |
| 50 IndexedDBContextImpl* indexed_db_context); | 50 IndexedDBContextImpl* indexed_db_context); |
| 51 | 51 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 void OnOpenObjectCursor( | 162 void OnOpenObjectCursor( |
| 163 const IndexedDBHostMsg_IndexOpenCursor_Params& params, | 163 const IndexedDBHostMsg_IndexOpenCursor_Params& params, |
| 164 WebKit::WebExceptionCode* ec); | 164 WebKit::WebExceptionCode* ec); |
| 165 void OnOpenKeyCursor(const IndexedDBHostMsg_IndexOpenCursor_Params& params, | 165 void OnOpenKeyCursor(const IndexedDBHostMsg_IndexOpenCursor_Params& params, |
| 166 WebKit::WebExceptionCode* ec); | 166 WebKit::WebExceptionCode* ec); |
| 167 void OnCount(const IndexedDBHostMsg_IndexCount_Params& params, | 167 void OnCount(const IndexedDBHostMsg_IndexCount_Params& params, |
| 168 WebKit::WebExceptionCode* ec); | 168 WebKit::WebExceptionCode* ec); |
| 169 void OnGetObject(int idb_index_id, | 169 void OnGetObject(int idb_index_id, |
| 170 int32 thread_id, | 170 int32 thread_id, |
| 171 int32 response_id, | 171 int32 response_id, |
| 172 const IndexedDBKeyRange& key_range, | 172 const content::IndexedDBKeyRange& key_range, |
| 173 int32 transaction_id, | 173 int32 transaction_id, |
| 174 WebKit::WebExceptionCode* ec); | 174 WebKit::WebExceptionCode* ec); |
| 175 void OnGetKey(int idb_index_id, | 175 void OnGetKey(int idb_index_id, |
| 176 int32 thread_id, | 176 int32 thread_id, |
| 177 int32 response_id, | 177 int32 response_id, |
| 178 const IndexedDBKeyRange& key_range, | 178 const content::IndexedDBKeyRange& key_range, |
| 179 int32 transaction_id, | 179 int32 transaction_id, |
| 180 WebKit::WebExceptionCode* ec); | 180 WebKit::WebExceptionCode* ec); |
| 181 void OnDestroyed(int32 idb_index_id); | 181 void OnDestroyed(int32 idb_index_id); |
| 182 | 182 |
| 183 IndexedDBDispatcherHost* parent_; | 183 IndexedDBDispatcherHost* parent_; |
| 184 IDMap<WebKit::WebIDBIndex, IDMapOwnPointer> map_; | 184 IDMap<WebKit::WebIDBIndex, IDMapOwnPointer> map_; |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 class ObjectStoreDispatcherHost { | 187 class ObjectStoreDispatcherHost { |
| 188 public: | 188 public: |
| 189 explicit ObjectStoreDispatcherHost(IndexedDBDispatcherHost* parent); | 189 explicit ObjectStoreDispatcherHost(IndexedDBDispatcherHost* parent); |
| 190 ~ObjectStoreDispatcherHost(); | 190 ~ObjectStoreDispatcherHost(); |
| 191 | 191 |
| 192 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); | 192 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); |
| 193 void Send(IPC::Message* message); | 193 void Send(IPC::Message* message); |
| 194 | 194 |
| 195 void OnName(int32 idb_object_store_id, string16* name); | 195 void OnName(int32 idb_object_store_id, string16* name); |
| 196 void OnKeyPath(int32 idb_object_store_id, | 196 void OnKeyPath(int32 idb_object_store_id, |
| 197 content::IndexedDBKeyPath* keyPath); | 197 content::IndexedDBKeyPath* keyPath); |
| 198 void OnIndexNames(int32 idb_object_store_id, | 198 void OnIndexNames(int32 idb_object_store_id, |
| 199 std::vector<string16>* index_names); | 199 std::vector<string16>* index_names); |
| 200 void OnGet(int idb_object_store_id, | 200 void OnGet(int idb_object_store_id, |
| 201 int32 thread_id, | 201 int32 thread_id, |
| 202 int32 response_id, | 202 int32 response_id, |
| 203 const IndexedDBKeyRange& key_range, | 203 const content::IndexedDBKeyRange& key_range, |
| 204 int32 transaction_id, | 204 int32 transaction_id, |
| 205 WebKit::WebExceptionCode* ec); | 205 WebKit::WebExceptionCode* ec); |
| 206 void OnPut(const IndexedDBHostMsg_ObjectStorePut_Params& params, | 206 void OnPut(const IndexedDBHostMsg_ObjectStorePut_Params& params, |
| 207 WebKit::WebExceptionCode* ec); | 207 WebKit::WebExceptionCode* ec); |
| 208 void OnDelete(int idb_object_store_id, | 208 void OnDelete(int idb_object_store_id, |
| 209 int32 thread_id, | 209 int32 thread_id, |
| 210 int32 response_id, | 210 int32 response_id, |
| 211 const IndexedDBKey& key, | 211 const content::IndexedDBKey& key, |
| 212 int32 transaction_id, | 212 int32 transaction_id, |
| 213 WebKit::WebExceptionCode* ec); | 213 WebKit::WebExceptionCode* ec); |
| 214 void OnDeleteRange(int idb_object_store_id, | 214 void OnDeleteRange(int idb_object_store_id, |
| 215 int32 thread_id, | 215 int32 thread_id, |
| 216 int32 response_id, | 216 int32 response_id, |
| 217 const IndexedDBKeyRange& key_range, | 217 const content::IndexedDBKeyRange& key_range, |
| 218 int32 transaction_id, | 218 int32 transaction_id, |
| 219 WebKit::WebExceptionCode* ec); | 219 WebKit::WebExceptionCode* ec); |
| 220 void OnClear(int idb_object_store_id, | 220 void OnClear(int idb_object_store_id, |
| 221 int32 thread_id, | 221 int32 thread_id, |
| 222 int32 response_id, | 222 int32 response_id, |
| 223 int32 transaction_id, | 223 int32 transaction_id, |
| 224 WebKit::WebExceptionCode* ec); | 224 WebKit::WebExceptionCode* ec); |
| 225 void OnCreateIndex( | 225 void OnCreateIndex( |
| 226 const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params, | 226 const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params, |
| 227 int32* index_id, | 227 int32* index_id, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 247 | 247 |
| 248 class CursorDispatcherHost { | 248 class CursorDispatcherHost { |
| 249 public: | 249 public: |
| 250 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); | 250 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); |
| 251 ~CursorDispatcherHost(); | 251 ~CursorDispatcherHost(); |
| 252 | 252 |
| 253 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); | 253 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); |
| 254 void Send(IPC::Message* message); | 254 void Send(IPC::Message* message); |
| 255 | 255 |
| 256 void OnDirection(int32 idb_object_store_id, int32* direction); | 256 void OnDirection(int32 idb_object_store_id, int32* direction); |
| 257 void OnKey(int32 idb_object_store_id, IndexedDBKey* key); | 257 void OnKey(int32 idb_object_store_id, content::IndexedDBKey* key); |
| 258 void OnPrimaryKey(int32 idb_object_store_id, IndexedDBKey* primary_key); | 258 void OnPrimaryKey(int32 idb_object_store_id, |
| 259 content::IndexedDBKey* primary_key); |
| 259 void OnValue(int32 idb_object_store_id, | 260 void OnValue(int32 idb_object_store_id, |
| 260 content::SerializedScriptValue* script_value); | 261 content::SerializedScriptValue* script_value); |
| 261 void OnUpdate(int32 idb_object_store_id, | 262 void OnUpdate(int32 idb_object_store_id, |
| 262 int32 thread_id, | 263 int32 thread_id, |
| 263 int32 response_id, | 264 int32 response_id, |
| 264 const content::SerializedScriptValue& value, | 265 const content::SerializedScriptValue& value, |
| 265 WebKit::WebExceptionCode* ec); | 266 WebKit::WebExceptionCode* ec); |
| 266 void OnAdvance(int32 idb_object_store_id, | 267 void OnAdvance(int32 idb_object_store_id, |
| 267 int32 thread_id, | 268 int32 thread_id, |
| 268 int32 response_id, | 269 int32 response_id, |
| 269 unsigned long count, | 270 unsigned long count, |
| 270 WebKit::WebExceptionCode* ec); | 271 WebKit::WebExceptionCode* ec); |
| 271 void OnContinue(int32 idb_object_store_id, | 272 void OnContinue(int32 idb_object_store_id, |
| 272 int32 thread_id, | 273 int32 thread_id, |
| 273 int32 response_id, | 274 int32 response_id, |
| 274 const IndexedDBKey& key, | 275 const content::IndexedDBKey& key, |
| 275 WebKit::WebExceptionCode* ec); | 276 WebKit::WebExceptionCode* ec); |
| 276 void OnPrefetch(int32 idb_cursor_id, | 277 void OnPrefetch(int32 idb_cursor_id, |
| 277 int32 thread_id, | 278 int32 thread_id, |
| 278 int32 response_id, | 279 int32 response_id, |
| 279 int n, | 280 int n, |
| 280 WebKit::WebExceptionCode* ec); | 281 WebKit::WebExceptionCode* ec); |
| 281 void OnPrefetchReset(int32 idb_cursor_id, int used_prefetches, | 282 void OnPrefetchReset(int32 idb_cursor_id, int used_prefetches, |
| 282 int unused_prefetches); | 283 int unused_prefetches); |
| 283 void OnDelete(int32 idb_object_store_id, | 284 void OnDelete(int32 idb_object_store_id, |
| 284 int32 thread_id, | 285 int32 thread_id, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 325 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
| 325 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; | 326 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; |
| 326 | 327 |
| 327 // Used to dispatch messages to the correct view host. | 328 // Used to dispatch messages to the correct view host. |
| 328 int process_id_; | 329 int process_id_; |
| 329 | 330 |
| 330 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 331 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
| 331 }; | 332 }; |
| 332 | 333 |
| 333 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 334 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
| OLD | NEW |