| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/nullable_string16.h" | 13 #include "base/nullable_string16.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "ipc/ipc_sync_message_filter.h" | 15 #include "ipc/ipc_sync_message_filter.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac
ks.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac
ks.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" |
| 22 #include "webkit/glue/worker_task_runner.h" | 22 #include "webkit/glue/worker_task_runner.h" |
| 23 | 23 |
| 24 class IndexedDBKey; | |
| 25 class IndexedDBKeyRange; | |
| 26 struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params; | 24 struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params; |
| 27 struct IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params; | 25 struct IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params; |
| 28 struct IndexedDBMsg_CallbacksSuccessIDBCursor_Params; | 26 struct IndexedDBMsg_CallbacksSuccessIDBCursor_Params; |
| 29 class RendererWebIDBCursorImpl; | 27 class RendererWebIDBCursorImpl; |
| 30 | 28 |
| 31 namespace IPC { | 29 namespace IPC { |
| 32 class Message; | 30 class Message; |
| 33 } | 31 } |
| 34 | 32 |
| 35 namespace WebKit { | 33 namespace WebKit { |
| 36 class WebFrame; | 34 class WebFrame; |
| 37 class WebIDBKeyRange; | 35 class WebIDBKeyRange; |
| 38 class WebIDBTransaction; | 36 class WebIDBTransaction; |
| 39 } | 37 } |
| 40 | 38 |
| 41 namespace content { | 39 namespace content { |
| 40 class IndexedDBKey; |
| 41 class IndexedDBKeyRange; |
| 42 class SerializedScriptValue; | 42 class SerializedScriptValue; |
| 43 } | 43 } |
| 44 | 44 |
| 45 CONTENT_EXPORT extern const size_t kMaxIDBValueSizeInBytes; | 45 CONTENT_EXPORT extern const size_t kMaxIDBValueSizeInBytes; |
| 46 | 46 |
| 47 // Handle the indexed db related communication for this context thread - the | 47 // Handle the indexed db related communication for this context thread - the |
| 48 // main thread and each worker thread have their own copies. | 48 // main thread and each worker thread have their own copies. |
| 49 class CONTENT_EXPORT IndexedDBDispatcher | 49 class CONTENT_EXPORT IndexedDBDispatcher |
| 50 : public webkit_glue::WorkerTaskRunner::Observer { | 50 : public webkit_glue::WorkerTaskRunner::Observer { |
| 51 public: | 51 public: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 int32 idb_cursor_id, | 86 int32 idb_cursor_id, |
| 87 WebKit::WebExceptionCode* ec); | 87 WebKit::WebExceptionCode* ec); |
| 88 | 88 |
| 89 void RequestIDBCursorAdvance( | 89 void RequestIDBCursorAdvance( |
| 90 unsigned long count, | 90 unsigned long count, |
| 91 WebKit::WebIDBCallbacks* callbacks_ptr, | 91 WebKit::WebIDBCallbacks* callbacks_ptr, |
| 92 int32 idb_cursor_id, | 92 int32 idb_cursor_id, |
| 93 WebKit::WebExceptionCode* ec); | 93 WebKit::WebExceptionCode* ec); |
| 94 | 94 |
| 95 void RequestIDBCursorContinue( | 95 void RequestIDBCursorContinue( |
| 96 const IndexedDBKey& key, | 96 const content::IndexedDBKey& key, |
| 97 WebKit::WebIDBCallbacks* callbacks_ptr, | 97 WebKit::WebIDBCallbacks* callbacks_ptr, |
| 98 int32 idb_cursor_id, | 98 int32 idb_cursor_id, |
| 99 WebKit::WebExceptionCode* ec); | 99 WebKit::WebExceptionCode* ec); |
| 100 | 100 |
| 101 void RequestIDBCursorPrefetch( | 101 void RequestIDBCursorPrefetch( |
| 102 int n, | 102 int n, |
| 103 WebKit::WebIDBCallbacks* callbacks_ptr, | 103 WebKit::WebIDBCallbacks* callbacks_ptr, |
| 104 int32 idb_cursor_id, | 104 int32 idb_cursor_id, |
| 105 WebKit::WebExceptionCode* ec); | 105 WebKit::WebExceptionCode* ec); |
| 106 | 106 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 WebKit::WebExceptionCode* ec); | 142 WebKit::WebExceptionCode* ec); |
| 143 | 143 |
| 144 void RequestIDBIndexCount( | 144 void RequestIDBIndexCount( |
| 145 const WebKit::WebIDBKeyRange& idb_key_range, | 145 const WebKit::WebIDBKeyRange& idb_key_range, |
| 146 WebKit::WebIDBCallbacks* callbacks, | 146 WebKit::WebIDBCallbacks* callbacks, |
| 147 int32 idb_index_id, | 147 int32 idb_index_id, |
| 148 const WebKit::WebIDBTransaction& transaction, | 148 const WebKit::WebIDBTransaction& transaction, |
| 149 WebKit::WebExceptionCode* ec); | 149 WebKit::WebExceptionCode* ec); |
| 150 | 150 |
| 151 void RequestIDBIndexGetObject( | 151 void RequestIDBIndexGetObject( |
| 152 const IndexedDBKeyRange& key_range, | 152 const content::IndexedDBKeyRange& key_range, |
| 153 WebKit::WebIDBCallbacks* callbacks, | 153 WebKit::WebIDBCallbacks* callbacks, |
| 154 int32 idb_index_id, | 154 int32 idb_index_id, |
| 155 const WebKit::WebIDBTransaction& transaction, | 155 const WebKit::WebIDBTransaction& transaction, |
| 156 WebKit::WebExceptionCode* ec); | 156 WebKit::WebExceptionCode* ec); |
| 157 | 157 |
| 158 void RequestIDBIndexGetKey( | 158 void RequestIDBIndexGetKey( |
| 159 const IndexedDBKeyRange& key_range, | 159 const content::IndexedDBKeyRange& key_range, |
| 160 WebKit::WebIDBCallbacks* callbacks, | 160 WebKit::WebIDBCallbacks* callbacks, |
| 161 int32 idb_index_id, | 161 int32 idb_index_id, |
| 162 const WebKit::WebIDBTransaction& transaction, | 162 const WebKit::WebIDBTransaction& transaction, |
| 163 WebKit::WebExceptionCode* ec); | 163 WebKit::WebExceptionCode* ec); |
| 164 | 164 |
| 165 void RequestIDBObjectStoreGet( | 165 void RequestIDBObjectStoreGet( |
| 166 const IndexedDBKeyRange& key_range, | 166 const content::IndexedDBKeyRange& key_range, |
| 167 WebKit::WebIDBCallbacks* callbacks, | 167 WebKit::WebIDBCallbacks* callbacks, |
| 168 int32 idb_object_store_id, | 168 int32 idb_object_store_id, |
| 169 const WebKit::WebIDBTransaction& transaction, | 169 const WebKit::WebIDBTransaction& transaction, |
| 170 WebKit::WebExceptionCode* ec); | 170 WebKit::WebExceptionCode* ec); |
| 171 | 171 |
| 172 void RequestIDBObjectStorePut(const content::SerializedScriptValue& value, | 172 void RequestIDBObjectStorePut(const content::SerializedScriptValue& value, |
| 173 const IndexedDBKey& key, | 173 const content::IndexedDBKey& key, |
| 174 WebKit::WebIDBObjectStore::PutMode putMode, | 174 WebKit::WebIDBObjectStore::PutMode putMode, |
| 175 WebKit::WebIDBCallbacks* callbacks, | 175 WebKit::WebIDBCallbacks* callbacks, |
| 176 int32 idb_object_store_id, | 176 int32 idb_object_store_id, |
| 177 const WebKit::WebIDBTransaction& transaction, | 177 const WebKit::WebIDBTransaction& transaction, |
| 178 WebKit::WebExceptionCode* ec); | 178 WebKit::WebExceptionCode* ec); |
| 179 | 179 |
| 180 void RequestIDBObjectStoreDelete( | 180 void RequestIDBObjectStoreDelete( |
| 181 const IndexedDBKey& key, | 181 const content::IndexedDBKey& key, |
| 182 WebKit::WebIDBCallbacks* callbacks, | 182 WebKit::WebIDBCallbacks* callbacks, |
| 183 int32 idb_object_store_id, | 183 int32 idb_object_store_id, |
| 184 const WebKit::WebIDBTransaction& transaction, | 184 const WebKit::WebIDBTransaction& transaction, |
| 185 WebKit::WebExceptionCode* ec); | 185 WebKit::WebExceptionCode* ec); |
| 186 | 186 |
| 187 void RequestIDBObjectStoreDeleteRange( | 187 void RequestIDBObjectStoreDeleteRange( |
| 188 const IndexedDBKeyRange& key_range, | 188 const content::IndexedDBKeyRange& key_range, |
| 189 WebKit::WebIDBCallbacks* callbacks, | 189 WebKit::WebIDBCallbacks* callbacks, |
| 190 int32 idb_object_store_id, | 190 int32 idb_object_store_id, |
| 191 const WebKit::WebIDBTransaction& transaction, | 191 const WebKit::WebIDBTransaction& transaction, |
| 192 WebKit::WebExceptionCode* ec); | 192 WebKit::WebExceptionCode* ec); |
| 193 | 193 |
| 194 void RequestIDBObjectStoreClear( | 194 void RequestIDBObjectStoreClear( |
| 195 WebKit::WebIDBCallbacks* callbacks, | 195 WebKit::WebIDBCallbacks* callbacks, |
| 196 int32 idb_object_store_id, | 196 int32 idb_object_store_id, |
| 197 const WebKit::WebIDBTransaction& transaction, | 197 const WebKit::WebIDBTransaction& transaction, |
| 198 WebKit::WebExceptionCode* ec); | 198 WebKit::WebExceptionCode* ec); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 223 private: | 223 private: |
| 224 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); | 224 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); |
| 225 | 225 |
| 226 // IDBCallback message handlers. | 226 // IDBCallback message handlers. |
| 227 void OnSuccessNull(int32 response_id); | 227 void OnSuccessNull(int32 response_id); |
| 228 void OnSuccessIDBDatabase(int32 thread_id, | 228 void OnSuccessIDBDatabase(int32 thread_id, |
| 229 int32 response_id, | 229 int32 response_id, |
| 230 int32 object_id); | 230 int32 object_id); |
| 231 void OnSuccessIndexedDBKey(int32 thread_id, | 231 void OnSuccessIndexedDBKey(int32 thread_id, |
| 232 int32 response_id, | 232 int32 response_id, |
| 233 const IndexedDBKey& key); | 233 const content::IndexedDBKey& key); |
| 234 void OnSuccessIDBTransaction(int32 thread_id, | 234 void OnSuccessIDBTransaction(int32 thread_id, |
| 235 int32 response_id, | 235 int32 response_id, |
| 236 int32 object_id); | 236 int32 object_id); |
| 237 void OnSuccessOpenCursor( | 237 void OnSuccessOpenCursor( |
| 238 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p); | 238 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p); |
| 239 void OnSuccessCursorContinue( | 239 void OnSuccessCursorContinue( |
| 240 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p); | 240 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p); |
| 241 void OnSuccessCursorPrefetch( | 241 void OnSuccessCursorPrefetch( |
| 242 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p); | 242 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p); |
| 243 void OnSuccessStringList(int32 thread_id, | 243 void OnSuccessStringList(int32 thread_id, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 269 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> | 269 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> |
| 270 pending_database_callbacks_; | 270 pending_database_callbacks_; |
| 271 | 271 |
| 272 // Map from cursor id to RendererWebIDBCursorImpl. | 272 // Map from cursor id to RendererWebIDBCursorImpl. |
| 273 std::map<int32, RendererWebIDBCursorImpl*> cursors_; | 273 std::map<int32, RendererWebIDBCursorImpl*> cursors_; |
| 274 | 274 |
| 275 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); | 275 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 278 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
| OLD | NEW |