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

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

Issue 8747002: Dispatch IndexedDB IPC messages to worker threads (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove OVERRIDE from dtor 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 int32 IndexedDBDispatcherHost::Add(WebIDBCursor* idb_cursor) { 143 int32 IndexedDBDispatcherHost::Add(WebIDBCursor* idb_cursor) {
144 if (!cursor_dispatcher_host_.get()) { 144 if (!cursor_dispatcher_host_.get()) {
145 delete idb_cursor; 145 delete idb_cursor;
146 return 0; 146 return 0;
147 } 147 }
148 return cursor_dispatcher_host_->map_.Add(idb_cursor); 148 return cursor_dispatcher_host_->map_.Add(idb_cursor);
149 } 149 }
150 150
151 int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database, 151 int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database,
152 int32 thread_id,
152 const GURL& origin_url) { 153 const GURL& origin_url) {
153 if (!database_dispatcher_host_.get()) { 154 if (!database_dispatcher_host_.get()) {
154 delete idb_database; 155 delete idb_database;
155 return 0; 156 return 0;
156 } 157 }
157 int32 idb_database_id = database_dispatcher_host_->map_.Add(idb_database); 158 int32 idb_database_id = database_dispatcher_host_->map_.Add(idb_database);
158 Context()->ConnectionOpened(origin_url); 159 Context()->ConnectionOpened(origin_url);
159 database_dispatcher_host_->database_url_map_[idb_database_id] = origin_url; 160 database_dispatcher_host_->database_url_map_[idb_database_id] = origin_url;
160 return idb_database_id; 161 return idb_database_id;
161 } 162 }
(...skipping 12 matching lines...) Expand all
174 if (!object_store_dispatcher_host_.get()) { 175 if (!object_store_dispatcher_host_.get()) {
175 delete idb_object_store; 176 delete idb_object_store;
176 return 0; 177 return 0;
177 } 178 }
178 if (!idb_object_store) 179 if (!idb_object_store)
179 return 0; 180 return 0;
180 return object_store_dispatcher_host_->map_.Add(idb_object_store); 181 return object_store_dispatcher_host_->map_.Add(idb_object_store);
181 } 182 }
182 183
183 int32 IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction, 184 int32 IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction,
185 int32 thread_id,
184 const GURL& url) { 186 const GURL& url) {
185 if (!transaction_dispatcher_host_.get()) { 187 if (!transaction_dispatcher_host_.get()) {
186 delete idb_transaction; 188 delete idb_transaction;
187 return 0; 189 return 0;
188 } 190 }
189 int32 id = transaction_dispatcher_host_->map_.Add(idb_transaction); 191 int32 id = transaction_dispatcher_host_->map_.Add(idb_transaction);
190 idb_transaction->setCallbacks(new IndexedDBTransactionCallbacks(this, id)); 192 idb_transaction->setCallbacks(
193 new IndexedDBTransactionCallbacks(this, thread_id, id));
191 transaction_dispatcher_host_->transaction_url_map_[id] = url; 194 transaction_dispatcher_host_->transaction_url_map_[id] = url;
192 return id; 195 return id;
193 } 196 }
194 197
195 WebIDBCursor* IndexedDBDispatcherHost::GetCursorFromId(int32 cursor_id) { 198 WebIDBCursor* IndexedDBDispatcherHost::GetCursorFromId(int32 cursor_id) {
196 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 199 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
197 return cursor_dispatcher_host_->map_.Lookup(cursor_id); 200 return cursor_dispatcher_host_->map_.Lookup(cursor_id);
198 } 201 }
199 202
200 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( 203 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames(
(...skipping 10 matching lines...) Expand all
211 // to add some toString method to WebSecurityOrigin that doesn't 214 // to add some toString method to WebSecurityOrigin that doesn't
212 // return null for them. Look at 215 // return null for them. Look at
213 // DatabaseUtil::GetOriginFromIdentifier. 216 // DatabaseUtil::GetOriginFromIdentifier.
214 WebSecurityOrigin origin( 217 WebSecurityOrigin origin(
215 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); 218 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin));
216 GURL origin_url(origin.toString()); 219 GURL origin_url(origin.toString());
217 220
218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 221 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
219 222
220 Context()->GetIDBFactory()->getDatabaseNames( 223 Context()->GetIDBFactory()->getDatabaseNames(
221 new IndexedDBCallbacks<WebDOMStringList>(this, params.response_id), 224 new IndexedDBCallbacks<WebDOMStringList>(this, params.thread_id,
222 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); 225 params.response_id), origin, NULL,
226 webkit_glue::FilePathToWebString(indexed_db_path));
223 } 227 }
224 228
225 void IndexedDBDispatcherHost::OnIDBFactoryOpen( 229 void IndexedDBDispatcherHost::OnIDBFactoryOpen(
226 const IndexedDBHostMsg_FactoryOpen_Params& params) { 230 const IndexedDBHostMsg_FactoryOpen_Params& params) {
227 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
228 FilePath base_path = webkit_context_->data_path(); 232 FilePath base_path = webkit_context_->data_path();
229 FilePath indexed_db_path; 233 FilePath indexed_db_path;
230 if (!base_path.empty()) { 234 if (!base_path.empty()) {
231 indexed_db_path = base_path.Append( 235 indexed_db_path = base_path.Append(
232 IndexedDBContext::kIndexedDBDirectory); 236 IndexedDBContext::kIndexedDBDirectory);
233 } 237 }
234 238
235 // TODO(jorlow): This doesn't support file:/// urls properly. We probably need 239 // TODO(jorlow): This doesn't support file:/// urls properly. We probably need
236 // to add some toString method to WebSecurityOrigin that doesn't 240 // to add some toString method to WebSecurityOrigin that doesn't
237 // return null for them. Look at 241 // return null for them. Look at
238 // DatabaseUtil::GetOriginFromIdentifier. 242 // DatabaseUtil::GetOriginFromIdentifier.
239 WebSecurityOrigin origin( 243 WebSecurityOrigin origin(
240 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); 244 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin));
241 GURL origin_url(origin.toString()); 245 GURL origin_url(origin.toString());
242 246
243 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
244 248
245 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore 249 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore
246 // created) if this origin is already over quota. 250 // created) if this origin is already over quota.
247 Context()->GetIDBFactory()->open( 251 Context()->GetIDBFactory()->open(
248 params.name, 252 params.name,
249 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id, 253 new IndexedDBCallbacks<WebIDBDatabase>(this, params.thread_id,
250 origin_url), 254 params.response_id, origin_url),
251 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); 255 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path));
252 } 256 }
253 257
254 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( 258 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase(
255 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { 259 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) {
256 FilePath base_path = webkit_context_->data_path(); 260 FilePath base_path = webkit_context_->data_path();
257 FilePath indexed_db_path; 261 FilePath indexed_db_path;
258 if (!base_path.empty()) { 262 if (!base_path.empty()) {
259 indexed_db_path = base_path.Append( 263 indexed_db_path = base_path.Append(
260 IndexedDBContext::kIndexedDBDirectory); 264 IndexedDBContext::kIndexedDBDirectory);
261 } 265 }
262 266
263 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 267 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
264 Context()->GetIDBFactory()->deleteDatabase( 268 Context()->GetIDBFactory()->deleteDatabase(
265 params.name, 269 params.name,
266 new IndexedDBCallbacks<WebSerializedScriptValue>(this, 270 new IndexedDBCallbacks<WebSerializedScriptValue>(this,
271 params.thread_id,
267 params.response_id), 272 params.response_id),
268 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL, 273 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL,
269 webkit_glue::FilePathToWebString(indexed_db_path)); 274 webkit_glue::FilePathToWebString(indexed_db_path));
270 } 275 }
271 276
272 void IndexedDBDispatcherHost::TransactionComplete(int32 transaction_id) { 277 void IndexedDBDispatcherHost::TransactionComplete(int32 transaction_id) {
273 Context()->TransactionComplete( 278 Context()->TransactionComplete(
274 transaction_dispatcher_host_->transaction_url_map_[transaction_id]); 279 transaction_dispatcher_host_->transaction_url_map_[transaction_id]);
275 } 280 }
276 281
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 &parent_->transaction_dispatcher_host_->map_, transaction_id); 417 &parent_->transaction_dispatcher_host_->map_, transaction_id);
413 if (!idb_database || !idb_transaction) 418 if (!idb_database || !idb_transaction)
414 return; 419 return;
415 420
416 *ec = 0; 421 *ec = 0;
417 idb_database->deleteObjectStore(name, *idb_transaction, *ec); 422 idb_database->deleteObjectStore(name, *idb_transaction, *ec);
418 } 423 }
419 424
420 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion( 425 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion(
421 int32 idb_database_id, 426 int32 idb_database_id,
427 int32 thread_id,
422 int32 response_id, 428 int32 response_id,
423 const string16& version, 429 const string16& version,
424 WebKit::WebExceptionCode* ec) { 430 WebKit::WebExceptionCode* ec) {
425 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 431 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
426 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( 432 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
427 &map_, idb_database_id); 433 &map_, idb_database_id);
428 if (!idb_database) 434 if (!idb_database)
429 return; 435 return;
430 436
431 *ec = 0; 437 *ec = 0;
432 idb_database->setVersion( 438 idb_database->setVersion(
433 version, 439 version,
434 new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id, 440 new IndexedDBCallbacks<WebIDBTransaction>(parent_, thread_id, response_id,
435 database_url_map_[idb_database_id]), 441 database_url_map_[idb_database_id]),
436 *ec); 442 *ec);
437 } 443 }
438 444
439 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( 445 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
446 int32 thread_id,
440 int32 idb_database_id, 447 int32 idb_database_id,
441 const std::vector<string16>& names, 448 const std::vector<string16>& names,
442 int32 mode, 449 int32 mode,
443 int32* idb_transaction_id, 450 int32* idb_transaction_id,
444 WebKit::WebExceptionCode* ec) { 451 WebKit::WebExceptionCode* ec) {
445 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 452 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
446 &map_, idb_database_id); 453 &map_, idb_database_id);
447 if (!database) 454 if (!database)
448 return; 455 return;
449 456
450 WebDOMStringList object_stores; 457 WebDOMStringList object_stores;
451 for (std::vector<string16>::const_iterator it = names.begin(); 458 for (std::vector<string16>::const_iterator it = names.begin();
452 it != names.end(); ++it) { 459 it != names.end(); ++it) {
453 object_stores.append(*it); 460 object_stores.append(*it);
454 } 461 }
455 462
456 *ec = 0; 463 *ec = 0;
457 WebIDBTransaction* transaction = database->transaction( 464 WebIDBTransaction* transaction = database->transaction(
458 object_stores, mode, *ec); 465 object_stores, mode, *ec);
459 DCHECK(!transaction != !*ec); 466 DCHECK(!transaction != !*ec);
460 *idb_transaction_id = 467 *idb_transaction_id =
461 *ec ? 0 : parent_->Add(transaction, database_url_map_[idb_database_id]); 468 *ec ? 0 : parent_->Add(transaction, thread_id,
469 database_url_map_[idb_database_id]);
462 } 470 }
463 471
464 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen( 472 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen(
465 int32 idb_database_id, int32 response_id) { 473 int32 idb_database_id, int32 thread_id, int32 response_id) {
466 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 474 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
467 &map_, idb_database_id); 475 &map_, idb_database_id);
468 if (!database) 476 if (!database)
469 return; 477 return;
470 database->open(new IndexedDBDatabaseCallbacks(parent_, response_id)); 478 database->open(new IndexedDBDatabaseCallbacks(parent_, thread_id,
479 response_id));
471 } 480 }
472 481
473 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( 482 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose(
474 int32 idb_database_id) { 483 int32 idb_database_id) {
475 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 484 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
476 &map_, idb_database_id); 485 &map_, idb_database_id);
477 if (!database) 486 if (!database)
478 return; 487 return;
479 database->close(); 488 database->close();
480 } 489 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
554 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( 563 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
555 &map_, params.idb_index_id); 564 &map_, params.idb_index_id);
556 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 565 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
557 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 566 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
558 if (!idb_transaction || !idb_index) 567 if (!idb_transaction || !idb_index)
559 return; 568 return;
560 569
561 *ec = 0; 570 *ec = 0;
562 scoped_ptr<WebIDBCallbacks> callbacks( 571 scoped_ptr<WebIDBCallbacks> callbacks(
563 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id, -1)); 572 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id,
573 params.response_id, -1));
564 idb_index->openObjectCursor( 574 idb_index->openObjectCursor(
565 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, 575 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
566 params.upper_open), 576 params.upper_open),
567 params.direction, callbacks.release(), *idb_transaction, *ec); 577 params.direction, callbacks.release(), *idb_transaction, *ec);
568 } 578 }
569 579
570 void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor( 580 void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor(
571 const IndexedDBHostMsg_IndexOpenCursor_Params& params, 581 const IndexedDBHostMsg_IndexOpenCursor_Params& params,
572 WebKit::WebExceptionCode* ec) { 582 WebKit::WebExceptionCode* ec) {
573 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
574 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( 584 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
575 &map_, params.idb_index_id); 585 &map_, params.idb_index_id);
576 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 586 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
577 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 587 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
578 if (!idb_transaction || !idb_index) 588 if (!idb_transaction || !idb_index)
579 return; 589 return;
580 590
581 *ec = 0; 591 *ec = 0;
582 scoped_ptr<WebIDBCallbacks> callbacks( 592 scoped_ptr<WebIDBCallbacks> callbacks(
583 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id, -1)); 593 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id,
594 params.response_id, -1));
584 idb_index->openKeyCursor( 595 idb_index->openKeyCursor(
585 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, 596 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
586 params.upper_open), 597 params.upper_open),
587 params.direction, callbacks.release(), *idb_transaction, *ec); 598 params.direction, callbacks.release(), *idb_transaction, *ec);
588 } 599 }
589 600
590 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( 601 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject(
591 int idb_index_id, 602 int idb_index_id,
603 int32 thread_id,
592 int32 response_id, 604 int32 response_id,
593 const IndexedDBKey& key, 605 const IndexedDBKey& key,
594 int32 transaction_id, 606 int32 transaction_id,
595 WebKit::WebExceptionCode* ec) { 607 WebKit::WebExceptionCode* ec) {
596 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 608 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
597 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( 609 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
598 &map_, idb_index_id); 610 &map_, idb_index_id);
599 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 611 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
600 &parent_->transaction_dispatcher_host_->map_, transaction_id); 612 &parent_->transaction_dispatcher_host_->map_, transaction_id);
601 if (!idb_transaction || !idb_index) 613 if (!idb_transaction || !idb_index)
602 return; 614 return;
603 615
604 *ec = 0; 616 *ec = 0;
605 scoped_ptr<WebIDBCallbacks> callbacks( 617 scoped_ptr<WebIDBCallbacks> callbacks(
606 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); 618 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
619 response_id));
607 idb_index->getObject(key, callbacks.release(), *idb_transaction, *ec); 620 idb_index->getObject(key, callbacks.release(), *idb_transaction, *ec);
608 } 621 }
609 622
610 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey( 623 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey(
611 int idb_index_id, 624 int idb_index_id,
625 int32 thread_id,
612 int32 response_id, 626 int32 response_id,
613 const IndexedDBKey& key, 627 const IndexedDBKey& key,
614 int32 transaction_id, 628 int32 transaction_id,
615 WebKit::WebExceptionCode* ec) { 629 WebKit::WebExceptionCode* ec) {
616 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 630 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
617 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( 631 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
618 &map_, idb_index_id); 632 &map_, idb_index_id);
619 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 633 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
620 &parent_->transaction_dispatcher_host_->map_, transaction_id); 634 &parent_->transaction_dispatcher_host_->map_, transaction_id);
621 if (!idb_transaction || !idb_index) 635 if (!idb_transaction || !idb_index)
622 return; 636 return;
623 637
624 *ec = 0; 638 *ec = 0;
625 scoped_ptr<WebIDBCallbacks> callbacks( 639 scoped_ptr<WebIDBCallbacks> callbacks(
626 new IndexedDBCallbacks<WebIDBKey>(parent_, response_id)); 640 new IndexedDBCallbacks<WebIDBKey>(parent_, thread_id, response_id));
627 idb_index->getKey(key, callbacks.release(), *idb_transaction, *ec); 641 idb_index->getKey(key, callbacks.release(), *idb_transaction, *ec);
628 } 642 }
629 643
630 void IndexedDBDispatcherHost::IndexDispatcherHost::OnDestroyed( 644 void IndexedDBDispatcherHost::IndexDispatcherHost::OnDestroyed(
631 int32 object_id) { 645 int32 object_id) {
632 parent_->DestroyObject(&map_, object_id); 646 parent_->DestroyObject(&map_, object_id);
633 } 647 }
634 648
635 ////////////////////////////////////////////////////////////////////// 649 //////////////////////////////////////////////////////////////////////
636 // IndexedDBDispatcherHost::ObjectStoreDispatcherHost 650 // IndexedDBDispatcherHost::ObjectStoreDispatcherHost
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 return; 707 return;
694 708
695 WebDOMStringList web_index_names = idb_object_store->indexNames(); 709 WebDOMStringList web_index_names = idb_object_store->indexNames();
696 index_names->reserve(web_index_names.length()); 710 index_names->reserve(web_index_names.length());
697 for (unsigned i = 0; i < web_index_names.length(); ++i) 711 for (unsigned i = 0; i < web_index_names.length(); ++i)
698 index_names->push_back(web_index_names.item(i)); 712 index_names->push_back(web_index_names.item(i));
699 } 713 }
700 714
701 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet( 715 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet(
702 int idb_object_store_id, 716 int idb_object_store_id,
717 int32 thread_id,
703 int32 response_id, 718 int32 response_id,
704 const IndexedDBKey& key, 719 const IndexedDBKey& key,
705 int32 transaction_id, 720 int32 transaction_id,
706 WebKit::WebExceptionCode* ec) { 721 WebKit::WebExceptionCode* ec) {
707 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 722 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
708 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 723 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
709 &map_, idb_object_store_id); 724 &map_, idb_object_store_id);
710 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 725 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
711 &parent_->transaction_dispatcher_host_->map_, transaction_id); 726 &parent_->transaction_dispatcher_host_->map_, transaction_id);
712 if (!idb_transaction || !idb_object_store) 727 if (!idb_transaction || !idb_object_store)
713 return; 728 return;
714 729
715 *ec = 0; 730 *ec = 0;
716 scoped_ptr<WebIDBCallbacks> callbacks( 731 scoped_ptr<WebIDBCallbacks> callbacks(
717 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); 732 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
733 response_id));
718 idb_object_store->get(key, callbacks.release(), *idb_transaction, *ec); 734 idb_object_store->get(key, callbacks.release(), *idb_transaction, *ec);
719 } 735 }
720 736
721 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut( 737 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut(
722 const IndexedDBHostMsg_ObjectStorePut_Params& params, 738 const IndexedDBHostMsg_ObjectStorePut_Params& params,
723 WebKit::WebExceptionCode* ec) { 739 WebKit::WebExceptionCode* ec) {
724 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 740 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
725 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 741 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
726 &map_, params.idb_object_store_id); 742 &map_, params.idb_object_store_id);
727 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 743 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
728 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 744 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
729 if (!idb_transaction || !idb_object_store) 745 if (!idb_transaction || !idb_object_store)
730 return; 746 return;
731 747
732 *ec = 0; 748 *ec = 0;
733 scoped_ptr<WebIDBCallbacks> callbacks( 749 scoped_ptr<WebIDBCallbacks> callbacks(
734 new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id)); 750 new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id,
751 params.response_id));
735 idb_object_store->put(params.serialized_value, params.key, params.put_mode, 752 idb_object_store->put(params.serialized_value, params.key, params.put_mode,
736 callbacks.release(), *idb_transaction, *ec); 753 callbacks.release(), *idb_transaction, *ec);
737 if (*ec) 754 if (*ec)
738 return; 755 return;
739 int64 size = UTF16ToUTF8(params.serialized_value.data()).size(); 756 int64 size = UTF16ToUTF8(params.serialized_value.data()).size();
740 WebIDBTransactionIDToSizeMap* map = 757 WebIDBTransactionIDToSizeMap* map =
741 &parent_->transaction_dispatcher_host_->transaction_size_map_; 758 &parent_->transaction_dispatcher_host_->transaction_size_map_;
742 (*map)[params.transaction_id] += size; 759 (*map)[params.transaction_id] += size;
743 } 760 }
744 761
745 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete( 762 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete(
746 int idb_object_store_id, 763 int idb_object_store_id,
764 int32 thread_id,
747 int32 response_id, 765 int32 response_id,
748 const IndexedDBKey& key, 766 const IndexedDBKey& key,
749 int32 transaction_id, 767 int32 transaction_id,
750 WebKit::WebExceptionCode* ec) { 768 WebKit::WebExceptionCode* ec) {
751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 769 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
752 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 770 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
753 &map_, idb_object_store_id); 771 &map_, idb_object_store_id);
754 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 772 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
755 &parent_->transaction_dispatcher_host_->map_, transaction_id); 773 &parent_->transaction_dispatcher_host_->map_, transaction_id);
756 if (!idb_transaction || !idb_object_store) 774 if (!idb_transaction || !idb_object_store)
757 return; 775 return;
758 776
759 *ec = 0; 777 *ec = 0;
760 scoped_ptr<WebIDBCallbacks> callbacks( 778 scoped_ptr<WebIDBCallbacks> callbacks(
761 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); 779 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
780 response_id));
762 idb_object_store->deleteFunction( 781 idb_object_store->deleteFunction(
763 key, callbacks.release(), *idb_transaction, *ec); 782 key, callbacks.release(), *idb_transaction, *ec);
764 } 783 }
765 784
766 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnClear( 785 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnClear(
767 int idb_object_store_id, 786 int idb_object_store_id,
787 int32 thread_id,
768 int32 response_id, 788 int32 response_id,
769 int32 transaction_id, 789 int32 transaction_id,
770 WebKit::WebExceptionCode* ec) { 790 WebKit::WebExceptionCode* ec) {
771 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 791 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
772 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 792 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
773 &map_, idb_object_store_id); 793 &map_, idb_object_store_id);
774 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 794 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
775 &parent_->transaction_dispatcher_host_->map_, transaction_id); 795 &parent_->transaction_dispatcher_host_->map_, transaction_id);
776 if (!idb_transaction || !idb_object_store) 796 if (!idb_transaction || !idb_object_store)
777 return; 797 return;
778 798
779 *ec = 0; 799 *ec = 0;
780 scoped_ptr<WebIDBCallbacks> callbacks( 800 scoped_ptr<WebIDBCallbacks> callbacks(
781 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); 801 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
802 response_id));
782 idb_object_store->clear(callbacks.release(), *idb_transaction, *ec); 803 idb_object_store->clear(callbacks.release(), *idb_transaction, *ec);
783 } 804 }
784 805
785 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex( 806 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex(
786 const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params, 807 const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params,
787 int32* index_id, WebKit::WebExceptionCode* ec) { 808 int32* index_id, WebKit::WebExceptionCode* ec) {
788 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 809 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
789 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 810 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
790 &map_, params.idb_object_store_id); 811 &map_, params.idb_object_store_id);
791 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 812 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 866 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
846 &parent_->object_store_dispatcher_host_->map_, 867 &parent_->object_store_dispatcher_host_->map_,
847 params.idb_object_store_id); 868 params.idb_object_store_id);
848 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 869 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
849 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 870 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
850 if (!idb_transaction || !idb_object_store) 871 if (!idb_transaction || !idb_object_store)
851 return; 872 return;
852 873
853 *ec = 0; 874 *ec = 0;
854 scoped_ptr<WebIDBCallbacks> callbacks( 875 scoped_ptr<WebIDBCallbacks> callbacks(
855 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id, -1)); 876 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id,
877 params.response_id, -1));
856 idb_object_store->openCursor( 878 idb_object_store->openCursor(
857 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, 879 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
858 params.upper_open), 880 params.upper_open),
859 params.direction, callbacks.release(), *idb_transaction, *ec); 881 params.direction, callbacks.release(), *idb_transaction, *ec);
860 } 882 }
861 883
862 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed( 884 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed(
863 int32 object_id) { 885 int32 object_id) {
864 parent_->DestroyObject(&map_, object_id); 886 parent_->DestroyObject(&map_, object_id);
865 } 887 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 content::SerializedScriptValue* script_value) { 954 content::SerializedScriptValue* script_value) {
933 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id); 955 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id);
934 if (!idb_cursor) 956 if (!idb_cursor)
935 return; 957 return;
936 958
937 *script_value = content::SerializedScriptValue(idb_cursor->value()); 959 *script_value = content::SerializedScriptValue(idb_cursor->value());
938 } 960 }
939 961
940 void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate( 962 void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate(
941 int32 cursor_id, 963 int32 cursor_id,
964 int32 thread_id,
942 int32 response_id, 965 int32 response_id,
943 const content::SerializedScriptValue& value, 966 const content::SerializedScriptValue& value,
944 WebKit::WebExceptionCode* ec) { 967 WebKit::WebExceptionCode* ec) {
945 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 968 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
946 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 969 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
947 if (!idb_cursor) 970 if (!idb_cursor)
948 return; 971 return;
949 972
950 *ec = 0; 973 *ec = 0;
951 idb_cursor->update( 974 idb_cursor->update(
952 value, new IndexedDBCallbacks<WebIDBKey>(parent_, response_id), *ec); 975 value, new IndexedDBCallbacks<WebIDBKey>(parent_, thread_id, response_id),
976 *ec);
953 } 977 }
954 978
955 void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue( 979 void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue(
956 int32 cursor_id, 980 int32 cursor_id,
981 int32 thread_id,
957 int32 response_id, 982 int32 response_id,
958 const IndexedDBKey& key, 983 const IndexedDBKey& key,
959 WebKit::WebExceptionCode* ec) { 984 WebKit::WebExceptionCode* ec) {
960 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 985 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
961 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 986 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
962 if (!idb_cursor) 987 if (!idb_cursor)
963 return; 988 return;
964 989
965 *ec = 0; 990 *ec = 0;
966 idb_cursor->continueFunction( 991 idb_cursor->continueFunction(
967 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id, 992 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, thread_id, response_id,
968 cursor_id), *ec); 993 cursor_id), *ec);
969 } 994 }
970 995
971 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch( 996 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch(
972 int32 cursor_id, 997 int32 cursor_id,
998 int32 thread_id,
973 int32 response_id, 999 int32 response_id,
974 int n, 1000 int n,
975 WebKit::WebExceptionCode* ec) { 1001 WebKit::WebExceptionCode* ec) {
976 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1002 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
977 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 1003 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
978 if (!idb_cursor) 1004 if (!idb_cursor)
979 return; 1005 return;
980 1006
981 *ec = 0; 1007 *ec = 0;
982 idb_cursor->prefetchContinue( 1008 idb_cursor->prefetchContinue(
983 n, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id, 1009 n, new IndexedDBCallbacks<WebIDBCursor>(parent_, thread_id, response_id,
984 cursor_id), *ec); 1010 cursor_id), *ec);
985 } 1011 }
986 1012
987 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset( 1013 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset(
988 int32 cursor_id, int used_prefetches, int unused_prefetches) { 1014 int32 cursor_id, int used_prefetches, int unused_prefetches) {
989 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1015 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
990 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 1016 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
991 if (!idb_cursor) 1017 if (!idb_cursor)
992 return; 1018 return;
993 1019
994 idb_cursor->prefetchReset(used_prefetches, unused_prefetches); 1020 idb_cursor->prefetchReset(used_prefetches, unused_prefetches);
995 } 1021 }
996 1022
997 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( 1023 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete(
998 int32 cursor_id, 1024 int32 cursor_id,
1025 int32 thread_id,
999 int32 response_id, 1026 int32 response_id,
1000 WebKit::WebExceptionCode* ec) { 1027 WebKit::WebExceptionCode* ec) {
1001 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 1028 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
1002 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 1029 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
1003 if (!idb_cursor) 1030 if (!idb_cursor)
1004 return; 1031 return;
1005 1032
1006 *ec = 0; 1033 *ec = 0;
1007 idb_cursor->deleteFunction( 1034 idb_cursor->deleteFunction(
1008 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id), *e c); 1035 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
1036 response_id), *ec);
1009 } 1037 }
1010 1038
1011 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( 1039 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed(
1012 int32 object_id) { 1040 int32 object_id) {
1013 parent_->DestroyObject(&map_, object_id); 1041 parent_->DestroyObject(&map_, object_id);
1014 } 1042 }
1015 1043
1016 ////////////////////////////////////////////////////////////////////// 1044 //////////////////////////////////////////////////////////////////////
1017 // IndexedDBDispatcherHost::TransactionDispatcherHost 1045 // IndexedDBDispatcherHost::TransactionDispatcherHost
1018 // 1046 //
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 } 1132 }
1105 idb_transaction->didCompleteTaskEvents(); 1133 idb_transaction->didCompleteTaskEvents();
1106 } 1134 }
1107 1135
1108 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1136 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1109 int32 object_id) { 1137 int32 object_id) {
1110 transaction_size_map_.erase(object_id); 1138 transaction_size_map_.erase(object_id);
1111 transaction_url_map_.erase(object_id); 1139 transaction_url_map_.erase(object_id);
1112 parent_->DestroyObject(&map_, object_id); 1140 parent_->DestroyObject(&map_, object_id);
1113 } 1141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698