| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, | 513 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, |
| 514 OnCreateObjectStore) | 514 OnCreateObjectStore) |
| 515 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, | 515 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, |
| 516 OnDeleteObjectStore) | 516 OnDeleteObjectStore) |
| 517 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateTransaction, | 517 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateTransaction, |
| 518 OnCreateTransaction) | 518 OnCreateTransaction) |
| 519 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) | 519 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) |
| 520 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseVersionChangeIgnored, | 520 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseVersionChangeIgnored, |
| 521 OnVersionChangeIgnored) | 521 OnVersionChangeIgnored) |
| 522 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) | 522 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) |
| 523 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseObserve, OnObserve) |
| 524 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseUnobserve, OnUnobserve) |
| 523 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGet, OnGet) | 525 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGet, OnGet) |
| 524 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGetAll, OnGetAll) | 526 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGetAll, OnGetAll) |
| 525 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabasePut, OnPutWrapper) | 527 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabasePut, OnPutWrapper) |
| 526 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetIndexKeys, OnSetIndexKeys) | 528 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetIndexKeys, OnSetIndexKeys) |
| 527 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetIndexesReady, | 529 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetIndexesReady, |
| 528 OnSetIndexesReady) | 530 OnSetIndexesReady) |
| 529 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseOpenCursor, OnOpenCursor) | 531 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseOpenCursor, OnOpenCursor) |
| 530 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCount, OnCount) | 532 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCount, OnCount) |
| 531 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteRange, OnDeleteRange) | 533 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteRange, OnDeleteRange) |
| 532 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClear, OnClear) | 534 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClear, OnClear) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 if (!connection) | 624 if (!connection) |
| 623 return; | 625 return; |
| 624 if (connection->IsConnected()) | 626 if (connection->IsConnected()) |
| 625 connection->Close(); | 627 connection->Close(); |
| 626 parent_->context()->ConnectionClosed(database_origin_map_[ipc_object_id], | 628 parent_->context()->ConnectionClosed(database_origin_map_[ipc_object_id], |
| 627 connection); | 629 connection); |
| 628 database_origin_map_.erase(ipc_object_id); | 630 database_origin_map_.erase(ipc_object_id); |
| 629 parent_->DestroyObject(&map_, ipc_object_id); | 631 parent_->DestroyObject(&map_, ipc_object_id); |
| 630 } | 632 } |
| 631 | 633 |
| 634 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnObserve( |
| 635 int32_t ipc_database_id, |
| 636 int64_t transaction_id, |
| 637 int32_t observer_id) { |
| 638 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); |
| 639 IndexedDBConnection* connection = |
| 640 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 641 if (!connection || !connection->IsConnected()) |
| 642 return; |
| 643 connection->database()->AddPendingObserver( |
| 644 parent_->HostTransactionId(transaction_id), observer_id); |
| 645 } |
| 646 |
| 647 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnUnobserve( |
| 648 int32_t ipc_database_id, |
| 649 const std::vector<int32_t>& observer_ids_to_remove) { |
| 650 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); |
| 651 DCHECK(!observer_ids_to_remove.empty()); |
| 652 IndexedDBConnection* connection = |
| 653 parent_->GetOrTerminateProcess(&map_, ipc_database_id); |
| 654 if (!connection || !connection->IsConnected()) |
| 655 return; |
| 656 connection->RemoveObservers(observer_ids_to_remove); |
| 657 } |
| 658 |
| 632 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGet( | 659 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGet( |
| 633 const IndexedDBHostMsg_DatabaseGet_Params& params) { | 660 const IndexedDBHostMsg_DatabaseGet_Params& params) { |
| 634 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); | 661 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); |
| 635 IndexedDBConnection* connection = | 662 IndexedDBConnection* connection = |
| 636 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 663 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
| 637 if (!connection || !connection->IsConnected()) | 664 if (!connection || !connection->IsConnected()) |
| 638 return; | 665 return; |
| 639 | 666 |
| 640 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( | 667 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
| 641 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 668 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 DLOG(ERROR) << "Unable to reset prefetch"; | 1069 DLOG(ERROR) << "Unable to reset prefetch"; |
| 1043 } | 1070 } |
| 1044 | 1071 |
| 1045 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 1072 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
| 1046 int32_t ipc_object_id) { | 1073 int32_t ipc_object_id) { |
| 1047 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); | 1074 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); |
| 1048 parent_->DestroyObject(&map_, ipc_object_id); | 1075 parent_->DestroyObject(&map_, ipc_object_id); |
| 1049 } | 1076 } |
| 1050 | 1077 |
| 1051 } // namespace content | 1078 } // namespace content |
| OLD | NEW |