OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void TransactionComplete(int32 transaction_id); | 53 void TransactionComplete(int32 transaction_id); |
54 | 54 |
55 // A shortcut for accessing our context. | 55 // A shortcut for accessing our context. |
56 IndexedDBContext* Context() { | 56 IndexedDBContext* Context() { |
57 return webkit_context_->indexed_db_context(); | 57 return webkit_context_->indexed_db_context(); |
58 } | 58 } |
59 | 59 |
60 // The various IndexedDBCallbacks children call these methods to add the | 60 // The various IndexedDBCallbacks children call these methods to add the |
61 // results into the applicable map. See below for more details. | 61 // results into the applicable map. See below for more details. |
62 int32 Add(WebKit::WebIDBCursor* idb_cursor); | 62 int32 Add(WebKit::WebIDBCursor* idb_cursor); |
63 int32 Add(WebKit::WebIDBDatabase* idb_database, const GURL& origin_url); | 63 int32 Add(WebKit::WebIDBDatabase* idb_database, |
| 64 int32 thread_id, |
| 65 const GURL& origin_url); |
64 int32 Add(WebKit::WebIDBIndex* idb_index); | 66 int32 Add(WebKit::WebIDBIndex* idb_index); |
65 int32 Add(WebKit::WebIDBObjectStore* idb_object_store); | 67 int32 Add(WebKit::WebIDBObjectStore* idb_object_store); |
66 int32 Add(WebKit::WebIDBTransaction* idb_transaction, const GURL& origin_url); | 68 int32 Add(WebKit::WebIDBTransaction* idb_transaction, |
| 69 int32 thread_id, |
| 70 const GURL& origin_url); |
67 int32 Add(WebKit::WebDOMStringList* domStringList); | 71 int32 Add(WebKit::WebDOMStringList* domStringList); |
68 | 72 |
69 WebKit::WebIDBCursor* GetCursorFromId(int32 cursor_id); | 73 WebKit::WebIDBCursor* GetCursorFromId(int32 cursor_id); |
70 | 74 |
71 private: | 75 private: |
72 virtual ~IndexedDBDispatcherHost(); | 76 virtual ~IndexedDBDispatcherHost(); |
73 | 77 |
74 // Message processing. Most of the work is delegated to the dispatcher hosts | 78 // Message processing. Most of the work is delegated to the dispatcher hosts |
75 // below. | 79 // below. |
76 void OnIDBFactoryGetDatabaseNames( | 80 void OnIDBFactoryGetDatabaseNames( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void OnObjectStoreNames(int32 idb_database_id, | 115 void OnObjectStoreNames(int32 idb_database_id, |
112 std::vector<string16>* object_stores); | 116 std::vector<string16>* object_stores); |
113 void OnCreateObjectStore( | 117 void OnCreateObjectStore( |
114 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params, | 118 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params, |
115 int32* object_store_id, WebKit::WebExceptionCode* ec); | 119 int32* object_store_id, WebKit::WebExceptionCode* ec); |
116 void OnDeleteObjectStore(int32 idb_database_id, | 120 void OnDeleteObjectStore(int32 idb_database_id, |
117 const string16& name, | 121 const string16& name, |
118 int32 transaction_id, | 122 int32 transaction_id, |
119 WebKit::WebExceptionCode* ec); | 123 WebKit::WebExceptionCode* ec); |
120 void OnSetVersion(int32 idb_database_id, | 124 void OnSetVersion(int32 idb_database_id, |
| 125 int32 thread_id, |
121 int32 response_id, | 126 int32 response_id, |
122 const string16& version, | 127 const string16& version, |
123 WebKit::WebExceptionCode* ec); | 128 WebKit::WebExceptionCode* ec); |
124 void OnTransaction(int32 idb_database_id, | 129 void OnTransaction(int32 thread_id, |
| 130 int32 idb_database_id, |
125 const std::vector<string16>& names, | 131 const std::vector<string16>& names, |
126 int32 mode, | 132 int32 mode, |
127 int32* idb_transaction_id, | 133 int32* idb_transaction_id, |
128 WebKit::WebExceptionCode* ec); | 134 WebKit::WebExceptionCode* ec); |
129 void OnOpen(int32 idb_database_id, int32 response_id); | 135 void OnOpen(int32 idb_database_id, int32 thread_id, int32 response_id); |
130 void OnClose(int32 idb_database_id); | 136 void OnClose(int32 idb_database_id); |
131 void OnDestroyed(int32 idb_database_id); | 137 void OnDestroyed(int32 idb_database_id); |
132 | 138 |
133 IndexedDBDispatcherHost* parent_; | 139 IndexedDBDispatcherHost* parent_; |
134 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_; | 140 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_; |
135 WebIDBObjectIDToURLMap database_url_map_; | 141 WebIDBObjectIDToURLMap database_url_map_; |
136 }; | 142 }; |
137 | 143 |
138 class IndexDispatcherHost { | 144 class IndexDispatcherHost { |
139 public: | 145 public: |
140 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent); | 146 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent); |
141 ~IndexDispatcherHost(); | 147 ~IndexDispatcherHost(); |
142 | 148 |
143 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); | 149 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); |
144 void Send(IPC::Message* message); | 150 void Send(IPC::Message* message); |
145 | 151 |
146 void OnName(int32 idb_index_id, string16* name); | 152 void OnName(int32 idb_index_id, string16* name); |
147 void OnStoreName(int32 idb_index_id, string16* store_name); | 153 void OnStoreName(int32 idb_index_id, string16* store_name); |
148 void OnKeyPath(int32 idb_index_id, NullableString16* key_path); | 154 void OnKeyPath(int32 idb_index_id, NullableString16* key_path); |
149 void OnUnique(int32 idb_index_id, bool* unique); | 155 void OnUnique(int32 idb_index_id, bool* unique); |
150 void OnOpenObjectCursor( | 156 void OnOpenObjectCursor( |
151 const IndexedDBHostMsg_IndexOpenCursor_Params& params, | 157 const IndexedDBHostMsg_IndexOpenCursor_Params& params, |
152 WebKit::WebExceptionCode* ec); | 158 WebKit::WebExceptionCode* ec); |
153 void OnOpenKeyCursor(const IndexedDBHostMsg_IndexOpenCursor_Params& params, | 159 void OnOpenKeyCursor(const IndexedDBHostMsg_IndexOpenCursor_Params& params, |
154 WebKit::WebExceptionCode* ec); | 160 WebKit::WebExceptionCode* ec); |
155 void OnGetObject(int idb_index_id, | 161 void OnGetObject(int idb_index_id, |
| 162 int32 thread_id, |
156 int32 response_id, | 163 int32 response_id, |
157 const IndexedDBKey& key, | 164 const IndexedDBKey& key, |
158 int32 transaction_id, | 165 int32 transaction_id, |
159 WebKit::WebExceptionCode* ec); | 166 WebKit::WebExceptionCode* ec); |
160 void OnGetKey(int idb_index_id, | 167 void OnGetKey(int idb_index_id, |
| 168 int32 thread_id, |
161 int32 response_id, | 169 int32 response_id, |
162 const IndexedDBKey& key, | 170 const IndexedDBKey& key, |
163 int32 transaction_id, | 171 int32 transaction_id, |
164 WebKit::WebExceptionCode* ec); | 172 WebKit::WebExceptionCode* ec); |
165 void OnDestroyed(int32 idb_index_id); | 173 void OnDestroyed(int32 idb_index_id); |
166 | 174 |
167 IndexedDBDispatcherHost* parent_; | 175 IndexedDBDispatcherHost* parent_; |
168 IDMap<WebKit::WebIDBIndex, IDMapOwnPointer> map_; | 176 IDMap<WebKit::WebIDBIndex, IDMapOwnPointer> map_; |
169 }; | 177 }; |
170 | 178 |
171 class ObjectStoreDispatcherHost { | 179 class ObjectStoreDispatcherHost { |
172 public: | 180 public: |
173 explicit ObjectStoreDispatcherHost(IndexedDBDispatcherHost* parent); | 181 explicit ObjectStoreDispatcherHost(IndexedDBDispatcherHost* parent); |
174 ~ObjectStoreDispatcherHost(); | 182 ~ObjectStoreDispatcherHost(); |
175 | 183 |
176 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); | 184 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); |
177 void Send(IPC::Message* message); | 185 void Send(IPC::Message* message); |
178 | 186 |
179 void OnName(int32 idb_object_store_id, string16* name); | 187 void OnName(int32 idb_object_store_id, string16* name); |
180 void OnKeyPath(int32 idb_object_store_id, NullableString16* keyPath); | 188 void OnKeyPath(int32 idb_object_store_id, NullableString16* keyPath); |
181 void OnIndexNames(int32 idb_object_store_id, | 189 void OnIndexNames(int32 idb_object_store_id, |
182 std::vector<string16>* index_names); | 190 std::vector<string16>* index_names); |
183 void OnGet(int idb_object_store_id, | 191 void OnGet(int idb_object_store_id, |
| 192 int32 thread_id, |
184 int32 response_id, | 193 int32 response_id, |
185 const IndexedDBKey& key, | 194 const IndexedDBKey& key, |
186 int32 transaction_id, | 195 int32 transaction_id, |
187 WebKit::WebExceptionCode* ec); | 196 WebKit::WebExceptionCode* ec); |
188 void OnPut(const IndexedDBHostMsg_ObjectStorePut_Params& params, | 197 void OnPut(const IndexedDBHostMsg_ObjectStorePut_Params& params, |
189 WebKit::WebExceptionCode* ec); | 198 WebKit::WebExceptionCode* ec); |
190 void OnDelete(int idb_object_store_id, | 199 void OnDelete(int idb_object_store_id, |
| 200 int32 thread_id, |
191 int32 response_id, | 201 int32 response_id, |
192 const IndexedDBKey& key, | 202 const IndexedDBKey& key, |
193 int32 transaction_id, | 203 int32 transaction_id, |
194 WebKit::WebExceptionCode* ec); | 204 WebKit::WebExceptionCode* ec); |
195 void OnClear(int idb_object_store_id, | 205 void OnClear(int idb_object_store_id, |
| 206 int32 thread_id, |
196 int32 response_id, | 207 int32 response_id, |
197 int32 transaction_id, | 208 int32 transaction_id, |
198 WebKit::WebExceptionCode* ec); | 209 WebKit::WebExceptionCode* ec); |
199 void OnCreateIndex( | 210 void OnCreateIndex( |
200 const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params, | 211 const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params, |
201 int32* index_id, | 212 int32* index_id, |
202 WebKit::WebExceptionCode* ec); | 213 WebKit::WebExceptionCode* ec); |
203 void OnIndex(int32 idb_object_store_id, | 214 void OnIndex(int32 idb_object_store_id, |
204 const string16& name, | 215 const string16& name, |
205 int32* idb_index_id, | 216 int32* idb_index_id, |
(...skipping 18 matching lines...) Expand all Loading... |
224 | 235 |
225 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); | 236 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); |
226 void Send(IPC::Message* message); | 237 void Send(IPC::Message* message); |
227 | 238 |
228 void OnDirection(int32 idb_object_store_id, int32* direction); | 239 void OnDirection(int32 idb_object_store_id, int32* direction); |
229 void OnKey(int32 idb_object_store_id, IndexedDBKey* key); | 240 void OnKey(int32 idb_object_store_id, IndexedDBKey* key); |
230 void OnPrimaryKey(int32 idb_object_store_id, IndexedDBKey* primary_key); | 241 void OnPrimaryKey(int32 idb_object_store_id, IndexedDBKey* primary_key); |
231 void OnValue(int32 idb_object_store_id, | 242 void OnValue(int32 idb_object_store_id, |
232 content::SerializedScriptValue* script_value); | 243 content::SerializedScriptValue* script_value); |
233 void OnUpdate(int32 idb_object_store_id, | 244 void OnUpdate(int32 idb_object_store_id, |
| 245 int32 thread_id, |
234 int32 response_id, | 246 int32 response_id, |
235 const content::SerializedScriptValue& value, | 247 const content::SerializedScriptValue& value, |
236 WebKit::WebExceptionCode* ec); | 248 WebKit::WebExceptionCode* ec); |
237 void OnContinue(int32 idb_object_store_id, | 249 void OnContinue(int32 idb_object_store_id, |
| 250 int32 thread_id, |
238 int32 response_id, | 251 int32 response_id, |
239 const IndexedDBKey& key, | 252 const IndexedDBKey& key, |
240 WebKit::WebExceptionCode* ec); | 253 WebKit::WebExceptionCode* ec); |
241 void OnPrefetch(int32 idb_cursor_id, | 254 void OnPrefetch(int32 idb_cursor_id, |
| 255 int32 thread_id, |
242 int32 response_id, | 256 int32 response_id, |
243 int n, | 257 int n, |
244 WebKit::WebExceptionCode* ec); | 258 WebKit::WebExceptionCode* ec); |
245 void OnPrefetchReset(int32 idb_cursor_id, int used_prefetches, | 259 void OnPrefetchReset(int32 idb_cursor_id, int used_prefetches, |
246 int unused_prefetches); | 260 int unused_prefetches); |
247 void OnDelete(int32 idb_object_store_id, | 261 void OnDelete(int32 idb_object_store_id, |
| 262 int32 thread_id, |
248 int32 response_id, | 263 int32 response_id, |
249 WebKit::WebExceptionCode* ec); | 264 WebKit::WebExceptionCode* ec); |
250 void OnDestroyed(int32 idb_cursor_id); | 265 void OnDestroyed(int32 idb_cursor_id); |
251 | 266 |
252 IndexedDBDispatcherHost* parent_; | 267 IndexedDBDispatcherHost* parent_; |
253 IDMap<WebKit::WebIDBCursor, IDMapOwnPointer> map_; | 268 IDMap<WebKit::WebIDBCursor, IDMapOwnPointer> map_; |
254 }; | 269 }; |
255 | 270 |
256 class TransactionDispatcherHost { | 271 class TransactionDispatcherHost { |
257 public: | 272 public: |
(...skipping 30 matching lines...) Expand all Loading... |
288 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 303 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
289 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; | 304 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; |
290 | 305 |
291 // Used to dispatch messages to the correct view host. | 306 // Used to dispatch messages to the correct view host. |
292 int process_id_; | 307 int process_id_; |
293 | 308 |
294 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 309 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
295 }; | 310 }; |
296 | 311 |
297 #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 |