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 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/id_map.h" | 12 #include "base/id_map.h" |
12 #include "content/public/browser/browser_message_filter.h" | 13 #include "content/public/browser/browser_message_filter.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
14 | 15 |
15 class GURL; | 16 class GURL; |
16 class IndexedDBContextImpl; | 17 class IndexedDBContextImpl; |
17 struct IndexedDBDatabaseMetadata; | 18 struct IndexedDBDatabaseMetadata; |
18 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; | 19 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void OnIDBFactoryDeleteDatabase( | 91 void OnIDBFactoryDeleteDatabase( |
91 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); | 92 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); |
92 | 93 |
93 void ResetDispatcherHosts(); | 94 void ResetDispatcherHosts(); |
94 | 95 |
95 // Helper templates. | 96 // Helper templates. |
96 template <class ReturnType> | 97 template <class ReturnType> |
97 ReturnType* GetOrTerminateProcess( | 98 ReturnType* GetOrTerminateProcess( |
98 IDMap<ReturnType, IDMapOwnPointer>* map, int32 return_object_id); | 99 IDMap<ReturnType, IDMapOwnPointer>* map, int32 return_object_id); |
99 | 100 |
100 template <typename ReplyType, typename WebObjectType, typename Method> | |
101 void SyncGetter(IDMap<WebObjectType, IDMapOwnPointer>* map, int32 object_id, | |
102 ReplyType* reply, Method method); | |
103 | |
104 template <typename ObjectType> | 101 template <typename ObjectType> |
105 void DestroyObject(IDMap<ObjectType, IDMapOwnPointer>* map, int32 object_id); | 102 void DestroyObject(IDMap<ObjectType, IDMapOwnPointer>* map, int32 object_id); |
106 | 103 |
107 // Used in nested classes. | 104 // Used in nested classes. |
108 typedef std::map<int32, GURL> WebIDBObjectIDToURLMap; | 105 typedef std::map<int32, GURL> WebIDBObjectIDToURLMap; |
109 typedef std::map<int32, int64> WebIDBTransactionIDToSizeMap; | 106 typedef std::map<int32, int64> WebIDBTransactionIDToSizeMap; |
110 | 107 |
111 class DatabaseDispatcherHost { | 108 class DatabaseDispatcherHost { |
112 public: | 109 public: |
113 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent); | 110 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 class TransactionDispatcherHost { | 273 class TransactionDispatcherHost { |
277 public: | 274 public: |
278 explicit TransactionDispatcherHost(IndexedDBDispatcherHost* parent); | 275 explicit TransactionDispatcherHost(IndexedDBDispatcherHost* parent); |
279 ~TransactionDispatcherHost(); | 276 ~TransactionDispatcherHost(); |
280 | 277 |
281 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); | 278 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); |
282 void Send(IPC::Message* message); | 279 void Send(IPC::Message* message); |
283 | 280 |
284 void OnCommit(int32 transaction_id); | 281 void OnCommit(int32 transaction_id); |
285 void OnAbort(int32 transaction_id); | 282 void OnAbort(int32 transaction_id); |
286 void OnMode(int32 transaction_id, int* mode); | |
287 void OnObjectStore(int32 transaction_id, | 283 void OnObjectStore(int32 transaction_id, |
288 const string16& name, | 284 const string16& name, |
289 int32* object_store_id, | 285 int32* object_store_id, |
290 WebKit::WebExceptionCode* ec); | 286 WebKit::WebExceptionCode* ec); |
291 void OnDidCompleteTaskEvents(int transaction_id); | 287 void OnDidCompleteTaskEvents(int transaction_id); |
292 void OnDestroyed(int32 idb_transaction_id); | 288 void OnDestroyed(int32 idb_transaction_id); |
293 | 289 |
294 IndexedDBDispatcherHost* parent_; | 290 IndexedDBDispatcherHost* parent_; |
295 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; | 291 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; |
296 MapType map_; | 292 MapType map_; |
(...skipping 10 matching lines...) Expand all Loading... |
307 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 303 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
308 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; | 304 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; |
309 | 305 |
310 // Used to dispatch messages to the correct view host. | 306 // Used to dispatch messages to the correct view host. |
311 int process_id_; | 307 int process_id_; |
312 | 308 |
313 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 309 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
314 }; | 310 }; |
315 | 311 |
316 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 312 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
OLD | NEW |