Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: content/browser/in_process_webkit/indexed_db_dispatcher_host.cc

Issue 8879013: Deprecate WEBKIT thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update after rebase Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/in_process_webkit/indexed_db_dispatcher_host.h" 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" 10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 using WebKit::WebIDBObjectStore; 45 using WebKit::WebIDBObjectStore;
46 using WebKit::WebIDBTransaction; 46 using WebKit::WebIDBTransaction;
47 using WebKit::WebSecurityOrigin; 47 using WebKit::WebSecurityOrigin;
48 using WebKit::WebSerializedScriptValue; 48 using WebKit::WebSerializedScriptValue;
49 using WebKit::WebVector; 49 using WebKit::WebVector;
50 50
51 namespace { 51 namespace {
52 52
53 template <class T> 53 template <class T>
54 void DeleteOnWebKitThread(T* obj) { 54 void DeleteOnWebKitThread(T* obj) {
55 if (!BrowserThread::DeleteSoon(BrowserThread::WEBKIT, FROM_HERE, obj)) 55 if (!BrowserThread::DeleteSoon(BrowserThread::WEBKIT_DEPRECATED,
56 FROM_HERE, obj))
56 delete obj; 57 delete obj;
57 } 58 }
58 59
59 } 60 }
60 61
61 IndexedDBDispatcherHost::IndexedDBDispatcherHost( 62 IndexedDBDispatcherHost::IndexedDBDispatcherHost(
62 int process_id, WebKitContext* webkit_context) 63 int process_id, WebKitContext* webkit_context)
63 : webkit_context_(webkit_context), 64 : webkit_context_(webkit_context),
64 ALLOW_THIS_IN_INITIALIZER_LIST(database_dispatcher_host_( 65 ALLOW_THIS_IN_INITIALIZER_LIST(database_dispatcher_host_(
65 new DatabaseDispatcherHost(this))), 66 new DatabaseDispatcherHost(this))),
66 ALLOW_THIS_IN_INITIALIZER_LIST(index_dispatcher_host_( 67 ALLOW_THIS_IN_INITIALIZER_LIST(index_dispatcher_host_(
67 new IndexDispatcherHost(this))), 68 new IndexDispatcherHost(this))),
68 ALLOW_THIS_IN_INITIALIZER_LIST(object_store_dispatcher_host_( 69 ALLOW_THIS_IN_INITIALIZER_LIST(object_store_dispatcher_host_(
69 new ObjectStoreDispatcherHost(this))), 70 new ObjectStoreDispatcherHost(this))),
70 ALLOW_THIS_IN_INITIALIZER_LIST(cursor_dispatcher_host_( 71 ALLOW_THIS_IN_INITIALIZER_LIST(cursor_dispatcher_host_(
71 new CursorDispatcherHost(this))), 72 new CursorDispatcherHost(this))),
72 ALLOW_THIS_IN_INITIALIZER_LIST(transaction_dispatcher_host_( 73 ALLOW_THIS_IN_INITIALIZER_LIST(transaction_dispatcher_host_(
73 new TransactionDispatcherHost(this))), 74 new TransactionDispatcherHost(this))),
74 process_id_(process_id) { 75 process_id_(process_id) {
75 DCHECK(webkit_context_.get()); 76 DCHECK(webkit_context_.get());
76 } 77 }
77 78
78 IndexedDBDispatcherHost::~IndexedDBDispatcherHost() { 79 IndexedDBDispatcherHost::~IndexedDBDispatcherHost() {
79 } 80 }
80 81
81 void IndexedDBDispatcherHost::OnChannelClosing() { 82 void IndexedDBDispatcherHost::OnChannelClosing() {
82 BrowserMessageFilter::OnChannelClosing(); 83 BrowserMessageFilter::OnChannelClosing();
83 84
84 bool success = BrowserThread::PostTask( 85 bool success = BrowserThread::PostTask(
85 BrowserThread::WEBKIT, FROM_HERE, 86 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
86 base::Bind(&IndexedDBDispatcherHost::ResetDispatcherHosts, this)); 87 base::Bind(&IndexedDBDispatcherHost::ResetDispatcherHosts, this));
87 88
88 if (!success) 89 if (!success)
89 ResetDispatcherHosts(); 90 ResetDispatcherHosts();
90 } 91 }
91 92
92 void IndexedDBDispatcherHost::ResetDispatcherHosts() { 93 void IndexedDBDispatcherHost::ResetDispatcherHosts() {
93 // It is important that the various *_dispatcher_host_ members are reset 94 // It is important that the various *_dispatcher_host_ members are reset
94 // on the WebKit thread, since there might be incoming messages on that 95 // on the WebKit thread, since there might be incoming messages on that
95 // thread, and we must not reset the dispatcher hosts until after those 96 // thread, and we must not reset the dispatcher hosts until after those
96 // messages are processed. 97 // messages are processed.
97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT) || 98 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED) ||
98 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); 99 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess));
99 100
100 database_dispatcher_host_.reset(); 101 database_dispatcher_host_.reset();
101 index_dispatcher_host_.reset(); 102 index_dispatcher_host_.reset();
102 object_store_dispatcher_host_.reset(); 103 object_store_dispatcher_host_.reset();
103 cursor_dispatcher_host_.reset(); 104 cursor_dispatcher_host_.reset();
104 transaction_dispatcher_host_.reset(); 105 transaction_dispatcher_host_.reset();
105 } 106 }
106 107
107 void IndexedDBDispatcherHost::OverrideThreadForMessage( 108 void IndexedDBDispatcherHost::OverrideThreadForMessage(
108 const IPC::Message& message, 109 const IPC::Message& message,
109 BrowserThread::ID* thread) { 110 BrowserThread::ID* thread) {
110 if (IPC_MESSAGE_CLASS(message) == IndexedDBMsgStart) 111 if (IPC_MESSAGE_CLASS(message) == IndexedDBMsgStart)
111 *thread = BrowserThread::WEBKIT; 112 *thread = BrowserThread::WEBKIT_DEPRECATED;
112 } 113 }
113 114
114 bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message, 115 bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message,
115 bool* message_was_ok) { 116 bool* message_was_ok) {
116 if (IPC_MESSAGE_CLASS(message) != IndexedDBMsgStart) 117 if (IPC_MESSAGE_CLASS(message) != IndexedDBMsgStart)
117 return false; 118 return false;
118 119
119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 120 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
120 121
121 bool handled = 122 bool handled =
122 database_dispatcher_host_->OnMessageReceived(message, message_was_ok) || 123 database_dispatcher_host_->OnMessageReceived(message, message_was_ok) ||
123 index_dispatcher_host_->OnMessageReceived(message, message_was_ok) || 124 index_dispatcher_host_->OnMessageReceived(message, message_was_ok) ||
124 object_store_dispatcher_host_->OnMessageReceived( 125 object_store_dispatcher_host_->OnMessageReceived(
125 message, message_was_ok) || 126 message, message_was_ok) ||
126 cursor_dispatcher_host_->OnMessageReceived(message, message_was_ok) || 127 cursor_dispatcher_host_->OnMessageReceived(message, message_was_ok) ||
127 transaction_dispatcher_host_->OnMessageReceived(message, message_was_ok); 128 transaction_dispatcher_host_->OnMessageReceived(message, message_was_ok);
128 129
129 if (!handled) { 130 if (!handled) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return 0; 191 return 0;
191 } 192 }
192 int32 id = transaction_dispatcher_host_->map_.Add(idb_transaction); 193 int32 id = transaction_dispatcher_host_->map_.Add(idb_transaction);
193 idb_transaction->setCallbacks( 194 idb_transaction->setCallbacks(
194 new IndexedDBTransactionCallbacks(this, thread_id, id)); 195 new IndexedDBTransactionCallbacks(this, thread_id, id));
195 transaction_dispatcher_host_->transaction_url_map_[id] = url; 196 transaction_dispatcher_host_->transaction_url_map_[id] = url;
196 return id; 197 return id;
197 } 198 }
198 199
199 WebIDBCursor* IndexedDBDispatcherHost::GetCursorFromId(int32 cursor_id) { 200 WebIDBCursor* IndexedDBDispatcherHost::GetCursorFromId(int32 cursor_id) {
200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 201 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
201 return cursor_dispatcher_host_->map_.Lookup(cursor_id); 202 return cursor_dispatcher_host_->map_.Lookup(cursor_id);
202 } 203 }
203 204
204 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( 205 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames(
205 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { 206 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) {
206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
207 FilePath base_path = webkit_context_->data_path(); 208 FilePath base_path = webkit_context_->data_path();
208 FilePath indexed_db_path; 209 FilePath indexed_db_path;
209 if (!base_path.empty()) { 210 if (!base_path.empty()) {
210 indexed_db_path = base_path.Append( 211 indexed_db_path = base_path.Append(
211 IndexedDBContext::kIndexedDBDirectory); 212 IndexedDBContext::kIndexedDBDirectory);
212 } 213 }
213 214
214 // TODO(jorlow): This doesn't support file:/// urls properly. We probably need 215 // TODO(jorlow): This doesn't support file:/// urls properly. We probably need
215 // to add some toString method to WebSecurityOrigin that doesn't 216 // to add some toString method to WebSecurityOrigin that doesn't
216 // return null for them. Look at 217 // return null for them. Look at
217 // DatabaseUtil::GetOriginFromIdentifier. 218 // DatabaseUtil::GetOriginFromIdentifier.
218 WebSecurityOrigin origin( 219 WebSecurityOrigin origin(
219 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); 220 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin));
220 GURL origin_url(origin.toString()); 221 GURL origin_url(origin.toString());
221 222
222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
223 224
224 Context()->GetIDBFactory()->getDatabaseNames( 225 Context()->GetIDBFactory()->getDatabaseNames(
225 new IndexedDBCallbacks<WebDOMStringList>(this, params.thread_id, 226 new IndexedDBCallbacks<WebDOMStringList>(this, params.thread_id,
226 params.response_id), origin, NULL, 227 params.response_id), origin, NULL,
227 webkit_glue::FilePathToWebString(indexed_db_path)); 228 webkit_glue::FilePathToWebString(indexed_db_path));
228 } 229 }
229 230
230 void IndexedDBDispatcherHost::OnIDBFactoryOpen( 231 void IndexedDBDispatcherHost::OnIDBFactoryOpen(
231 const IndexedDBHostMsg_FactoryOpen_Params& params) { 232 const IndexedDBHostMsg_FactoryOpen_Params& params) {
232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 233 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
233 FilePath base_path = webkit_context_->data_path(); 234 FilePath base_path = webkit_context_->data_path();
234 FilePath indexed_db_path; 235 FilePath indexed_db_path;
235 if (!base_path.empty()) { 236 if (!base_path.empty()) {
236 indexed_db_path = base_path.Append( 237 indexed_db_path = base_path.Append(
237 IndexedDBContext::kIndexedDBDirectory); 238 IndexedDBContext::kIndexedDBDirectory);
238 } 239 }
239 240
240 // TODO(jorlow): This doesn't support file:/// urls properly. We probably need 241 // TODO(jorlow): This doesn't support file:/// urls properly. We probably need
241 // to add some toString method to WebSecurityOrigin that doesn't 242 // to add some toString method to WebSecurityOrigin that doesn't
242 // return null for them. Look at 243 // return null for them. Look at
243 // DatabaseUtil::GetOriginFromIdentifier. 244 // DatabaseUtil::GetOriginFromIdentifier.
244 WebSecurityOrigin origin( 245 WebSecurityOrigin origin(
245 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); 246 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin));
246 GURL origin_url(origin.toString()); 247 GURL origin_url(origin.toString());
247 248
248 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 249 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
249 250
250 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore 251 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore
251 // created) if this origin is already over quota. 252 // created) if this origin is already over quota.
252 Context()->GetIDBFactory()->open( 253 Context()->GetIDBFactory()->open(
253 params.name, 254 params.name,
254 new IndexedDBCallbacks<WebIDBDatabase>(this, params.thread_id, 255 new IndexedDBCallbacks<WebIDBDatabase>(this, params.thread_id,
255 params.response_id, origin_url), 256 params.response_id, origin_url),
256 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); 257 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path));
257 } 258 }
258 259
259 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( 260 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase(
260 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { 261 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) {
261 FilePath base_path = webkit_context_->data_path(); 262 FilePath base_path = webkit_context_->data_path();
262 FilePath indexed_db_path; 263 FilePath indexed_db_path;
263 if (!base_path.empty()) { 264 if (!base_path.empty()) {
264 indexed_db_path = base_path.Append( 265 indexed_db_path = base_path.Append(
265 IndexedDBContext::kIndexedDBDirectory); 266 IndexedDBContext::kIndexedDBDirectory);
266 } 267 }
267 268
268 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
269 Context()->GetIDBFactory()->deleteDatabase( 270 Context()->GetIDBFactory()->deleteDatabase(
270 params.name, 271 params.name,
271 new IndexedDBCallbacks<WebSerializedScriptValue>(this, 272 new IndexedDBCallbacks<WebSerializedScriptValue>(this,
272 params.thread_id, 273 params.thread_id,
273 params.response_id), 274 params.response_id),
274 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL, 275 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL,
275 webkit_glue::FilePathToWebString(indexed_db_path)); 276 webkit_glue::FilePathToWebString(indexed_db_path));
276 } 277 }
277 278
278 void IndexedDBDispatcherHost::TransactionComplete(int32 transaction_id) { 279 void IndexedDBDispatcherHost::TransactionComplete(int32 transaction_id) {
279 Context()->TransactionComplete( 280 Context()->TransactionComplete(
280 transaction_dispatcher_host_->transaction_url_map_[transaction_id]); 281 transaction_dispatcher_host_->transaction_url_map_[transaction_id]);
281 } 282 }
282 283
283 ////////////////////////////////////////////////////////////////////// 284 //////////////////////////////////////////////////////////////////////
284 // Helper templates. 285 // Helper templates.
285 // 286 //
286 287
287 template <typename ObjectType> 288 template <typename ObjectType>
288 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( 289 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess(
289 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) { 290 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) {
290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
291 ObjectType* return_object = map->Lookup(return_object_id); 292 ObjectType* return_object = map->Lookup(return_object_id);
292 if (!return_object) { 293 if (!return_object) {
293 content::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF")); 294 content::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF"));
294 BadMessageReceived(); 295 BadMessageReceived();
295 } 296 }
296 return return_object; 297 return return_object;
297 } 298 }
298 299
299 template <typename ReplyType, typename MapObjectType, typename Method> 300 template <typename ReplyType, typename MapObjectType, typename Method>
300 void IndexedDBDispatcherHost::SyncGetter( 301 void IndexedDBDispatcherHost::SyncGetter(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 381
381 WebDOMStringList web_object_stores = idb_database->objectStoreNames(); 382 WebDOMStringList web_object_stores = idb_database->objectStoreNames();
382 object_stores->reserve(web_object_stores.length()); 383 object_stores->reserve(web_object_stores.length());
383 for (unsigned i = 0; i < web_object_stores.length(); ++i) 384 for (unsigned i = 0; i < web_object_stores.length(); ++i)
384 object_stores->push_back(web_object_stores.item(i)); 385 object_stores->push_back(web_object_stores.item(i));
385 } 386 }
386 387
387 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore( 388 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore(
388 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params, 389 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params,
389 int32* object_store_id, WebKit::WebExceptionCode* ec) { 390 int32* object_store_id, WebKit::WebExceptionCode* ec) {
390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 391 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
391 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( 392 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
392 &map_, params.idb_database_id); 393 &map_, params.idb_database_id);
393 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 394 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
394 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 395 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
395 if (!idb_database || !idb_transaction) 396 if (!idb_database || !idb_transaction)
396 return; 397 return;
397 398
398 *ec = 0; 399 *ec = 0;
399 WebIDBObjectStore* object_store = idb_database->createObjectStore( 400 WebIDBObjectStore* object_store = idb_database->createObjectStore(
400 params.name, params.key_path, params.auto_increment, 401 params.name, params.key_path, params.auto_increment,
401 *idb_transaction, *ec); 402 *idb_transaction, *ec);
402 *object_store_id = *ec ? 0 : parent_->Add(object_store); 403 *object_store_id = *ec ? 0 : parent_->Add(object_store);
403 if (parent_->Context()->IsOverQuota( 404 if (parent_->Context()->IsOverQuota(
404 database_url_map_[params.idb_database_id])) { 405 database_url_map_[params.idb_database_id])) {
405 idb_transaction->abort(); 406 idb_transaction->abort();
406 } 407 }
407 } 408 }
408 409
409 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore( 410 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore(
410 int32 idb_database_id, 411 int32 idb_database_id,
411 const string16& name, 412 const string16& name,
412 int32 transaction_id, 413 int32 transaction_id,
413 WebKit::WebExceptionCode* ec) { 414 WebKit::WebExceptionCode* ec) {
414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 415 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
415 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( 416 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
416 &map_, idb_database_id); 417 &map_, idb_database_id);
417 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 418 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
418 &parent_->transaction_dispatcher_host_->map_, transaction_id); 419 &parent_->transaction_dispatcher_host_->map_, transaction_id);
419 if (!idb_database || !idb_transaction) 420 if (!idb_database || !idb_transaction)
420 return; 421 return;
421 422
422 *ec = 0; 423 *ec = 0;
423 idb_database->deleteObjectStore(name, *idb_transaction, *ec); 424 idb_database->deleteObjectStore(name, *idb_transaction, *ec);
424 } 425 }
425 426
426 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion( 427 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion(
427 int32 idb_database_id, 428 int32 idb_database_id,
428 int32 thread_id, 429 int32 thread_id,
429 int32 response_id, 430 int32 response_id,
430 const string16& version, 431 const string16& version,
431 WebKit::WebExceptionCode* ec) { 432 WebKit::WebExceptionCode* ec) {
432 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 433 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
433 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( 434 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
434 &map_, idb_database_id); 435 &map_, idb_database_id);
435 if (!idb_database) 436 if (!idb_database)
436 return; 437 return;
437 438
438 *ec = 0; 439 *ec = 0;
439 idb_database->setVersion( 440 idb_database->setVersion(
440 version, 441 version,
441 new IndexedDBCallbacks<WebIDBTransaction>(parent_, thread_id, response_id, 442 new IndexedDBCallbacks<WebIDBTransaction>(parent_, thread_id, response_id,
442 database_url_map_[idb_database_id]), 443 database_url_map_[idb_database_id]),
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 555 }
555 556
556 void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique( 557 void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique(
557 int32 object_id, bool* unique) { 558 int32 object_id, bool* unique) {
558 parent_->SyncGetter<bool>(&map_, object_id, unique, &WebIDBIndex::unique); 559 parent_->SyncGetter<bool>(&map_, object_id, unique, &WebIDBIndex::unique);
559 } 560 }
560 561
561 void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenObjectCursor( 562 void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenObjectCursor(
562 const IndexedDBHostMsg_IndexOpenCursor_Params& params, 563 const IndexedDBHostMsg_IndexOpenCursor_Params& params,
563 WebKit::WebExceptionCode* ec) { 564 WebKit::WebExceptionCode* ec) {
564 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 565 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
565 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( 566 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
566 &map_, params.idb_index_id); 567 &map_, params.idb_index_id);
567 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 568 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
568 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 569 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
569 if (!idb_transaction || !idb_index) 570 if (!idb_transaction || !idb_index)
570 return; 571 return;
571 572
572 *ec = 0; 573 *ec = 0;
573 scoped_ptr<WebIDBCallbacks> callbacks( 574 scoped_ptr<WebIDBCallbacks> callbacks(
574 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id, 575 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id,
575 params.response_id, -1)); 576 params.response_id, -1));
576 idb_index->openObjectCursor( 577 idb_index->openObjectCursor(
577 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, 578 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
578 params.upper_open), 579 params.upper_open),
579 params.direction, callbacks.release(), *idb_transaction, *ec); 580 params.direction, callbacks.release(), *idb_transaction, *ec);
580 } 581 }
581 582
582 void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor( 583 void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor(
583 const IndexedDBHostMsg_IndexOpenCursor_Params& params, 584 const IndexedDBHostMsg_IndexOpenCursor_Params& params,
584 WebKit::WebExceptionCode* ec) { 585 WebKit::WebExceptionCode* ec) {
585 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 586 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
586 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( 587 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
587 &map_, params.idb_index_id); 588 &map_, params.idb_index_id);
588 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 589 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
589 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 590 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
590 if (!idb_transaction || !idb_index) 591 if (!idb_transaction || !idb_index)
591 return; 592 return;
592 593
593 *ec = 0; 594 *ec = 0;
594 scoped_ptr<WebIDBCallbacks> callbacks( 595 scoped_ptr<WebIDBCallbacks> callbacks(
595 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id, 596 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id,
596 params.response_id, -1)); 597 params.response_id, -1));
597 idb_index->openKeyCursor( 598 idb_index->openKeyCursor(
598 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, 599 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
599 params.upper_open), 600 params.upper_open),
600 params.direction, callbacks.release(), *idb_transaction, *ec); 601 params.direction, callbacks.release(), *idb_transaction, *ec);
601 } 602 }
602 603
603 void IndexedDBDispatcherHost::IndexDispatcherHost::OnCount( 604 void IndexedDBDispatcherHost::IndexDispatcherHost::OnCount(
604 const IndexedDBHostMsg_IndexCount_Params& params, 605 const IndexedDBHostMsg_IndexCount_Params& params,
605 WebKit::WebExceptionCode* ec) { 606 WebKit::WebExceptionCode* ec) {
606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 607 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
607 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( 608 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
608 &map_, params.idb_index_id); 609 &map_, params.idb_index_id);
609 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 610 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
610 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 611 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
611 if (!idb_transaction || !idb_index) 612 if (!idb_transaction || !idb_index)
612 return; 613 return;
613 614
614 *ec = 0; 615 *ec = 0;
615 scoped_ptr<WebIDBCallbacks> callbacks( 616 scoped_ptr<WebIDBCallbacks> callbacks(
616 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, 617 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_,
617 params.thread_id, 618 params.thread_id,
618 params.response_id)); 619 params.response_id));
619 idb_index->count( 620 idb_index->count(
620 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, 621 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
621 params.upper_open), 622 params.upper_open),
622 callbacks.release(), *idb_transaction, *ec); 623 callbacks.release(), *idb_transaction, *ec);
623 } 624 }
624 625
625 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( 626 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject(
626 int idb_index_id, 627 int idb_index_id,
627 int32 thread_id, 628 int32 thread_id,
628 int32 response_id, 629 int32 response_id,
629 const IndexedDBKey& key, 630 const IndexedDBKey& key,
630 int32 transaction_id, 631 int32 transaction_id,
631 WebKit::WebExceptionCode* ec) { 632 WebKit::WebExceptionCode* ec) {
632 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 633 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
633 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( 634 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
634 &map_, idb_index_id); 635 &map_, idb_index_id);
635 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 636 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
636 &parent_->transaction_dispatcher_host_->map_, transaction_id); 637 &parent_->transaction_dispatcher_host_->map_, transaction_id);
637 if (!idb_transaction || !idb_index) 638 if (!idb_transaction || !idb_index)
638 return; 639 return;
639 640
640 *ec = 0; 641 *ec = 0;
641 scoped_ptr<WebIDBCallbacks> callbacks( 642 scoped_ptr<WebIDBCallbacks> callbacks(
642 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, 643 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
643 response_id)); 644 response_id));
644 idb_index->getObject(key, callbacks.release(), *idb_transaction, *ec); 645 idb_index->getObject(key, callbacks.release(), *idb_transaction, *ec);
645 } 646 }
646 647
647 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey( 648 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey(
648 int idb_index_id, 649 int idb_index_id,
649 int32 thread_id, 650 int32 thread_id,
650 int32 response_id, 651 int32 response_id,
651 const IndexedDBKey& key, 652 const IndexedDBKey& key,
652 int32 transaction_id, 653 int32 transaction_id,
653 WebKit::WebExceptionCode* ec) { 654 WebKit::WebExceptionCode* ec) {
654 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 655 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
655 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( 656 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
656 &map_, idb_index_id); 657 &map_, idb_index_id);
657 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 658 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
658 &parent_->transaction_dispatcher_host_->map_, transaction_id); 659 &parent_->transaction_dispatcher_host_->map_, transaction_id);
659 if (!idb_transaction || !idb_index) 660 if (!idb_transaction || !idb_index)
660 return; 661 return;
661 662
662 *ec = 0; 663 *ec = 0;
663 scoped_ptr<WebIDBCallbacks> callbacks( 664 scoped_ptr<WebIDBCallbacks> callbacks(
664 new IndexedDBCallbacks<WebIDBKey>(parent_, thread_id, response_id)); 665 new IndexedDBCallbacks<WebIDBKey>(parent_, thread_id, response_id));
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 index_names->push_back(web_index_names.item(i)); 738 index_names->push_back(web_index_names.item(i));
738 } 739 }
739 740
740 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet( 741 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet(
741 int idb_object_store_id, 742 int idb_object_store_id,
742 int32 thread_id, 743 int32 thread_id,
743 int32 response_id, 744 int32 response_id,
744 const IndexedDBKey& key, 745 const IndexedDBKey& key,
745 int32 transaction_id, 746 int32 transaction_id,
746 WebKit::WebExceptionCode* ec) { 747 WebKit::WebExceptionCode* ec) {
747 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 748 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
748 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 749 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
749 &map_, idb_object_store_id); 750 &map_, idb_object_store_id);
750 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 751 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
751 &parent_->transaction_dispatcher_host_->map_, transaction_id); 752 &parent_->transaction_dispatcher_host_->map_, transaction_id);
752 if (!idb_transaction || !idb_object_store) 753 if (!idb_transaction || !idb_object_store)
753 return; 754 return;
754 755
755 *ec = 0; 756 *ec = 0;
756 scoped_ptr<WebIDBCallbacks> callbacks( 757 scoped_ptr<WebIDBCallbacks> callbacks(
757 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, 758 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
758 response_id)); 759 response_id));
759 idb_object_store->get(key, callbacks.release(), *idb_transaction, *ec); 760 idb_object_store->get(key, callbacks.release(), *idb_transaction, *ec);
760 } 761 }
761 762
762 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut( 763 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut(
763 const IndexedDBHostMsg_ObjectStorePut_Params& params, 764 const IndexedDBHostMsg_ObjectStorePut_Params& params,
764 WebKit::WebExceptionCode* ec) { 765 WebKit::WebExceptionCode* ec) {
765 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 766 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
766 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 767 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
767 &map_, params.idb_object_store_id); 768 &map_, params.idb_object_store_id);
768 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 769 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
769 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 770 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
770 if (!idb_transaction || !idb_object_store) 771 if (!idb_transaction || !idb_object_store)
771 return; 772 return;
772 773
773 *ec = 0; 774 *ec = 0;
774 scoped_ptr<WebIDBCallbacks> callbacks( 775 scoped_ptr<WebIDBCallbacks> callbacks(
775 new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id, 776 new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id,
776 params.response_id)); 777 params.response_id));
777 idb_object_store->put(params.serialized_value, params.key, params.put_mode, 778 idb_object_store->put(params.serialized_value, params.key, params.put_mode,
778 callbacks.release(), *idb_transaction, *ec); 779 callbacks.release(), *idb_transaction, *ec);
779 if (*ec) 780 if (*ec)
780 return; 781 return;
781 int64 size = UTF16ToUTF8(params.serialized_value.data()).size(); 782 int64 size = UTF16ToUTF8(params.serialized_value.data()).size();
782 WebIDBTransactionIDToSizeMap* map = 783 WebIDBTransactionIDToSizeMap* map =
783 &parent_->transaction_dispatcher_host_->transaction_size_map_; 784 &parent_->transaction_dispatcher_host_->transaction_size_map_;
784 (*map)[params.transaction_id] += size; 785 (*map)[params.transaction_id] += size;
785 } 786 }
786 787
787 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete( 788 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete(
788 int idb_object_store_id, 789 int idb_object_store_id,
789 int32 thread_id, 790 int32 thread_id,
790 int32 response_id, 791 int32 response_id,
791 const IndexedDBKey& key, 792 const IndexedDBKey& key,
792 int32 transaction_id, 793 int32 transaction_id,
793 WebKit::WebExceptionCode* ec) { 794 WebKit::WebExceptionCode* ec) {
794 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 795 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
795 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 796 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
796 &map_, idb_object_store_id); 797 &map_, idb_object_store_id);
797 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 798 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
798 &parent_->transaction_dispatcher_host_->map_, transaction_id); 799 &parent_->transaction_dispatcher_host_->map_, transaction_id);
799 if (!idb_transaction || !idb_object_store) 800 if (!idb_transaction || !idb_object_store)
800 return; 801 return;
801 802
802 *ec = 0; 803 *ec = 0;
803 scoped_ptr<WebIDBCallbacks> callbacks( 804 scoped_ptr<WebIDBCallbacks> callbacks(
804 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, 805 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
805 response_id)); 806 response_id));
806 idb_object_store->deleteFunction( 807 idb_object_store->deleteFunction(
807 key, callbacks.release(), *idb_transaction, *ec); 808 key, callbacks.release(), *idb_transaction, *ec);
808 } 809 }
809 810
810 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnClear( 811 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnClear(
811 int idb_object_store_id, 812 int idb_object_store_id,
812 int32 thread_id, 813 int32 thread_id,
813 int32 response_id, 814 int32 response_id,
814 int32 transaction_id, 815 int32 transaction_id,
815 WebKit::WebExceptionCode* ec) { 816 WebKit::WebExceptionCode* ec) {
816 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 817 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
817 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 818 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
818 &map_, idb_object_store_id); 819 &map_, idb_object_store_id);
819 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 820 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
820 &parent_->transaction_dispatcher_host_->map_, transaction_id); 821 &parent_->transaction_dispatcher_host_->map_, transaction_id);
821 if (!idb_transaction || !idb_object_store) 822 if (!idb_transaction || !idb_object_store)
822 return; 823 return;
823 824
824 *ec = 0; 825 *ec = 0;
825 scoped_ptr<WebIDBCallbacks> callbacks( 826 scoped_ptr<WebIDBCallbacks> callbacks(
826 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, 827 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
827 response_id)); 828 response_id));
828 idb_object_store->clear(callbacks.release(), *idb_transaction, *ec); 829 idb_object_store->clear(callbacks.release(), *idb_transaction, *ec);
829 } 830 }
830 831
831 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex( 832 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex(
832 const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params, 833 const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params,
833 int32* index_id, WebKit::WebExceptionCode* ec) { 834 int32* index_id, WebKit::WebExceptionCode* ec) {
834 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 835 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
835 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 836 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
836 &map_, params.idb_object_store_id); 837 &map_, params.idb_object_store_id);
837 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 838 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
838 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 839 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
839 if (!idb_object_store || !idb_transaction) 840 if (!idb_object_store || !idb_transaction)
840 return; 841 return;
841 842
842 *ec = 0; 843 *ec = 0;
843 WebIDBIndex* index = idb_object_store->createIndex( 844 WebIDBIndex* index = idb_object_store->createIndex(
844 params.name, params.key_path, params.unique, params.multi_entry, 845 params.name, params.key_path, params.unique, params.multi_entry,
(...skipping 20 matching lines...) Expand all
865 *ec = 0; 866 *ec = 0;
866 WebIDBIndex* index = idb_object_store->index(name, *ec); 867 WebIDBIndex* index = idb_object_store->index(name, *ec);
867 *idb_index_id = parent_->Add(index); 868 *idb_index_id = parent_->Add(index);
868 } 869 }
869 870
870 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDeleteIndex( 871 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDeleteIndex(
871 int32 idb_object_store_id, 872 int32 idb_object_store_id,
872 const string16& name, 873 const string16& name,
873 int32 transaction_id, 874 int32 transaction_id,
874 WebKit::WebExceptionCode* ec) { 875 WebKit::WebExceptionCode* ec) {
875 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 876 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
876 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 877 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
877 &map_, idb_object_store_id); 878 &map_, idb_object_store_id);
878 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 879 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
879 &parent_->transaction_dispatcher_host_->map_, transaction_id); 880 &parent_->transaction_dispatcher_host_->map_, transaction_id);
880 if (!idb_object_store || !idb_transaction) 881 if (!idb_object_store || !idb_transaction)
881 return; 882 return;
882 883
883 *ec = 0; 884 *ec = 0;
884 idb_object_store->deleteIndex(name, *idb_transaction, *ec); 885 idb_object_store->deleteIndex(name, *idb_transaction, *ec);
885 } 886 }
886 887
887 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnOpenCursor( 888 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnOpenCursor(
888 const IndexedDBHostMsg_ObjectStoreOpenCursor_Params& params, 889 const IndexedDBHostMsg_ObjectStoreOpenCursor_Params& params,
889 WebKit::WebExceptionCode* ec) { 890 WebKit::WebExceptionCode* ec) {
890 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 891 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
891 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 892 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
892 &parent_->object_store_dispatcher_host_->map_, 893 &parent_->object_store_dispatcher_host_->map_,
893 params.idb_object_store_id); 894 params.idb_object_store_id);
894 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 895 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
895 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 896 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
896 if (!idb_transaction || !idb_object_store) 897 if (!idb_transaction || !idb_object_store)
897 return; 898 return;
898 899
899 *ec = 0; 900 *ec = 0;
900 scoped_ptr<WebIDBCallbacks> callbacks( 901 scoped_ptr<WebIDBCallbacks> callbacks(
901 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id, 902 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id,
902 params.response_id, -1)); 903 params.response_id, -1));
903 idb_object_store->openCursor( 904 idb_object_store->openCursor(
904 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, 905 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
905 params.upper_open), 906 params.upper_open),
906 params.direction, callbacks.release(), *idb_transaction, *ec); 907 params.direction, callbacks.release(), *idb_transaction, *ec);
907 } 908 }
908 909
909 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCount( 910 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCount(
910 const IndexedDBHostMsg_ObjectStoreCount_Params& params, 911 const IndexedDBHostMsg_ObjectStoreCount_Params& params,
911 WebKit::WebExceptionCode* ec) { 912 WebKit::WebExceptionCode* ec) {
912 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 913 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
913 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 914 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
914 &parent_->object_store_dispatcher_host_->map_, 915 &parent_->object_store_dispatcher_host_->map_,
915 params.idb_object_store_id); 916 params.idb_object_store_id);
916 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 917 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
917 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 918 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
918 if (!idb_transaction || !idb_object_store) 919 if (!idb_transaction || !idb_object_store)
919 return; 920 return;
920 921
921 *ec = 0; 922 *ec = 0;
922 scoped_ptr<WebIDBCallbacks> callbacks( 923 scoped_ptr<WebIDBCallbacks> callbacks(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 1007
1007 *script_value = content::SerializedScriptValue(idb_cursor->value()); 1008 *script_value = content::SerializedScriptValue(idb_cursor->value());
1008 } 1009 }
1009 1010
1010 void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate( 1011 void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate(
1011 int32 cursor_id, 1012 int32 cursor_id,
1012 int32 thread_id, 1013 int32 thread_id,
1013 int32 response_id, 1014 int32 response_id,
1014 const content::SerializedScriptValue& value, 1015 const content::SerializedScriptValue& value,
1015 WebKit::WebExceptionCode* ec) { 1016 WebKit::WebExceptionCode* ec) {
1016 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1017 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
1017 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 1018 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
1018 if (!idb_cursor) 1019 if (!idb_cursor)
1019 return; 1020 return;
1020 1021
1021 *ec = 0; 1022 *ec = 0;
1022 idb_cursor->update( 1023 idb_cursor->update(
1023 value, new IndexedDBCallbacks<WebIDBKey>(parent_, thread_id, response_id), 1024 value, new IndexedDBCallbacks<WebIDBKey>(parent_, thread_id, response_id),
1024 *ec); 1025 *ec);
1025 } 1026 }
1026 1027
1027 void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue( 1028 void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue(
1028 int32 cursor_id, 1029 int32 cursor_id,
1029 int32 thread_id, 1030 int32 thread_id,
1030 int32 response_id, 1031 int32 response_id,
1031 const IndexedDBKey& key, 1032 const IndexedDBKey& key,
1032 WebKit::WebExceptionCode* ec) { 1033 WebKit::WebExceptionCode* ec) {
1033 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1034 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
1034 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 1035 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
1035 if (!idb_cursor) 1036 if (!idb_cursor)
1036 return; 1037 return;
1037 1038
1038 *ec = 0; 1039 *ec = 0;
1039 idb_cursor->continueFunction( 1040 idb_cursor->continueFunction(
1040 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, thread_id, response_id, 1041 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, thread_id, response_id,
1041 cursor_id), *ec); 1042 cursor_id), *ec);
1042 } 1043 }
1043 1044
1044 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch( 1045 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch(
1045 int32 cursor_id, 1046 int32 cursor_id,
1046 int32 thread_id, 1047 int32 thread_id,
1047 int32 response_id, 1048 int32 response_id,
1048 int n, 1049 int n,
1049 WebKit::WebExceptionCode* ec) { 1050 WebKit::WebExceptionCode* ec) {
1050 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1051 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
1051 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 1052 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
1052 if (!idb_cursor) 1053 if (!idb_cursor)
1053 return; 1054 return;
1054 1055
1055 *ec = 0; 1056 *ec = 0;
1056 idb_cursor->prefetchContinue( 1057 idb_cursor->prefetchContinue(
1057 n, new IndexedDBCallbacks<WebIDBCursor>(parent_, thread_id, response_id, 1058 n, new IndexedDBCallbacks<WebIDBCursor>(parent_, thread_id, response_id,
1058 cursor_id), *ec); 1059 cursor_id), *ec);
1059 } 1060 }
1060 1061
1061 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset( 1062 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset(
1062 int32 cursor_id, int used_prefetches, int unused_prefetches) { 1063 int32 cursor_id, int used_prefetches, int unused_prefetches) {
1063 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1064 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
1064 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 1065 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
1065 if (!idb_cursor) 1066 if (!idb_cursor)
1066 return; 1067 return;
1067 1068
1068 idb_cursor->prefetchReset(used_prefetches, unused_prefetches); 1069 idb_cursor->prefetchReset(used_prefetches, unused_prefetches);
1069 } 1070 }
1070 1071
1071 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( 1072 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete(
1072 int32 cursor_id, 1073 int32 cursor_id,
1073 int32 thread_id, 1074 int32 thread_id,
1074 int32 response_id, 1075 int32 response_id,
1075 WebKit::WebExceptionCode* ec) { 1076 WebKit::WebExceptionCode* ec) {
1076 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1077 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
1077 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 1078 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
1078 if (!idb_cursor) 1079 if (!idb_cursor)
1079 return; 1080 return;
1080 1081
1081 *ec = 0; 1082 *ec = 0;
1082 idb_cursor->deleteFunction( 1083 idb_cursor->deleteFunction(
1083 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, 1084 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
1084 response_id), *ec); 1085 response_id), *ec);
1085 } 1086 }
1086 1087
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 if (!idb_transaction) 1159 if (!idb_transaction)
1159 return; 1160 return;
1160 1161
1161 *ec = 0; 1162 *ec = 0;
1162 WebIDBObjectStore* object_store = idb_transaction->objectStore(name, *ec); 1163 WebIDBObjectStore* object_store = idb_transaction->objectStore(name, *ec);
1163 *object_store_id = object_store ? parent_->Add(object_store) : 0; 1164 *object_store_id = object_store ? parent_->Add(object_store) : 0;
1164 } 1165 }
1165 1166
1166 void IndexedDBDispatcherHost:: 1167 void IndexedDBDispatcherHost::
1167 TransactionDispatcherHost::OnDidCompleteTaskEvents(int transaction_id) { 1168 TransactionDispatcherHost::OnDidCompleteTaskEvents(int transaction_id) {
1168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
1169 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 1170 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
1170 &map_, transaction_id); 1171 &map_, transaction_id);
1171 if (!idb_transaction) 1172 if (!idb_transaction)
1172 return; 1173 return;
1173 1174
1174 // TODO(dgrogan): Tell the page the transaction aborted because of quota. 1175 // TODO(dgrogan): Tell the page the transaction aborted because of quota.
1175 if (parent_->Context()->WouldBeOverQuota( 1176 if (parent_->Context()->WouldBeOverQuota(
1176 transaction_url_map_[transaction_id], 1177 transaction_url_map_[transaction_id],
1177 transaction_size_map_[transaction_id])) { 1178 transaction_size_map_[transaction_id])) {
1178 idb_transaction->abort(); 1179 idb_transaction->abort();
1179 return; 1180 return;
1180 } 1181 }
1181 idb_transaction->didCompleteTaskEvents(); 1182 idb_transaction->didCompleteTaskEvents();
1182 } 1183 }
1183 1184
1184 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1185 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1185 int32 object_id) { 1186 int32 object_id) {
1186 transaction_size_map_.erase(object_id); 1187 transaction_size_map_.erase(object_id);
1187 transaction_url_map_.erase(object_id); 1188 transaction_url_map_.erase(object_id);
1188 parent_->DestroyObject(&map_, object_id); 1189 parent_->DestroyObject(&map_, object_id);
1189 } 1190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698