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/guid.h" | 10 #include "base/guid.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 OnCreateObjectStore) | 501 OnCreateObjectStore) |
502 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, | 502 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, |
503 OnDeleteObjectStore) | 503 OnDeleteObjectStore) |
504 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateTransaction, | 504 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateTransaction, |
505 OnCreateTransaction) | 505 OnCreateTransaction) |
506 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) | 506 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) |
507 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseVersionChangeIgnored, | 507 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseVersionChangeIgnored, |
508 OnVersionChangeIgnored) | 508 OnVersionChangeIgnored) |
509 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) | 509 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) |
510 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGet, OnGet) | 510 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGet, OnGet) |
| 511 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGetAll, OnGetAll) |
511 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabasePut, OnPutWrapper) | 512 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabasePut, OnPutWrapper) |
512 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetIndexKeys, OnSetIndexKeys) | 513 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetIndexKeys, OnSetIndexKeys) |
513 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetIndexesReady, | 514 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetIndexesReady, |
514 OnSetIndexesReady) | 515 OnSetIndexesReady) |
515 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseOpenCursor, OnOpenCursor) | 516 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseOpenCursor, OnOpenCursor) |
516 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCount, OnCount) | 517 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCount, OnCount) |
517 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteRange, OnDeleteRange) | 518 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteRange, OnDeleteRange) |
518 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClear, OnClear) | 519 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClear, OnClear) |
519 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateIndex, OnCreateIndex) | 520 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateIndex, OnCreateIndex) |
520 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteIndex, OnDeleteIndex) | 521 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteIndex, OnDeleteIndex) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 640 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
640 connection->database()->Get( | 641 connection->database()->Get( |
641 parent_->HostTransactionId(params.transaction_id), | 642 parent_->HostTransactionId(params.transaction_id), |
642 params.object_store_id, | 643 params.object_store_id, |
643 params.index_id, | 644 params.index_id, |
644 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), | 645 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), |
645 params.key_only, | 646 params.key_only, |
646 callbacks); | 647 callbacks); |
647 } | 648 } |
648 | 649 |
| 650 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGetAll( |
| 651 const IndexedDBHostMsg_DatabaseGetAll_Params& params) { |
| 652 DCHECK( |
| 653 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 654 IndexedDBConnection* connection = |
| 655 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 656 if (!connection || !connection->IsConnected()) |
| 657 return; |
| 658 |
| 659 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
| 660 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| 661 connection->database()->GetAll( |
| 662 parent_->HostTransactionId(params.transaction_id), params.object_store_id, |
| 663 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), |
| 664 params.max_count, callbacks); |
| 665 } |
| 666 |
649 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPutWrapper( | 667 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPutWrapper( |
650 const IndexedDBHostMsg_DatabasePut_Params& params) { | 668 const IndexedDBHostMsg_DatabasePut_Params& params) { |
651 std::vector<storage::BlobDataHandle*> handles; | 669 std::vector<storage::BlobDataHandle*> handles; |
652 for (size_t i = 0; i < params.value.blob_or_file_info.size(); ++i) { | 670 for (size_t i = 0; i < params.value.blob_or_file_info.size(); ++i) { |
653 const IndexedDBMsg_BlobOrFileInfo& info = params.value.blob_or_file_info[i]; | 671 const IndexedDBMsg_BlobOrFileInfo& info = params.value.blob_or_file_info[i]; |
654 handles.push_back(parent_->blob_storage_context_->context() | 672 handles.push_back(parent_->blob_storage_context_->context() |
655 ->GetBlobDataFromUUID(info.uuid) | 673 ->GetBlobDataFromUUID(info.uuid) |
656 .release()); | 674 .release()); |
657 } | 675 } |
658 parent_->indexed_db_context_->TaskRunner()->PostTask( | 676 parent_->indexed_db_context_->TaskRunner()->PostTask( |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 } | 1044 } |
1027 | 1045 |
1028 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 1046 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
1029 int32 ipc_object_id) { | 1047 int32 ipc_object_id) { |
1030 DCHECK( | 1048 DCHECK( |
1031 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 1049 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
1032 parent_->DestroyObject(&map_, ipc_object_id); | 1050 parent_->DestroyObject(&map_, ipc_object_id); |
1033 } | 1051 } |
1034 | 1052 |
1035 } // namespace content | 1053 } // namespace content |
OLD | NEW |