Chromium Code Reviews| 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_CHILD_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 5 #ifndef CONTENT_COMMON_CHILD_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
| 6 #define CONTENT_COMMON_CHILD_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 6 #define CONTENT_COMMON_CHILD_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 | 53 |
| 54 // webkit_glue::WorkerTaskRunner::Observer implementation. | 54 // webkit_glue::WorkerTaskRunner::Observer implementation. |
| 55 virtual void OnWorkerRunLoopStopped() OVERRIDE; | 55 virtual void OnWorkerRunLoopStopped() OVERRIDE; |
| 56 | 56 |
| 57 static WebKit::WebIDBMetadata ConvertMetadata( | 57 static WebKit::WebIDBMetadata ConvertMetadata( |
| 58 const IndexedDBDatabaseMetadata& idb_metadata); | 58 const IndexedDBDatabaseMetadata& idb_metadata); |
| 59 | 59 |
| 60 void OnMessageReceived(const IPC::Message& msg); | 60 void OnMessageReceived(const IPC::Message& msg); |
| 61 static bool Send(IPC::Message* msg); | 61 static bool Send(IPC::Message* msg); |
| 62 | 62 |
| 63 void RequestIDBFactoryGetDatabaseNames( | 63 void RequestIDBFactoryGetDatabaseNames(WebKit::WebIDBCallbacks* callbacks, |
|
jsbell
2013/06/03 17:52:27
This (and subsequent diffs) are c/o clang-format.
| |
| 64 WebKit::WebIDBCallbacks* callbacks, | 64 const string16& database_identifier); |
| 65 const string16& database_identifier); | |
| 66 | 65 |
| 67 void RequestIDBFactoryOpen( | 66 void RequestIDBFactoryOpen( |
| 68 const string16& name, | 67 const string16& name, |
| 69 int64 version, | 68 int64 version, |
| 70 int64 transaction_id, | 69 int64 transaction_id, |
| 71 WebKit::WebIDBCallbacks* callbacks, | 70 WebKit::WebIDBCallbacks* callbacks, |
| 72 WebKit::WebIDBDatabaseCallbacks* database_callbacks, | 71 WebKit::WebIDBDatabaseCallbacks* database_callbacks, |
| 73 const string16& database_identifier); | 72 const string16& database_identifier); |
| 74 | 73 |
| 75 void RequestIDBFactoryDeleteDatabase( | 74 void RequestIDBFactoryDeleteDatabase(const string16& name, |
| 76 const string16& name, | 75 WebKit::WebIDBCallbacks* callbacks, |
| 77 WebKit::WebIDBCallbacks* callbacks, | 76 const string16& database_identifier); |
| 78 const string16& database_identifier); | |
| 79 | 77 |
| 80 void RequestIDBCursorAdvance( | 78 void RequestIDBCursorAdvance(unsigned long count, |
| 81 unsigned long count, | 79 WebKit::WebIDBCallbacks* callbacks_ptr, |
| 82 WebKit::WebIDBCallbacks* callbacks_ptr, | 80 int32 ipc_cursor_id); |
| 83 int32 ipc_cursor_id); | |
| 84 | 81 |
| 85 virtual void RequestIDBCursorContinue( | 82 virtual void RequestIDBCursorContinue(const IndexedDBKey& key, |
| 86 const IndexedDBKey& key, | 83 WebKit::WebIDBCallbacks* callbacks_ptr, |
| 87 WebKit::WebIDBCallbacks* callbacks_ptr, | 84 int32 ipc_cursor_id); |
| 88 int32 ipc_cursor_id); | |
| 89 | 85 |
| 90 virtual void RequestIDBCursorPrefetch( | 86 virtual void RequestIDBCursorPrefetch(int n, |
| 91 int n, | 87 WebKit::WebIDBCallbacks* callbacks_ptr, |
| 92 WebKit::WebIDBCallbacks* callbacks_ptr, | 88 int32 ipc_cursor_id); |
| 93 int32 ipc_cursor_id); | |
| 94 | 89 |
| 95 void RequestIDBCursorPrefetchReset(int used_prefetches, int unused_prefetches, | 90 void RequestIDBCursorPrefetchReset(int used_prefetches, |
| 91 int unused_prefetches, | |
| 96 int32 ipc_cursor_id); | 92 int32 ipc_cursor_id); |
| 97 | 93 |
| 98 void RequestIDBCursorDelete( | 94 void RequestIDBDatabaseClose(int32 ipc_database_id, |
|
jsbell
2013/06/03 17:52:27
This is the only real change in the file.
| |
| 99 WebKit::WebIDBCallbacks* callbacks_ptr, | 95 int32 ipc_database_callbacks_id); |
| 100 int32 ipc_cursor_id); | |
| 101 | |
| 102 void RequestIDBDatabaseClose( | |
| 103 int32 ipc_database_id, | |
| 104 int32 ipc_database_callbacks_id); | |
| 105 | 96 |
| 106 void RequestIDBDatabaseCreateTransaction( | 97 void RequestIDBDatabaseCreateTransaction( |
| 107 int32 ipc_database_id, | 98 int32 ipc_database_id, |
| 108 int64 transaction_id, | 99 int64 transaction_id, |
| 109 WebKit::WebIDBDatabaseCallbacks* database_callbacks_ptr, | 100 WebKit::WebIDBDatabaseCallbacks* database_callbacks_ptr, |
| 110 WebKit::WebVector<long long> object_store_ids, | 101 WebKit::WebVector<long long> object_store_ids, |
| 111 unsigned short mode); | 102 unsigned short mode); |
| 112 | 103 |
| 113 void RequestIDBDatabaseGet( | 104 void RequestIDBDatabaseGet(int32 ipc_database_id, |
| 114 int32 ipc_database_id, | 105 int64 transaction_id, |
| 115 int64 transaction_id, | 106 int64 object_store_id, |
| 116 int64 object_store_id, | 107 int64 index_id, |
| 117 int64 index_id, | 108 const IndexedDBKeyRange& key_range, |
| 118 const IndexedDBKeyRange& key_range, | 109 bool key_only, |
| 119 bool key_only, | 110 WebKit::WebIDBCallbacks* callbacks); |
| 120 WebKit::WebIDBCallbacks* callbacks); | |
| 121 | 111 |
| 122 void RequestIDBDatabasePut( | 112 void RequestIDBDatabasePut( |
| 123 int32 ipc_database_id, | 113 int32 ipc_database_id, |
| 124 int64 transaction_id, | 114 int64 transaction_id, |
| 125 int64 object_store_id, | 115 int64 object_store_id, |
| 126 const WebKit::WebData& value, | 116 const WebKit::WebData& value, |
| 127 const IndexedDBKey& key, | 117 const IndexedDBKey& key, |
| 128 WebKit::WebIDBDatabase::PutMode put_mode, | 118 WebKit::WebIDBDatabase::PutMode put_mode, |
| 129 WebKit::WebIDBCallbacks* callbacks, | 119 WebKit::WebIDBCallbacks* callbacks, |
| 130 const WebKit::WebVector<long long>& index_ids, | 120 const WebKit::WebVector<long long>& index_ids, |
| 131 const WebKit::WebVector<WebKit::WebVector< | 121 const WebKit::WebVector<WebKit::WebVector<WebKit::WebIDBKey> >& |
| 132 WebKit::WebIDBKey> >& index_keys); | 122 index_keys); |
| 133 | 123 |
| 134 void RequestIDBDatabaseOpenCursor( | 124 void RequestIDBDatabaseOpenCursor(int32 ipc_database_id, |
| 135 int32 ipc_database_id, | 125 int64 transaction_id, |
| 136 int64 transaction_id, | 126 int64 object_store_id, |
| 137 int64 object_store_id, | 127 int64 index_id, |
| 138 int64 index_id, | 128 const IndexedDBKeyRange& key_range, |
| 139 const IndexedDBKeyRange& key_range, | 129 unsigned short direction, |
| 140 unsigned short direction, | 130 bool key_only, |
| 141 bool key_only, | 131 WebKit::WebIDBDatabase::TaskType task_type, |
| 142 WebKit::WebIDBDatabase::TaskType task_type, | 132 WebKit::WebIDBCallbacks* callbacks); |
| 143 WebKit::WebIDBCallbacks* callbacks); | |
| 144 | 133 |
| 145 void RequestIDBDatabaseCount( | 134 void RequestIDBDatabaseCount(int32 ipc_database_id, |
| 146 int32 ipc_database_id, | 135 int64 transaction_id, |
| 147 int64 transaction_id, | 136 int64 object_store_id, |
| 148 int64 object_store_id, | 137 int64 index_id, |
| 149 int64 index_id, | 138 const IndexedDBKeyRange& key_range, |
| 150 const IndexedDBKeyRange& key_range, | 139 WebKit::WebIDBCallbacks* callbacks); |
| 151 WebKit::WebIDBCallbacks* callbacks); | |
| 152 | 140 |
| 153 void RequestIDBDatabaseDeleteRange( | 141 void RequestIDBDatabaseDeleteRange(int32 ipc_database_id, |
| 154 int32 ipc_database_id, | 142 int64 transaction_id, |
| 155 int64 transaction_id, | 143 int64 object_store_id, |
| 156 int64 object_store_id, | 144 const IndexedDBKeyRange& key_range, |
| 157 const IndexedDBKeyRange& key_range, | 145 WebKit::WebIDBCallbacks* callbacks); |
| 158 WebKit::WebIDBCallbacks* callbacks); | |
| 159 | 146 |
| 160 void RequestIDBDatabaseClear( | 147 void RequestIDBDatabaseClear(int32 ipc_database_id, |
| 161 int32 ipc_database_id, | 148 int64 transaction_id, |
| 162 int64 transaction_id, | 149 int64 object_store_id, |
| 163 int64 object_store_id, | 150 WebKit::WebIDBCallbacks* callbacks); |
| 164 WebKit::WebIDBCallbacks* callbacks); | |
| 165 | 151 |
| 166 virtual void CursorDestroyed(int32 ipc_cursor_id); | 152 virtual void CursorDestroyed(int32 ipc_cursor_id); |
| 167 void DatabaseDestroyed(int32 ipc_database_id); | 153 void DatabaseDestroyed(int32 ipc_database_id); |
| 168 | 154 |
| 169 private: | 155 private: |
| 170 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); | 156 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); |
| 171 | 157 |
| 172 static int32 CurrentWorkerId() { | 158 static int32 CurrentWorkerId() { |
| 173 return webkit_glue::WorkerTaskRunner::Instance()->CurrentWorkerId(); | 159 return webkit_glue::WorkerTaskRunner::Instance()->CurrentWorkerId(); |
| 174 } | 160 } |
| 175 | 161 |
| 176 template<typename T> | 162 template <typename T> |
| 177 void init_params(T& params, WebKit::WebIDBCallbacks* callbacks_ptr) { | 163 void init_params(T& params, WebKit::WebIDBCallbacks* callbacks_ptr) { |
| 178 scoped_ptr<WebKit::WebIDBCallbacks> callbacks(callbacks_ptr); | 164 scoped_ptr<WebKit::WebIDBCallbacks> callbacks(callbacks_ptr); |
| 179 params.ipc_thread_id = CurrentWorkerId(); | 165 params.ipc_thread_id = CurrentWorkerId(); |
| 180 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); | 166 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| 181 } | 167 } |
| 182 | 168 |
| 183 // IDBCallback message handlers. | 169 // IDBCallback message handlers. |
| 184 void OnSuccessIDBDatabase(int32 ipc_thread_id, | 170 void OnSuccessIDBDatabase(int32 ipc_thread_id, |
| 185 int32 ipc_callbacks_id, | 171 int32 ipc_callbacks_id, |
| 186 int32 ipc_database_callbacks_id, | 172 int32 ipc_database_callbacks_id, |
| 187 int32 ipc_object_id, | 173 int32 ipc_object_id, |
| 188 const IndexedDBDatabaseMetadata& idb_metadata); | 174 const IndexedDBDatabaseMetadata& idb_metadata); |
| 189 void OnSuccessIndexedDBKey(int32 ipc_thread_id, | 175 void OnSuccessIndexedDBKey(int32 ipc_thread_id, |
| 190 int32 ipc_callbacks_id, | 176 int32 ipc_callbacks_id, |
| 191 const IndexedDBKey& key); | 177 const IndexedDBKey& key); |
| 192 | 178 |
| 193 void OnSuccessOpenCursor( | 179 void OnSuccessOpenCursor( |
| 194 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p); | 180 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p); |
| 195 void OnSuccessCursorContinue( | 181 void OnSuccessCursorContinue( |
| 196 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p); | 182 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p); |
| 197 void OnSuccessCursorPrefetch( | 183 void OnSuccessCursorPrefetch( |
| 198 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p); | 184 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p); |
| 199 void OnSuccessStringList(int32 ipc_thread_id, | 185 void OnSuccessStringList(int32 ipc_thread_id, |
| 200 int32 ipc_callbacks_id, | 186 int32 ipc_callbacks_id, |
| 201 const std::vector<string16>& value); | 187 const std::vector<string16>& value); |
| 202 void OnSuccessValue( | 188 void OnSuccessValue(int32 ipc_thread_id, |
| 203 int32 ipc_thread_id, | 189 int32 ipc_callbacks_id, |
| 204 int32 ipc_callbacks_id, | 190 const std::vector<char>& value); |
| 205 const std::vector<char>& value); | 191 void OnSuccessValueWithKey(int32 ipc_thread_id, |
| 206 void OnSuccessValueWithKey( | 192 int32 ipc_callbacks_id, |
| 207 int32 ipc_thread_id, | 193 const std::vector<char>& value, |
| 208 int32 ipc_callbacks_id, | 194 const IndexedDBKey& primary_key, |
| 209 const std::vector<char>& value, | 195 const IndexedDBKeyPath& key_path); |
| 210 const IndexedDBKey& primary_key, | 196 void OnSuccessInteger(int32 ipc_thread_id, |
| 211 const IndexedDBKeyPath& key_path); | 197 int32 ipc_callbacks_id, |
| 212 void OnSuccessInteger( | 198 int64 value); |
| 213 int32 ipc_thread_id, | 199 void OnSuccessUndefined(int32 ipc_thread_id, int32 ipc_callbacks_id); |
| 214 int32 ipc_callbacks_id, | |
| 215 int64 value); | |
| 216 void OnSuccessUndefined( | |
| 217 int32 ipc_thread_id, | |
| 218 int32 ipc_callbacks_id); | |
| 219 void OnError(int32 ipc_thread_id, | 200 void OnError(int32 ipc_thread_id, |
| 220 int32 ipc_callbacks_id, | 201 int32 ipc_callbacks_id, |
| 221 int code, | 202 int code, |
| 222 const string16& message); | 203 const string16& message); |
| 223 void OnIntBlocked(int32 ipc_thread_id, | 204 void OnIntBlocked(int32 ipc_thread_id, |
| 224 int32 ipc_callbacks_id, | 205 int32 ipc_callbacks_id, |
| 225 int64 existing_version); | 206 int64 existing_version); |
| 226 void OnUpgradeNeeded(const IndexedDBMsg_CallbacksUpgradeNeeded_Params& p); | 207 void OnUpgradeNeeded(const IndexedDBMsg_CallbacksUpgradeNeeded_Params& p); |
| 227 void OnAbort(int32 ipc_thread_id, | 208 void OnAbort(int32 ipc_thread_id, |
| 228 int32 ipc_database_id, | 209 int32 ipc_database_id, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 251 std::map<int32, RendererWebIDBCursorImpl*> cursors_; | 232 std::map<int32, RendererWebIDBCursorImpl*> cursors_; |
| 252 | 233 |
| 253 std::map<int32, RendererWebIDBDatabaseImpl*> databases_; | 234 std::map<int32, RendererWebIDBDatabaseImpl*> databases_; |
| 254 | 235 |
| 255 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); | 236 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); |
| 256 }; | 237 }; |
| 257 | 238 |
| 258 } // namespace content | 239 } // namespace content |
| 259 | 240 |
| 260 #endif // CONTENT_COMMON_CHILD_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 241 #endif // CONTENT_COMMON_CHILD_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
| OLD | NEW |