OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 // The various IndexedDBCallbacks children call these methods to add the | 59 // The various IndexedDBCallbacks children call these methods to add the |
60 // results into the applicable map. See below for more details. | 60 // results into the applicable map. See below for more details. |
61 int32 Add(WebKit::WebIDBCursor* idb_cursor); | 61 int32 Add(WebKit::WebIDBCursor* idb_cursor); |
62 int32 Add(WebKit::WebIDBDatabase* idb_database, const GURL& origin_url); | 62 int32 Add(WebKit::WebIDBDatabase* idb_database, const GURL& origin_url); |
63 int32 Add(WebKit::WebIDBIndex* idb_index); | 63 int32 Add(WebKit::WebIDBIndex* idb_index); |
64 int32 Add(WebKit::WebIDBObjectStore* idb_object_store); | 64 int32 Add(WebKit::WebIDBObjectStore* idb_object_store); |
65 int32 Add(WebKit::WebIDBTransaction* idb_transaction, const GURL& origin_url); | 65 int32 Add(WebKit::WebIDBTransaction* idb_transaction, const GURL& origin_url); |
66 int32 Add(WebKit::WebDOMStringList* domStringList); | 66 int32 Add(WebKit::WebDOMStringList* domStringList); |
67 | 67 |
| 68 WebKit::WebIDBCursor* getCursorFromId(int32 cursor_id) { |
| 69 return GetOrTerminateProcess(&cursor_dispatcher_host_->map_, cursor_id); |
| 70 } |
| 71 |
| 72 int32 GetAndConsumeCursorIdForPendingContinue(int32 response_id) { |
| 73 int32 cursor_id = pending_cursor_continues_[response_id]; |
| 74 pending_cursor_continues_.erase(response_id); |
| 75 return cursor_id; |
| 76 } |
| 77 |
68 private: | 78 private: |
69 virtual ~IndexedDBDispatcherHost(); | 79 virtual ~IndexedDBDispatcherHost(); |
70 | 80 |
71 // Message processing. Most of the work is delegated to the dispatcher hosts | 81 // Message processing. Most of the work is delegated to the dispatcher hosts |
72 // below. | 82 // below. |
73 void OnIDBFactoryGetDatabaseNames( | 83 void OnIDBFactoryGetDatabaseNames( |
74 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); | 84 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); |
75 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); | 85 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); |
76 | 86 |
77 void OnIDBFactoryDeleteDatabase( | 87 void OnIDBFactoryDeleteDatabase( |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 void OnDidCompleteTaskEvents(int transaction_id); | 272 void OnDidCompleteTaskEvents(int transaction_id); |
263 void OnDestroyed(int32 idb_transaction_id); | 273 void OnDestroyed(int32 idb_transaction_id); |
264 | 274 |
265 IndexedDBDispatcherHost* parent_; | 275 IndexedDBDispatcherHost* parent_; |
266 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; | 276 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; |
267 MapType map_; | 277 MapType map_; |
268 WebIDBObjectIDToURLMap transaction_url_map_; | 278 WebIDBObjectIDToURLMap transaction_url_map_; |
269 WebIDBTransactionIDToSizeMap transaction_size_map_; | 279 WebIDBTransactionIDToSizeMap transaction_size_map_; |
270 }; | 280 }; |
271 | 281 |
| 282 |
272 // Data shared between renderer processes with the same browser context. | 283 // Data shared between renderer processes with the same browser context. |
273 scoped_refptr<WebKitContext> webkit_context_; | 284 scoped_refptr<WebKitContext> webkit_context_; |
274 | 285 |
275 // Only access on WebKit thread. | 286 // Only access on WebKit thread. |
276 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 287 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
277 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; | 288 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; |
278 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_; | 289 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_; |
279 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 290 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
280 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; | 291 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; |
281 | 292 |
282 // Used to dispatch messages to the correct view host. | 293 // Used to dispatch messages to the correct view host. |
283 int process_id_; | 294 int process_id_; |
284 | 295 |
| 296 // Map from response id to cursor id. Access on WebKit thread only. |
| 297 std::map<int32,int32> pending_cursor_continues_; |
| 298 |
285 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 299 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
286 }; | 300 }; |
287 | 301 |
288 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 302 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
OLD | NEW |