| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" | 5 #include "content/browser/indexed_db/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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 return metadata; | 205 return metadata; |
| 206 } | 206 } |
| 207 | 207 |
| 208 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( | 208 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( |
| 209 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { | 209 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { |
| 210 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 210 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 211 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 211 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 212 | 212 |
| 213 Context()->GetIDBFactory()->GetDatabaseNames( | 213 Context()->GetIDBFactory()->GetDatabaseNames( |
| 214 IndexedDBCallbacks::Create( | 214 new IndexedDBCallbacks( |
| 215 this, params.ipc_thread_id, params.ipc_callbacks_id), | 215 this, params.ipc_thread_id, params.ipc_callbacks_id), |
| 216 params.database_identifier, | 216 params.database_identifier, |
| 217 indexed_db_path); | 217 indexed_db_path); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void IndexedDBDispatcherHost::OnIDBFactoryOpen( | 220 void IndexedDBDispatcherHost::OnIDBFactoryOpen( |
| 221 const IndexedDBHostMsg_FactoryOpen_Params& params) { | 221 const IndexedDBHostMsg_FactoryOpen_Params& params) { |
| 222 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 222 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 223 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 223 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 224 | 224 |
| 225 GURL origin_url = | 225 GURL origin_url = |
| 226 webkit_database::GetOriginFromIdentifier(params.database_identifier); | 226 webkit_database::GetOriginFromIdentifier(params.database_identifier); |
| 227 | 227 |
| 228 int64 host_transaction_id = HostTransactionId(params.transaction_id); | 228 int64 host_transaction_id = HostTransactionId(params.transaction_id); |
| 229 | 229 |
| 230 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore | 230 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
| 231 // created) if this origin is already over quota. | 231 // created) if this origin is already over quota. |
| 232 scoped_refptr<IndexedDBCallbacks> callbacks = | 232 scoped_refptr<IndexedDBCallbacks> callbacks = |
| 233 IndexedDBCallbacks::Create(this, | 233 new IndexedDBCallbacks(this, |
| 234 params.ipc_thread_id, | 234 params.ipc_thread_id, |
| 235 params.ipc_callbacks_id, | 235 params.ipc_callbacks_id, |
| 236 params.ipc_database_callbacks_id, | 236 params.ipc_database_callbacks_id, |
| 237 host_transaction_id, | 237 host_transaction_id, |
| 238 origin_url); | 238 origin_url); |
| 239 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks = | 239 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks = |
| 240 IndexedDBDatabaseCallbacks::Create( | 240 new IndexedDBDatabaseCallbacks( |
| 241 this, params.ipc_thread_id, params.ipc_database_callbacks_id); | 241 this, params.ipc_thread_id, params.ipc_database_callbacks_id); |
| 242 Context()->GetIDBFactory()-> | 242 Context()->GetIDBFactory()->Open(params.name, |
| 243 Open(params.name, | 243 params.version, |
| 244 params.version, | 244 host_transaction_id, |
| 245 host_transaction_id, | 245 callbacks, |
| 246 callbacks, | 246 database_callbacks, |
| 247 database_callbacks, | 247 params.database_identifier, |
| 248 params.database_identifier, | 248 indexed_db_path); |
| 249 indexed_db_path); | |
| 250 } | 249 } |
| 251 | 250 |
| 252 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( | 251 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( |
| 253 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { | 252 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { |
| 254 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 253 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 255 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 254 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 256 Context()->GetIDBFactory()->DeleteDatabase( | 255 Context()->GetIDBFactory()->DeleteDatabase( |
| 257 params.name, | 256 params.name, |
| 258 IndexedDBCallbacks::Create( | 257 new IndexedDBCallbacks( |
| 259 this, params.ipc_thread_id, params.ipc_callbacks_id), | 258 this, params.ipc_thread_id, params.ipc_callbacks_id), |
| 260 params.database_identifier, | 259 params.database_identifier, |
| 261 indexed_db_path); | 260 indexed_db_path); |
| 262 } | 261 } |
| 263 | 262 |
| 264 void IndexedDBDispatcherHost::FinishTransaction(int64 host_transaction_id, | 263 void IndexedDBDispatcherHost::FinishTransaction(int64 host_transaction_id, |
| 265 bool committed) { | 264 bool committed) { |
| 266 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 265 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 267 TransactionIDToURLMap& transaction_url_map = | 266 TransactionIDToURLMap& transaction_url_map = |
| 268 database_dispatcher_host_->transaction_url_map_; | 267 database_dispatcher_host_->transaction_url_map_; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 const IndexedDBHostMsg_DatabaseCreateTransaction_Params& params) { | 454 const IndexedDBHostMsg_DatabaseCreateTransaction_Params& params) { |
| 456 DCHECK( | 455 DCHECK( |
| 457 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 456 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 458 IndexedDBConnection* connection = | 457 IndexedDBConnection* connection = |
| 459 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 458 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 460 if (!connection) | 459 if (!connection) |
| 461 return; | 460 return; |
| 462 | 461 |
| 463 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 462 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
| 464 | 463 |
| 465 connection->database()->CreateTransaction(host_transaction_id, | 464 connection->database()->CreateTransaction( |
| 466 connection, | 465 host_transaction_id, connection, params.object_store_ids, params.mode); |
| 467 params.object_store_ids, | |
| 468 params.mode); | |
| 469 transaction_database_map_[host_transaction_id] = params.ipc_database_id; | 466 transaction_database_map_[host_transaction_id] = params.ipc_database_id; |
| 470 parent_->RegisterTransactionId(host_transaction_id, | 467 parent_->RegisterTransactionId(host_transaction_id, |
| 471 database_url_map_[params.ipc_database_id]); | 468 database_url_map_[params.ipc_database_id]); |
| 472 } | 469 } |
| 473 | 470 |
| 474 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( | 471 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( |
| 475 int32 ipc_database_id) { | 472 int32 ipc_database_id) { |
| 476 DCHECK( | 473 DCHECK( |
| 477 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 474 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 478 IndexedDBConnection* connection = | 475 IndexedDBConnection* connection = |
| (...skipping 16 matching lines...) Expand all Loading... |
| 495 | 492 |
| 496 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGet( | 493 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGet( |
| 497 const IndexedDBHostMsg_DatabaseGet_Params& params) { | 494 const IndexedDBHostMsg_DatabaseGet_Params& params) { |
| 498 DCHECK( | 495 DCHECK( |
| 499 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 496 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 500 IndexedDBConnection* connection = | 497 IndexedDBConnection* connection = |
| 501 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 498 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 502 if (!connection) | 499 if (!connection) |
| 503 return; | 500 return; |
| 504 | 501 |
| 505 scoped_refptr<IndexedDBCallbacks> callbacks(IndexedDBCallbacks::Create( | 502 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
| 506 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 503 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| 507 connection->database()->Get( | 504 connection->database()->Get( |
| 508 parent_->HostTransactionId(params.transaction_id), | 505 parent_->HostTransactionId(params.transaction_id), |
| 509 params.object_store_id, | 506 params.object_store_id, |
| 510 params.index_id, | 507 params.index_id, |
| 511 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), | 508 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), |
| 512 params.key_only, | 509 params.key_only, |
| 513 callbacks); | 510 callbacks); |
| 514 } | 511 } |
| 515 | 512 |
| 516 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut( | 513 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut( |
| 517 const IndexedDBHostMsg_DatabasePut_Params& params) { | 514 const IndexedDBHostMsg_DatabasePut_Params& params) { |
| 518 DCHECK( | 515 DCHECK( |
| 519 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 516 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 520 | 517 |
| 521 IndexedDBConnection* connection = | 518 IndexedDBConnection* connection = |
| 522 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 519 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 523 if (!connection) | 520 if (!connection) |
| 524 return; | 521 return; |
| 525 scoped_refptr<IndexedDBCallbacks> callbacks(IndexedDBCallbacks::Create( | 522 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
| 526 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 523 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| 527 | 524 |
| 528 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 525 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
| 529 // TODO(alecflett): Avoid a copy here. | 526 // TODO(alecflett): Avoid a copy here. |
| 530 std::string value_copy(params.value); | 527 std::string value_copy(params.value); |
| 531 connection->database()->Put( | 528 connection->database()->Put( |
| 532 host_transaction_id, | 529 host_transaction_id, |
| 533 params.object_store_id, | 530 params.object_store_id, |
| 534 &value_copy, | 531 &value_copy, |
| 535 make_scoped_ptr(new IndexedDBKey(params.key)), | 532 make_scoped_ptr(new IndexedDBKey(params.key)), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 | 586 |
| 590 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpenCursor( | 587 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpenCursor( |
| 591 const IndexedDBHostMsg_DatabaseOpenCursor_Params& params) { | 588 const IndexedDBHostMsg_DatabaseOpenCursor_Params& params) { |
| 592 DCHECK( | 589 DCHECK( |
| 593 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 590 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 594 IndexedDBConnection* connection = | 591 IndexedDBConnection* connection = |
| 595 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 592 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 596 if (!connection) | 593 if (!connection) |
| 597 return; | 594 return; |
| 598 | 595 |
| 599 scoped_refptr<IndexedDBCallbacks> callbacks(IndexedDBCallbacks::Create( | 596 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
| 600 parent_, params.ipc_thread_id, params.ipc_callbacks_id, -1)); | 597 parent_, params.ipc_thread_id, params.ipc_callbacks_id, -1)); |
| 601 connection->database()->OpenCursor( | 598 connection->database()->OpenCursor( |
| 602 parent_->HostTransactionId(params.transaction_id), | 599 parent_->HostTransactionId(params.transaction_id), |
| 603 params.object_store_id, | 600 params.object_store_id, |
| 604 params.index_id, | 601 params.index_id, |
| 605 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), | 602 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), |
| 606 static_cast<indexed_db::CursorDirection>(params.direction), | 603 static_cast<indexed_db::CursorDirection>(params.direction), |
| 607 params.key_only, | 604 params.key_only, |
| 608 static_cast<IndexedDBDatabase::TaskType>(params.task_type), | 605 static_cast<IndexedDBDatabase::TaskType>(params.task_type), |
| 609 callbacks); | 606 callbacks); |
| 610 } | 607 } |
| 611 | 608 |
| 612 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCount( | 609 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCount( |
| 613 const IndexedDBHostMsg_DatabaseCount_Params& params) { | 610 const IndexedDBHostMsg_DatabaseCount_Params& params) { |
| 614 DCHECK( | 611 DCHECK( |
| 615 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 612 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 616 IndexedDBConnection* connection = | 613 IndexedDBConnection* connection = |
| 617 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 614 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 618 if (!connection) | 615 if (!connection) |
| 619 return; | 616 return; |
| 620 | 617 |
| 621 scoped_refptr<IndexedDBCallbacks> callbacks(IndexedDBCallbacks::Create( | 618 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
| 622 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 619 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| 623 connection->database()->Count( | 620 connection->database()->Count( |
| 624 parent_->HostTransactionId(params.transaction_id), | 621 parent_->HostTransactionId(params.transaction_id), |
| 625 params.object_store_id, | 622 params.object_store_id, |
| 626 params.index_id, | 623 params.index_id, |
| 627 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), | 624 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), |
| 628 callbacks); | 625 callbacks); |
| 629 } | 626 } |
| 630 | 627 |
| 631 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteRange( | 628 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteRange( |
| 632 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params) { | 629 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params) { |
| 633 DCHECK( | 630 DCHECK( |
| 634 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 631 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 635 IndexedDBConnection* connection = | 632 IndexedDBConnection* connection = |
| 636 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 633 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 637 if (!connection) | 634 if (!connection) |
| 638 return; | 635 return; |
| 639 | 636 |
| 640 scoped_refptr<IndexedDBCallbacks> callbacks(IndexedDBCallbacks::Create( | 637 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
| 641 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 638 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| 642 connection->database()->DeleteRange( | 639 connection->database()->DeleteRange( |
| 643 parent_->HostTransactionId(params.transaction_id), | 640 parent_->HostTransactionId(params.transaction_id), |
| 644 params.object_store_id, | 641 params.object_store_id, |
| 645 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), | 642 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), |
| 646 callbacks); | 643 callbacks); |
| 647 } | 644 } |
| 648 | 645 |
| 649 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClear( | 646 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClear( |
| 650 int32 ipc_thread_id, | 647 int32 ipc_thread_id, |
| 651 int32 ipc_callbacks_id, | 648 int32 ipc_callbacks_id, |
| 652 int32 ipc_database_id, | 649 int32 ipc_database_id, |
| 653 int64 transaction_id, | 650 int64 transaction_id, |
| 654 int64 object_store_id) { | 651 int64 object_store_id) { |
| 655 DCHECK( | 652 DCHECK( |
| 656 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 653 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 657 IndexedDBConnection* connection = | 654 IndexedDBConnection* connection = |
| 658 parent_->GetOrTerminateProcess(&map_, ipc_database_id); | 655 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 659 if (!connection) | 656 if (!connection) |
| 660 return; | 657 return; |
| 661 | 658 |
| 662 scoped_refptr<IndexedDBCallbacks> callbacks( | 659 scoped_refptr<IndexedDBCallbacks> callbacks( |
| 663 IndexedDBCallbacks::Create(parent_, ipc_thread_id, ipc_callbacks_id)); | 660 new IndexedDBCallbacks(parent_, ipc_thread_id, ipc_callbacks_id)); |
| 664 | 661 |
| 665 connection->database()->Clear( | 662 connection->database()->Clear( |
| 666 parent_->HostTransactionId(transaction_id), object_store_id, callbacks); | 663 parent_->HostTransactionId(transaction_id), object_store_id, callbacks); |
| 667 } | 664 } |
| 668 | 665 |
| 669 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnAbort( | 666 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnAbort( |
| 670 int32 ipc_database_id, | 667 int32 ipc_database_id, |
| 671 int64 transaction_id) { | 668 int64 transaction_id) { |
| 672 DCHECK( | 669 DCHECK( |
| 673 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 670 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 unsigned long count) { | 784 unsigned long count) { |
| 788 DCHECK( | 785 DCHECK( |
| 789 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 786 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 790 IndexedDBCursor* idb_cursor = | 787 IndexedDBCursor* idb_cursor = |
| 791 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | 788 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); |
| 792 if (!idb_cursor) | 789 if (!idb_cursor) |
| 793 return; | 790 return; |
| 794 | 791 |
| 795 idb_cursor->Advance( | 792 idb_cursor->Advance( |
| 796 count, | 793 count, |
| 797 IndexedDBCallbacks::Create( | 794 new IndexedDBCallbacks( |
| 798 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); | 795 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); |
| 799 } | 796 } |
| 800 | 797 |
| 801 void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue( | 798 void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue( |
| 802 int32 ipc_cursor_id, | 799 int32 ipc_cursor_id, |
| 803 int32 ipc_thread_id, | 800 int32 ipc_thread_id, |
| 804 int32 ipc_callbacks_id, | 801 int32 ipc_callbacks_id, |
| 805 const IndexedDBKey& key) { | 802 const IndexedDBKey& key) { |
| 806 DCHECK( | 803 DCHECK( |
| 807 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 804 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 808 IndexedDBCursor* idb_cursor = | 805 IndexedDBCursor* idb_cursor = |
| 809 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | 806 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); |
| 810 if (!idb_cursor) | 807 if (!idb_cursor) |
| 811 return; | 808 return; |
| 812 | 809 |
| 813 idb_cursor->Continue( | 810 idb_cursor->Continue( |
| 814 make_scoped_ptr(new IndexedDBKey(key)), | 811 make_scoped_ptr(new IndexedDBKey(key)), |
| 815 IndexedDBCallbacks::Create( | 812 new IndexedDBCallbacks( |
| 816 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); | 813 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); |
| 817 } | 814 } |
| 818 | 815 |
| 819 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch( | 816 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch( |
| 820 int32 ipc_cursor_id, | 817 int32 ipc_cursor_id, |
| 821 int32 ipc_thread_id, | 818 int32 ipc_thread_id, |
| 822 int32 ipc_callbacks_id, | 819 int32 ipc_callbacks_id, |
| 823 int n) { | 820 int n) { |
| 824 DCHECK( | 821 DCHECK( |
| 825 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 822 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 826 IndexedDBCursor* idb_cursor = | 823 IndexedDBCursor* idb_cursor = |
| 827 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | 824 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); |
| 828 if (!idb_cursor) | 825 if (!idb_cursor) |
| 829 return; | 826 return; |
| 830 | 827 |
| 831 idb_cursor->PrefetchContinue( | 828 idb_cursor->PrefetchContinue( |
| 832 n, | 829 n, |
| 833 IndexedDBCallbacks::Create( | 830 new IndexedDBCallbacks( |
| 834 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); | 831 parent_, ipc_thread_id, ipc_callbacks_id, ipc_cursor_id)); |
| 835 } | 832 } |
| 836 | 833 |
| 837 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset( | 834 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset( |
| 838 int32 ipc_cursor_id, | 835 int32 ipc_cursor_id, |
| 839 int used_prefetches, | 836 int used_prefetches, |
| 840 int unused_prefetches) { | 837 int unused_prefetches) { |
| 841 DCHECK( | 838 DCHECK( |
| 842 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 839 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 843 IndexedDBCursor* idb_cursor = | 840 IndexedDBCursor* idb_cursor = |
| 844 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | 841 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); |
| 845 if (!idb_cursor) | 842 if (!idb_cursor) |
| 846 return; | 843 return; |
| 847 | 844 |
| 848 idb_cursor->PrefetchReset(used_prefetches, unused_prefetches); | 845 idb_cursor->PrefetchReset(used_prefetches, unused_prefetches); |
| 849 } | 846 } |
| 850 | 847 |
| 851 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 848 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
| 852 int32 ipc_object_id) { | 849 int32 ipc_object_id) { |
| 853 DCHECK( | 850 DCHECK( |
| 854 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 851 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 855 parent_->DestroyObject(&map_, ipc_object_id); | 852 parent_->DestroyObject(&map_, ipc_object_id); |
| 856 } | 853 } |
| 857 | 854 |
| 858 } // namespace content | 855 } // namespace content |
| OLD | NEW |