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 #include "content/renderer/indexed_db_dispatcher.h" | 5 #include "content/renderer/indexed_db_dispatcher.h" |
6 | 6 |
7 #include "content/common/indexed_db_messages.h" | 7 #include "content/common/indexed_db_messages.h" |
8 #include "content/renderer/render_thread.h" | 8 #include "content/renderer/render_thread_impl.h" |
9 #include "content/renderer/render_view.h" | 9 #include "content/renderer/render_view.h" |
10 #include "content/renderer/renderer_webidbcursor_impl.h" | 10 #include "content/renderer/renderer_webidbcursor_impl.h" |
11 #include "content/renderer/renderer_webidbdatabase_impl.h" | 11 #include "content/renderer/renderer_webidbdatabase_impl.h" |
12 #include "content/renderer/renderer_webidbindex_impl.h" | 12 #include "content/renderer/renderer_webidbindex_impl.h" |
13 #include "content/renderer/renderer_webidbobjectstore_impl.h" | 13 #include "content/renderer/renderer_webidbobjectstore_impl.h" |
14 #include "content/renderer/renderer_webidbtransaction_impl.h" | 14 #include "content/renderer/renderer_webidbtransaction_impl.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac
ks.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac
ks.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h
" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h
" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 void IndexedDBDispatcher::RequestIDBCursorUpdate( | 66 void IndexedDBDispatcher::RequestIDBCursorUpdate( |
67 const SerializedScriptValue& value, | 67 const SerializedScriptValue& value, |
68 WebIDBCallbacks* callbacks_ptr, | 68 WebIDBCallbacks* callbacks_ptr, |
69 int32 idb_cursor_id, | 69 int32 idb_cursor_id, |
70 WebExceptionCode* ec) { | 70 WebExceptionCode* ec) { |
71 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 71 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
72 | 72 |
73 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 73 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
74 RenderThread::current()->Send( | 74 RenderThreadImpl::current()->Send( |
75 new IndexedDBHostMsg_CursorUpdate(idb_cursor_id, response_id, value, ec)); | 75 new IndexedDBHostMsg_CursorUpdate(idb_cursor_id, response_id, value, ec)); |
76 if (*ec) | 76 if (*ec) |
77 pending_callbacks_.Remove(response_id); | 77 pending_callbacks_.Remove(response_id); |
78 } | 78 } |
79 | 79 |
80 void IndexedDBDispatcher::RequestIDBCursorContinue( | 80 void IndexedDBDispatcher::RequestIDBCursorContinue( |
81 const IndexedDBKey& key, | 81 const IndexedDBKey& key, |
82 WebIDBCallbacks* callbacks_ptr, | 82 WebIDBCallbacks* callbacks_ptr, |
83 int32 idb_cursor_id, | 83 int32 idb_cursor_id, |
84 WebExceptionCode* ec) { | 84 WebExceptionCode* ec) { |
85 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 85 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
86 | 86 |
87 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 87 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
88 RenderThread::current()->Send( | 88 RenderThreadImpl::current()->Send( |
89 new IndexedDBHostMsg_CursorContinue(idb_cursor_id, response_id, key, ec)); | 89 new IndexedDBHostMsg_CursorContinue(idb_cursor_id, response_id, key, ec)); |
90 if (*ec) | 90 if (*ec) |
91 pending_callbacks_.Remove(response_id); | 91 pending_callbacks_.Remove(response_id); |
92 } | 92 } |
93 | 93 |
94 void IndexedDBDispatcher::RequestIDBCursorDelete( | 94 void IndexedDBDispatcher::RequestIDBCursorDelete( |
95 WebIDBCallbacks* callbacks_ptr, | 95 WebIDBCallbacks* callbacks_ptr, |
96 int32 idb_cursor_id, | 96 int32 idb_cursor_id, |
97 WebExceptionCode* ec) { | 97 WebExceptionCode* ec) { |
98 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 98 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
99 | 99 |
100 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 100 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
101 RenderThread::current()->Send( | 101 RenderThreadImpl::current()->Send( |
102 new IndexedDBHostMsg_CursorDelete(idb_cursor_id, response_id, ec)); | 102 new IndexedDBHostMsg_CursorDelete(idb_cursor_id, response_id, ec)); |
103 if (*ec) | 103 if (*ec) |
104 pending_callbacks_.Remove(response_id); | 104 pending_callbacks_.Remove(response_id); |
105 } | 105 } |
106 | 106 |
107 void IndexedDBDispatcher::RequestIDBFactoryOpen( | 107 void IndexedDBDispatcher::RequestIDBFactoryOpen( |
108 const string16& name, | 108 const string16& name, |
109 WebIDBCallbacks* callbacks_ptr, | 109 WebIDBCallbacks* callbacks_ptr, |
110 const string16& origin, | 110 const string16& origin, |
111 WebFrame* web_frame) { | 111 WebFrame* web_frame) { |
112 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 112 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
113 | 113 |
114 if (!web_frame) | 114 if (!web_frame) |
115 return; // We must be shutting down. | 115 return; // We must be shutting down. |
116 RenderView* render_view = RenderView::FromWebView(web_frame->view()); | 116 RenderView* render_view = RenderView::FromWebView(web_frame->view()); |
117 if (!render_view) | 117 if (!render_view) |
118 return; // We must be shutting down. | 118 return; // We must be shutting down. |
119 | 119 |
120 IndexedDBHostMsg_FactoryOpen_Params params; | 120 IndexedDBHostMsg_FactoryOpen_Params params; |
121 params.routing_id = render_view->routing_id(); | 121 params.routing_id = render_view->routing_id(); |
122 params.response_id = pending_callbacks_.Add(callbacks.release()); | 122 params.response_id = pending_callbacks_.Add(callbacks.release()); |
123 params.origin = origin; | 123 params.origin = origin; |
124 params.name = name; | 124 params.name = name; |
125 RenderThread::current()->Send(new IndexedDBHostMsg_FactoryOpen(params)); | 125 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_FactoryOpen(params)); |
126 } | 126 } |
127 | 127 |
128 void IndexedDBDispatcher::RequestIDBFactoryGetDatabaseNames( | 128 void IndexedDBDispatcher::RequestIDBFactoryGetDatabaseNames( |
129 WebIDBCallbacks* callbacks_ptr, | 129 WebIDBCallbacks* callbacks_ptr, |
130 const string16& origin, | 130 const string16& origin, |
131 WebFrame* web_frame) { | 131 WebFrame* web_frame) { |
132 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 132 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
133 | 133 |
134 if (!web_frame) | 134 if (!web_frame) |
135 return; // We must be shutting down. | 135 return; // We must be shutting down. |
136 RenderView* render_view = RenderView::FromWebView(web_frame->view()); | 136 RenderView* render_view = RenderView::FromWebView(web_frame->view()); |
137 if (!render_view) | 137 if (!render_view) |
138 return; // We must be shutting down. | 138 return; // We must be shutting down. |
139 | 139 |
140 IndexedDBHostMsg_FactoryGetDatabaseNames_Params params; | 140 IndexedDBHostMsg_FactoryGetDatabaseNames_Params params; |
141 params.routing_id = render_view->routing_id(); | 141 params.routing_id = render_view->routing_id(); |
142 params.response_id = pending_callbacks_.Add(callbacks.release()); | 142 params.response_id = pending_callbacks_.Add(callbacks.release()); |
143 params.origin = origin; | 143 params.origin = origin; |
144 RenderThread::current()->Send( | 144 RenderThreadImpl::current()->Send( |
145 new IndexedDBHostMsg_FactoryGetDatabaseNames(params)); | 145 new IndexedDBHostMsg_FactoryGetDatabaseNames(params)); |
146 } | 146 } |
147 | 147 |
148 void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase( | 148 void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase( |
149 const string16& name, | 149 const string16& name, |
150 WebIDBCallbacks* callbacks_ptr, | 150 WebIDBCallbacks* callbacks_ptr, |
151 const string16& origin, | 151 const string16& origin, |
152 WebFrame* web_frame) { | 152 WebFrame* web_frame) { |
153 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 153 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
154 | 154 |
155 if (!web_frame) | 155 if (!web_frame) |
156 return; // We must be shutting down. | 156 return; // We must be shutting down. |
157 RenderView* render_view = RenderView::FromWebView(web_frame->view()); | 157 RenderView* render_view = RenderView::FromWebView(web_frame->view()); |
158 if (!render_view) | 158 if (!render_view) |
159 return; // We must be shutting down. | 159 return; // We must be shutting down. |
160 | 160 |
161 IndexedDBHostMsg_FactoryDeleteDatabase_Params params; | 161 IndexedDBHostMsg_FactoryDeleteDatabase_Params params; |
162 params.routing_id = render_view->routing_id(); | 162 params.routing_id = render_view->routing_id(); |
163 params.response_id = pending_callbacks_.Add(callbacks.release()); | 163 params.response_id = pending_callbacks_.Add(callbacks.release()); |
164 params.origin = origin; | 164 params.origin = origin; |
165 params.name = name; | 165 params.name = name; |
166 RenderThread::current()->Send( | 166 RenderThreadImpl::current()->Send( |
167 new IndexedDBHostMsg_FactoryDeleteDatabase(params)); | 167 new IndexedDBHostMsg_FactoryDeleteDatabase(params)); |
168 } | 168 } |
169 | 169 |
170 void IndexedDBDispatcher::RequestIDBDatabaseClose(int32 idb_database_id) { | 170 void IndexedDBDispatcher::RequestIDBDatabaseClose(int32 idb_database_id) { |
171 RenderThread::current()->Send( | 171 RenderThreadImpl::current()->Send( |
172 new IndexedDBHostMsg_DatabaseClose(idb_database_id)); | 172 new IndexedDBHostMsg_DatabaseClose(idb_database_id)); |
173 pending_database_callbacks_.Remove(idb_database_id); | 173 pending_database_callbacks_.Remove(idb_database_id); |
174 } | 174 } |
175 | 175 |
176 void IndexedDBDispatcher::RequestIDBDatabaseOpen( | 176 void IndexedDBDispatcher::RequestIDBDatabaseOpen( |
177 WebIDBDatabaseCallbacks* callbacks_ptr, | 177 WebIDBDatabaseCallbacks* callbacks_ptr, |
178 int32 idb_database_id) { | 178 int32 idb_database_id) { |
179 scoped_ptr<WebIDBDatabaseCallbacks> callbacks(callbacks_ptr); | 179 scoped_ptr<WebIDBDatabaseCallbacks> callbacks(callbacks_ptr); |
180 | 180 |
181 int32 response_id = pending_database_callbacks_.Add(callbacks.release()); | 181 int32 response_id = pending_database_callbacks_.Add(callbacks.release()); |
182 RenderThread::current()->Send(new IndexedDBHostMsg_DatabaseOpen(response_id, | 182 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_DatabaseOpen( |
183 idb_database_id)); | 183 response_id, idb_database_id)); |
184 } | 184 } |
185 | 185 |
186 void IndexedDBDispatcher::RequestIDBDatabaseSetVersion( | 186 void IndexedDBDispatcher::RequestIDBDatabaseSetVersion( |
187 const string16& version, | 187 const string16& version, |
188 WebIDBCallbacks* callbacks_ptr, | 188 WebIDBCallbacks* callbacks_ptr, |
189 int32 idb_database_id, | 189 int32 idb_database_id, |
190 WebExceptionCode* ec) { | 190 WebExceptionCode* ec) { |
191 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 191 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
192 | 192 |
193 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 193 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
194 RenderThread::current()->Send( | 194 RenderThreadImpl::current()->Send( |
195 new IndexedDBHostMsg_DatabaseSetVersion(idb_database_id, response_id, | 195 new IndexedDBHostMsg_DatabaseSetVersion(idb_database_id, response_id, |
196 version, ec)); | 196 version, ec)); |
197 if (*ec) | 197 if (*ec) |
198 pending_callbacks_.Remove(response_id); | 198 pending_callbacks_.Remove(response_id); |
199 } | 199 } |
200 | 200 |
201 void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( | 201 void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( |
202 const WebIDBKeyRange& idb_key_range, | 202 const WebIDBKeyRange& idb_key_range, |
203 unsigned short direction, | 203 unsigned short direction, |
204 WebIDBCallbacks* callbacks_ptr, | 204 WebIDBCallbacks* callbacks_ptr, |
205 int32 idb_index_id, | 205 int32 idb_index_id, |
206 const WebIDBTransaction& transaction, | 206 const WebIDBTransaction& transaction, |
207 WebExceptionCode* ec) { | 207 WebExceptionCode* ec) { |
208 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 208 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
209 IndexedDBHostMsg_IndexOpenCursor_Params params; | 209 IndexedDBHostMsg_IndexOpenCursor_Params params; |
210 params.response_id = pending_callbacks_.Add(callbacks.release()); | 210 params.response_id = pending_callbacks_.Add(callbacks.release()); |
211 params.lower_key.Set(idb_key_range.lower()); | 211 params.lower_key.Set(idb_key_range.lower()); |
212 params.upper_key.Set(idb_key_range.upper()); | 212 params.upper_key.Set(idb_key_range.upper()); |
213 params.lower_open = idb_key_range.lowerOpen(); | 213 params.lower_open = idb_key_range.lowerOpen(); |
214 params.upper_open = idb_key_range.upperOpen(); | 214 params.upper_open = idb_key_range.upperOpen(); |
215 params.direction = direction; | 215 params.direction = direction; |
216 params.idb_index_id = idb_index_id; | 216 params.idb_index_id = idb_index_id; |
217 params.transaction_id = TransactionId(transaction); | 217 params.transaction_id = TransactionId(transaction); |
218 RenderThread::current()->Send( | 218 RenderThreadImpl::current()->Send( |
219 new IndexedDBHostMsg_IndexOpenObjectCursor(params, ec)); | 219 new IndexedDBHostMsg_IndexOpenObjectCursor(params, ec)); |
220 if (*ec) | 220 if (*ec) |
221 pending_callbacks_.Remove(params.response_id); | 221 pending_callbacks_.Remove(params.response_id); |
222 } | 222 } |
223 | 223 |
224 void IndexedDBDispatcher::RequestIDBIndexOpenKeyCursor( | 224 void IndexedDBDispatcher::RequestIDBIndexOpenKeyCursor( |
225 const WebIDBKeyRange& idb_key_range, | 225 const WebIDBKeyRange& idb_key_range, |
226 unsigned short direction, | 226 unsigned short direction, |
227 WebIDBCallbacks* callbacks_ptr, | 227 WebIDBCallbacks* callbacks_ptr, |
228 int32 idb_index_id, | 228 int32 idb_index_id, |
229 const WebIDBTransaction& transaction, | 229 const WebIDBTransaction& transaction, |
230 WebExceptionCode* ec) { | 230 WebExceptionCode* ec) { |
231 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 231 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
232 IndexedDBHostMsg_IndexOpenCursor_Params params; | 232 IndexedDBHostMsg_IndexOpenCursor_Params params; |
233 params.response_id = pending_callbacks_.Add(callbacks.release()); | 233 params.response_id = pending_callbacks_.Add(callbacks.release()); |
234 // TODO(jorlow): We really should just create a Chromium abstraction for | 234 // TODO(jorlow): We really should just create a Chromium abstraction for |
235 // KeyRange rather than doing it ad-hoc like this. | 235 // KeyRange rather than doing it ad-hoc like this. |
236 params.lower_key.Set(idb_key_range.lower()); | 236 params.lower_key.Set(idb_key_range.lower()); |
237 params.upper_key.Set(idb_key_range.upper()); | 237 params.upper_key.Set(idb_key_range.upper()); |
238 params.lower_open = idb_key_range.lowerOpen(); | 238 params.lower_open = idb_key_range.lowerOpen(); |
239 params.upper_open = idb_key_range.upperOpen(); | 239 params.upper_open = idb_key_range.upperOpen(); |
240 params.direction = direction; | 240 params.direction = direction; |
241 params.idb_index_id = idb_index_id; | 241 params.idb_index_id = idb_index_id; |
242 params.transaction_id = TransactionId(transaction); | 242 params.transaction_id = TransactionId(transaction); |
243 RenderThread::current()->Send( | 243 RenderThreadImpl::current()->Send( |
244 new IndexedDBHostMsg_IndexOpenKeyCursor(params, ec)); | 244 new IndexedDBHostMsg_IndexOpenKeyCursor(params, ec)); |
245 if (*ec) | 245 if (*ec) |
246 pending_callbacks_.Remove(params.response_id); | 246 pending_callbacks_.Remove(params.response_id); |
247 } | 247 } |
248 | 248 |
249 void IndexedDBDispatcher::RequestIDBIndexGetObject( | 249 void IndexedDBDispatcher::RequestIDBIndexGetObject( |
250 const IndexedDBKey& key, | 250 const IndexedDBKey& key, |
251 WebIDBCallbacks* callbacks_ptr, | 251 WebIDBCallbacks* callbacks_ptr, |
252 int32 idb_index_id, | 252 int32 idb_index_id, |
253 const WebIDBTransaction& transaction, | 253 const WebIDBTransaction& transaction, |
254 WebExceptionCode* ec) { | 254 WebExceptionCode* ec) { |
255 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 255 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
256 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 256 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
257 RenderThread::current()->Send( | 257 RenderThreadImpl::current()->Send( |
258 new IndexedDBHostMsg_IndexGetObject( | 258 new IndexedDBHostMsg_IndexGetObject( |
259 idb_index_id, response_id, key, | 259 idb_index_id, response_id, key, |
260 TransactionId(transaction), ec)); | 260 TransactionId(transaction), ec)); |
261 if (*ec) | 261 if (*ec) |
262 pending_callbacks_.Remove(response_id); | 262 pending_callbacks_.Remove(response_id); |
263 } | 263 } |
264 | 264 |
265 void IndexedDBDispatcher::RequestIDBIndexGetKey( | 265 void IndexedDBDispatcher::RequestIDBIndexGetKey( |
266 const IndexedDBKey& key, | 266 const IndexedDBKey& key, |
267 WebIDBCallbacks* callbacks_ptr, | 267 WebIDBCallbacks* callbacks_ptr, |
268 int32 idb_index_id, | 268 int32 idb_index_id, |
269 const WebIDBTransaction& transaction, | 269 const WebIDBTransaction& transaction, |
270 WebExceptionCode* ec) { | 270 WebExceptionCode* ec) { |
271 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 271 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
272 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 272 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
273 RenderThread::current()->Send( | 273 RenderThreadImpl::current()->Send( |
274 new IndexedDBHostMsg_IndexGetKey( | 274 new IndexedDBHostMsg_IndexGetKey( |
275 idb_index_id, response_id, key, | 275 idb_index_id, response_id, key, |
276 TransactionId(transaction), ec)); | 276 TransactionId(transaction), ec)); |
277 if (*ec) | 277 if (*ec) |
278 pending_callbacks_.Remove(response_id); | 278 pending_callbacks_.Remove(response_id); |
279 } | 279 } |
280 | 280 |
281 void IndexedDBDispatcher::RequestIDBObjectStoreGet( | 281 void IndexedDBDispatcher::RequestIDBObjectStoreGet( |
282 const IndexedDBKey& key, | 282 const IndexedDBKey& key, |
283 WebIDBCallbacks* callbacks_ptr, | 283 WebIDBCallbacks* callbacks_ptr, |
284 int32 idb_object_store_id, | 284 int32 idb_object_store_id, |
285 const WebIDBTransaction& transaction, | 285 const WebIDBTransaction& transaction, |
286 WebExceptionCode* ec) { | 286 WebExceptionCode* ec) { |
287 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 287 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
288 | 288 |
289 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 289 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
290 RenderThread::current()->Send( | 290 RenderThreadImpl::current()->Send( |
291 new IndexedDBHostMsg_ObjectStoreGet( | 291 new IndexedDBHostMsg_ObjectStoreGet( |
292 idb_object_store_id, response_id, | 292 idb_object_store_id, response_id, |
293 key, TransactionId(transaction), ec)); | 293 key, TransactionId(transaction), ec)); |
294 if (*ec) | 294 if (*ec) |
295 pending_callbacks_.Remove(response_id); | 295 pending_callbacks_.Remove(response_id); |
296 } | 296 } |
297 | 297 |
298 void IndexedDBDispatcher::RequestIDBObjectStorePut( | 298 void IndexedDBDispatcher::RequestIDBObjectStorePut( |
299 const SerializedScriptValue& value, | 299 const SerializedScriptValue& value, |
300 const IndexedDBKey& key, | 300 const IndexedDBKey& key, |
301 WebKit::WebIDBObjectStore::PutMode put_mode, | 301 WebKit::WebIDBObjectStore::PutMode put_mode, |
302 WebIDBCallbacks* callbacks_ptr, | 302 WebIDBCallbacks* callbacks_ptr, |
303 int32 idb_object_store_id, | 303 int32 idb_object_store_id, |
304 const WebIDBTransaction& transaction, | 304 const WebIDBTransaction& transaction, |
305 WebExceptionCode* ec) { | 305 WebExceptionCode* ec) { |
306 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 306 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
307 IndexedDBHostMsg_ObjectStorePut_Params params; | 307 IndexedDBHostMsg_ObjectStorePut_Params params; |
308 params.idb_object_store_id = idb_object_store_id; | 308 params.idb_object_store_id = idb_object_store_id; |
309 params.response_id = pending_callbacks_.Add(callbacks.release()); | 309 params.response_id = pending_callbacks_.Add(callbacks.release()); |
310 params.serialized_value = value; | 310 params.serialized_value = value; |
311 params.key = key; | 311 params.key = key; |
312 params.put_mode = put_mode; | 312 params.put_mode = put_mode; |
313 params.transaction_id = TransactionId(transaction); | 313 params.transaction_id = TransactionId(transaction); |
314 RenderThread::current()->Send(new IndexedDBHostMsg_ObjectStorePut( | 314 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_ObjectStorePut( |
315 params, ec)); | 315 params, ec)); |
316 if (*ec) | 316 if (*ec) |
317 pending_callbacks_.Remove(params.response_id); | 317 pending_callbacks_.Remove(params.response_id); |
318 } | 318 } |
319 | 319 |
320 void IndexedDBDispatcher::RequestIDBObjectStoreDelete( | 320 void IndexedDBDispatcher::RequestIDBObjectStoreDelete( |
321 const IndexedDBKey& key, | 321 const IndexedDBKey& key, |
322 WebIDBCallbacks* callbacks_ptr, | 322 WebIDBCallbacks* callbacks_ptr, |
323 int32 idb_object_store_id, | 323 int32 idb_object_store_id, |
324 const WebIDBTransaction& transaction, | 324 const WebIDBTransaction& transaction, |
325 WebExceptionCode* ec) { | 325 WebExceptionCode* ec) { |
326 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 326 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
327 | 327 |
328 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 328 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
329 RenderThread::current()->Send( | 329 RenderThreadImpl::current()->Send( |
330 new IndexedDBHostMsg_ObjectStoreDelete( | 330 new IndexedDBHostMsg_ObjectStoreDelete( |
331 idb_object_store_id, response_id, | 331 idb_object_store_id, response_id, |
332 key, TransactionId(transaction), ec)); | 332 key, TransactionId(transaction), ec)); |
333 if (*ec) | 333 if (*ec) |
334 pending_callbacks_.Remove(response_id); | 334 pending_callbacks_.Remove(response_id); |
335 } | 335 } |
336 | 336 |
337 void IndexedDBDispatcher::RequestIDBObjectStoreClear( | 337 void IndexedDBDispatcher::RequestIDBObjectStoreClear( |
338 WebIDBCallbacks* callbacks_ptr, | 338 WebIDBCallbacks* callbacks_ptr, |
339 int32 idb_object_store_id, | 339 int32 idb_object_store_id, |
340 const WebIDBTransaction& transaction, | 340 const WebIDBTransaction& transaction, |
341 WebExceptionCode* ec) { | 341 WebExceptionCode* ec) { |
342 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 342 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
343 | 343 |
344 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 344 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
345 RenderThread::current()->Send( | 345 RenderThreadImpl::current()->Send( |
346 new IndexedDBHostMsg_ObjectStoreClear( | 346 new IndexedDBHostMsg_ObjectStoreClear( |
347 idb_object_store_id, response_id, | 347 idb_object_store_id, response_id, |
348 TransactionId(transaction), ec)); | 348 TransactionId(transaction), ec)); |
349 if (*ec) | 349 if (*ec) |
350 pending_callbacks_.Remove(response_id); | 350 pending_callbacks_.Remove(response_id); |
351 } | 351 } |
352 | 352 |
353 void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( | 353 void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( |
354 const WebIDBKeyRange& idb_key_range, | 354 const WebIDBKeyRange& idb_key_range, |
355 unsigned short direction, | 355 unsigned short direction, |
356 WebIDBCallbacks* callbacks_ptr, | 356 WebIDBCallbacks* callbacks_ptr, |
357 int32 idb_object_store_id, | 357 int32 idb_object_store_id, |
358 const WebIDBTransaction& transaction, | 358 const WebIDBTransaction& transaction, |
359 WebExceptionCode* ec) { | 359 WebExceptionCode* ec) { |
360 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 360 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
361 IndexedDBHostMsg_ObjectStoreOpenCursor_Params params; | 361 IndexedDBHostMsg_ObjectStoreOpenCursor_Params params; |
362 params.response_id = pending_callbacks_.Add(callbacks.release()); | 362 params.response_id = pending_callbacks_.Add(callbacks.release()); |
363 params.lower_key.Set(idb_key_range.lower()); | 363 params.lower_key.Set(idb_key_range.lower()); |
364 params.upper_key.Set(idb_key_range.upper()); | 364 params.upper_key.Set(idb_key_range.upper()); |
365 params.lower_open = idb_key_range.lowerOpen(); | 365 params.lower_open = idb_key_range.lowerOpen(); |
366 params.upper_open = idb_key_range.upperOpen(); | 366 params.upper_open = idb_key_range.upperOpen(); |
367 params.direction = direction; | 367 params.direction = direction; |
368 params.idb_object_store_id = idb_object_store_id; | 368 params.idb_object_store_id = idb_object_store_id; |
369 params.transaction_id = TransactionId(transaction); | 369 params.transaction_id = TransactionId(transaction); |
370 RenderThread::current()->Send( | 370 RenderThreadImpl::current()->Send( |
371 new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec)); | 371 new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec)); |
372 if (*ec) | 372 if (*ec) |
373 pending_callbacks_.Remove(params.response_id); | 373 pending_callbacks_.Remove(params.response_id); |
374 } | 374 } |
375 | 375 |
376 void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks( | 376 void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks( |
377 WebIDBTransactionCallbacks* callbacks, | 377 WebIDBTransactionCallbacks* callbacks, |
378 int32 id) { | 378 int32 id) { |
379 pending_transaction_callbacks_.AddWithID(callbacks, id); | 379 pending_transaction_callbacks_.AddWithID(callbacks, id); |
380 } | 380 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 461 |
462 void IndexedDBDispatcher::OnVersionChange(int32 database_id, | 462 void IndexedDBDispatcher::OnVersionChange(int32 database_id, |
463 const string16& newVersion) { | 463 const string16& newVersion) { |
464 WebIDBDatabaseCallbacks* callbacks = | 464 WebIDBDatabaseCallbacks* callbacks = |
465 pending_database_callbacks_.Lookup(database_id); | 465 pending_database_callbacks_.Lookup(database_id); |
466 // callbacks would be NULL if a versionchange event is received after close | 466 // callbacks would be NULL if a versionchange event is received after close |
467 // has been called. | 467 // has been called. |
468 if (callbacks) | 468 if (callbacks) |
469 callbacks->onVersionChange(newVersion); | 469 callbacks->onVersionChange(newVersion); |
470 } | 470 } |
OLD | NEW |