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_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 5 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
6 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 6 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
12 #include "base/nullable_string16.h" | 12 #include "base/nullable_string16.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "ipc/ipc_sync_message_filter.h" | 14 #include "ipc/ipc_sync_message_filter.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac
ks.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac
ks.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" |
21 #include "webkit/glue/worker_task_runner.h" | 21 #include "webkit/glue/worker_task_runner.h" |
22 | 22 |
23 struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params; | 23 struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params; |
24 struct IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params; | 24 struct IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params; |
25 struct IndexedDBMsg_CallbacksSuccessIDBCursor_Params; | 25 struct IndexedDBMsg_CallbacksSuccessIDBCursor_Params; |
26 class RendererWebIDBCursorImpl; | 26 class RendererWebIDBCursorImpl; |
| 27 class RendererWebIDBDatabaseImpl; |
27 | 28 |
28 namespace IPC { | 29 namespace IPC { |
29 class Message; | 30 class Message; |
30 } | 31 } |
31 | 32 |
32 namespace WebKit { | 33 namespace WebKit { |
33 class WebFrame; | 34 class WebFrame; |
34 class WebIDBKeyRange; | 35 class WebIDBKeyRange; |
35 class WebIDBTransaction; | 36 class WebIDBTransaction; |
36 } | 37 } |
(...skipping 25 matching lines...) Expand all Loading... |
62 void OnMessageReceived(const IPC::Message& msg); | 63 void OnMessageReceived(const IPC::Message& msg); |
63 static bool Send(IPC::Message* msg); | 64 static bool Send(IPC::Message* msg); |
64 | 65 |
65 void RequestIDBFactoryGetDatabaseNames( | 66 void RequestIDBFactoryGetDatabaseNames( |
66 WebKit::WebIDBCallbacks* callbacks, | 67 WebKit::WebIDBCallbacks* callbacks, |
67 const string16& origin, | 68 const string16& origin, |
68 WebKit::WebFrame* web_frame); | 69 WebKit::WebFrame* web_frame); |
69 | 70 |
70 void RequestIDBFactoryOpen( | 71 void RequestIDBFactoryOpen( |
71 const string16& name, | 72 const string16& name, |
| 73 int64 version, |
72 WebKit::WebIDBCallbacks* callbacks, | 74 WebKit::WebIDBCallbacks* callbacks, |
73 const string16& origin, | 75 const string16& origin, |
74 WebKit::WebFrame* web_frame); | 76 WebKit::WebFrame* web_frame); |
75 | 77 |
76 void RequestIDBFactoryDeleteDatabase( | 78 void RequestIDBFactoryDeleteDatabase( |
77 const string16& name, | 79 const string16& name, |
78 WebKit::WebIDBCallbacks* callbacks, | 80 WebKit::WebIDBCallbacks* callbacks, |
79 const string16& origin, | 81 const string16& origin, |
80 WebKit::WebFrame* web_frame); | 82 WebKit::WebFrame* web_frame); |
81 | 83 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 WebKit::WebIDBCallbacks* callbacks, | 207 WebKit::WebIDBCallbacks* callbacks, |
206 int32 idb_object_store_id, | 208 int32 idb_object_store_id, |
207 const WebKit::WebIDBTransaction& transaction, | 209 const WebKit::WebIDBTransaction& transaction, |
208 WebKit::WebExceptionCode* ec); | 210 WebKit::WebExceptionCode* ec); |
209 | 211 |
210 void RegisterWebIDBTransactionCallbacks( | 212 void RegisterWebIDBTransactionCallbacks( |
211 WebKit::WebIDBTransactionCallbacks* callbacks, | 213 WebKit::WebIDBTransactionCallbacks* callbacks, |
212 int32 id); | 214 int32 id); |
213 | 215 |
214 void CursorDestroyed(int32 cursor_id); | 216 void CursorDestroyed(int32 cursor_id); |
| 217 void DatabaseDestroyed(int32 database_id); |
215 | 218 |
216 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); | 219 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); |
217 | 220 |
218 private: | 221 private: |
219 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); | 222 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); |
220 | 223 |
221 // IDBCallback message handlers. | 224 // IDBCallback message handlers. |
222 void OnSuccessNull(int32 response_id); | 225 void OnSuccessNull(int32 response_id); |
223 void OnSuccessIDBDatabase(int32 thread_id, | 226 void OnSuccessIDBDatabase(int32 thread_id, |
224 int32 response_id, | 227 int32 response_id, |
(...skipping 15 matching lines...) Expand all Loading... |
240 const std::vector<string16>& value); | 243 const std::vector<string16>& value); |
241 void OnSuccessSerializedScriptValue( | 244 void OnSuccessSerializedScriptValue( |
242 int32 thread_id, | 245 int32 thread_id, |
243 int32 response_id, | 246 int32 response_id, |
244 const content::SerializedScriptValue& value); | 247 const content::SerializedScriptValue& value); |
245 void OnError(int32 thread_id, | 248 void OnError(int32 thread_id, |
246 int32 response_id, | 249 int32 response_id, |
247 int code, | 250 int code, |
248 const string16& message); | 251 const string16& message); |
249 void OnBlocked(int32 thread_id, int32 response_id); | 252 void OnBlocked(int32 thread_id, int32 response_id); |
| 253 void OnIntBlocked(int32 thread_id, int32 response_id, int64 existing_version); |
| 254 void OnUpgradeNeeded(int32 thread_id, |
| 255 int32 response_id, |
| 256 int32 transaction_id, |
| 257 int32 database_id, |
| 258 int64 old_version); |
250 void OnAbort(int32 thread_id, int32 transaction_id); | 259 void OnAbort(int32 thread_id, int32 transaction_id); |
251 void OnComplete(int32 thread_id, int32 transaction_id); | 260 void OnComplete(int32 thread_id, int32 transaction_id); |
252 void OnVersionChange(int32 thread_id, | 261 void OnVersionChange(int32 thread_id, |
253 int32 database_id, | 262 int32 database_id, |
254 const string16& newVersion); | 263 const string16& newVersion); |
| 264 void OnIntVersionChange(int32 thread_id, |
| 265 int32 database_id, |
| 266 int64 old_version, |
| 267 int64 new_version); |
255 | 268 |
256 // Reset cursor prefetch caches for all cursors except exception_cursor_id. | 269 // Reset cursor prefetch caches for all cursors except exception_cursor_id. |
257 void ResetCursorPrefetchCaches(int32 exception_cursor_id = -1); | 270 void ResetCursorPrefetchCaches(int32 exception_cursor_id = -1); |
258 | 271 |
259 // Careful! WebIDBCallbacks wraps non-threadsafe data types. It must be | 272 // Careful! WebIDBCallbacks wraps non-threadsafe data types. It must be |
260 // destroyed and used on the same thread it was created on. | 273 // destroyed and used on the same thread it was created on. |
261 IDMap<WebKit::WebIDBCallbacks, IDMapOwnPointer> pending_callbacks_; | 274 IDMap<WebKit::WebIDBCallbacks, IDMapOwnPointer> pending_callbacks_; |
262 IDMap<WebKit::WebIDBTransactionCallbacks, IDMapOwnPointer> | 275 IDMap<WebKit::WebIDBTransactionCallbacks, IDMapOwnPointer> |
263 pending_transaction_callbacks_; | 276 pending_transaction_callbacks_; |
264 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> | 277 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> |
265 pending_database_callbacks_; | 278 pending_database_callbacks_; |
266 | 279 |
267 // Map from cursor id to RendererWebIDBCursorImpl. | 280 // Map from cursor id to RendererWebIDBCursorImpl. |
268 std::map<int32, RendererWebIDBCursorImpl*> cursors_; | 281 std::map<int32, RendererWebIDBCursorImpl*> cursors_; |
269 | 282 |
| 283 std::map<int32, RendererWebIDBDatabaseImpl*> databases_; |
| 284 |
270 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); | 285 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); |
271 }; | 286 }; |
272 | 287 |
273 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 288 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
OLD | NEW |