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 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 int32 ipc_cursor_id); | 110 int32 ipc_cursor_id); |
111 | 111 |
112 void RequestIDBCursorDelete( | 112 void RequestIDBCursorDelete( |
113 WebKit::WebIDBCallbacks* callbacks_ptr, | 113 WebKit::WebIDBCallbacks* callbacks_ptr, |
114 int32 ipc_cursor_id, | 114 int32 ipc_cursor_id, |
115 WebKit::WebExceptionCode* ec); | 115 WebKit::WebExceptionCode* ec); |
116 | 116 |
117 void RequestIDBDatabaseClose( | 117 void RequestIDBDatabaseClose( |
118 int32 ipc_database_id); | 118 int32 ipc_database_id); |
119 | 119 |
| 120 void RequestIDBDatabaseGet( |
| 121 int32 ipc_database_id, |
| 122 int64 transaction_id, |
| 123 int64 object_store_id, |
| 124 int64 index_id, |
| 125 const IndexedDBKeyRange& key_range, |
| 126 bool key_only, |
| 127 WebKit::WebIDBCallbacks* callbacks); |
| 128 |
| 129 void RequestIDBDatabasePut( |
| 130 int32 ipc_database_id, |
| 131 int64 transaction_id, |
| 132 int64 object_store_id, |
| 133 WebKit::WebVector<unsigned char>* value, |
| 134 const IndexedDBKey& key, |
| 135 WebKit::WebIDBDatabase::PutMode put_mode, |
| 136 WebKit::WebIDBCallbacks* callbacks, |
| 137 const WebKit::WebVector<long long>& index_ids, |
| 138 const WebKit::WebVector<WebKit::WebVector< |
| 139 WebKit::WebIDBKey> >& index_keys); |
| 140 |
| 141 void RequestIDBDatabaseOpenCursor( |
| 142 int32 ipc_database_id, |
| 143 int64 transaction_id, |
| 144 int64 object_store_id, |
| 145 int64 index_id, |
| 146 const IndexedDBKeyRange& key_range, |
| 147 unsigned short direction, |
| 148 bool key_only, |
| 149 WebKit::WebIDBDatabase::TaskType task_type, |
| 150 WebKit::WebIDBCallbacks* callbacks); |
| 151 |
| 152 void RequestIDBDatabaseCount( |
| 153 int32 ipc_database_id, |
| 154 int64 transaction_id, |
| 155 int64 object_store_id, |
| 156 int64 index_id, |
| 157 const IndexedDBKeyRange& key_range, |
| 158 WebKit::WebIDBCallbacks* callbacks); |
| 159 |
| 160 void RequestIDBDatabaseDeleteRange( |
| 161 int32 ipc_database_id, |
| 162 int64 transaction_id, |
| 163 int64 object_store_id, |
| 164 const IndexedDBKeyRange& key_range, |
| 165 WebKit::WebIDBCallbacks* callbacks); |
| 166 |
| 167 void RequestIDBDatabaseClear( |
| 168 int32 ipc_database_id, |
| 169 int64 transaction_id, |
| 170 int64 object_store_id, |
| 171 WebKit::WebIDBCallbacks* callbacks); |
| 172 |
120 void RequestIDBIndexOpenObjectCursor( | 173 void RequestIDBIndexOpenObjectCursor( |
121 const WebKit::WebIDBKeyRange& idb_key_range, | 174 const WebKit::WebIDBKeyRange& idb_key_range, |
122 unsigned short direction, | 175 unsigned short direction, |
123 WebKit::WebIDBCallbacks* callbacks, | 176 WebKit::WebIDBCallbacks* callbacks, |
124 int32 ipc_index_id, | 177 int32 ipc_index_id, |
125 const WebKit::WebIDBTransaction& transaction, | 178 const WebKit::WebIDBTransaction& transaction, |
126 WebKit::WebExceptionCode* ec); | 179 WebKit::WebExceptionCode* ec); |
127 | 180 |
128 void RequestIDBIndexOpenKeyCursor( | 181 void RequestIDBIndexOpenKeyCursor( |
129 const WebKit::WebIDBKeyRange& idb_key_range, | 182 const WebKit::WebIDBKeyRange& idb_key_range, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 int32 id); | 259 int32 id); |
207 | 260 |
208 void CursorDestroyed(int32 ipc_cursor_id); | 261 void CursorDestroyed(int32 ipc_cursor_id); |
209 void DatabaseDestroyed(int32 ipc_database_id); | 262 void DatabaseDestroyed(int32 ipc_database_id); |
210 | 263 |
211 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); | 264 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); |
212 | 265 |
213 private: | 266 private: |
214 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); | 267 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); |
215 | 268 |
| 269 static int32 CurrentWorkerId() { |
| 270 return webkit_glue::WorkerTaskRunner::Instance()->CurrentWorkerId(); |
| 271 } |
| 272 |
| 273 template<typename T> |
| 274 void init_params(T& params, WebKit::WebIDBCallbacks* callbacks_ptr) { |
| 275 scoped_ptr<WebKit::WebIDBCallbacks> callbacks(callbacks_ptr); |
| 276 params.ipc_thread_id = CurrentWorkerId(); |
| 277 params.ipc_response_id = pending_callbacks_.Add(callbacks.release()); |
| 278 } |
| 279 |
216 // IDBCallback message handlers. | 280 // IDBCallback message handlers. |
217 void OnSuccessIDBDatabase(int32 ipc_thread_id, | 281 void OnSuccessIDBDatabase(int32 ipc_thread_id, |
218 int32 ipc_response_id, | 282 int32 ipc_response_id, |
219 int32 ipc_object_id); | 283 int32 ipc_object_id); |
220 void OnSuccessIndexedDBKey(int32 ipc_thread_id, | 284 void OnSuccessIndexedDBKey(int32 ipc_thread_id, |
221 int32 ipc_response_id, | 285 int32 ipc_response_id, |
222 const IndexedDBKey& key); | 286 const IndexedDBKey& key); |
223 void OnSuccessOpenCursor( | 287 void OnSuccessOpenCursor( |
224 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p); | 288 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p); |
225 void OnSuccessCursorContinue( | 289 void OnSuccessCursorContinue( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 std::map<int32, RendererWebIDBCursorImpl*> cursors_; | 351 std::map<int32, RendererWebIDBCursorImpl*> cursors_; |
288 | 352 |
289 std::map<int32, RendererWebIDBDatabaseImpl*> databases_; | 353 std::map<int32, RendererWebIDBDatabaseImpl*> databases_; |
290 | 354 |
291 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); | 355 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); |
292 }; | 356 }; |
293 | 357 |
294 } // namespace content | 358 } // namespace content |
295 | 359 |
296 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 360 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
OLD | NEW |