Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 5 #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
| 9 #include "chrome/browser/in_process_webkit/indexed_db_callbacks.h" | 9 #include "chrome/browser/in_process_webkit/indexed_db_callbacks.h" |
| 10 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 10 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 case ViewHostMsg_IDBObjectStoreIndexNames::ID: | 117 case ViewHostMsg_IDBObjectStoreIndexNames::ID: |
| 118 case ViewHostMsg_IDBObjectStoreGet::ID: | 118 case ViewHostMsg_IDBObjectStoreGet::ID: |
| 119 case ViewHostMsg_IDBObjectStoreOpenCursor::ID: | 119 case ViewHostMsg_IDBObjectStoreOpenCursor::ID: |
| 120 case ViewHostMsg_IDBObjectStorePut::ID: | 120 case ViewHostMsg_IDBObjectStorePut::ID: |
| 121 case ViewHostMsg_IDBObjectStoreRemove::ID: | 121 case ViewHostMsg_IDBObjectStoreRemove::ID: |
| 122 case ViewHostMsg_IDBObjectStoreCreateIndex::ID: | 122 case ViewHostMsg_IDBObjectStoreCreateIndex::ID: |
| 123 case ViewHostMsg_IDBObjectStoreIndex::ID: | 123 case ViewHostMsg_IDBObjectStoreIndex::ID: |
| 124 case ViewHostMsg_IDBObjectStoreRemoveIndex::ID: | 124 case ViewHostMsg_IDBObjectStoreRemoveIndex::ID: |
| 125 case ViewHostMsg_IDBObjectStoreDestroyed::ID: | 125 case ViewHostMsg_IDBObjectStoreDestroyed::ID: |
| 126 case ViewHostMsg_IDBTransactionDestroyed::ID: | 126 case ViewHostMsg_IDBTransactionDestroyed::ID: |
| 127 case ViewHostMsg_IDBTransactionObjectStore::ID: | |
| 127 break; | 128 break; |
| 128 default: | 129 default: |
| 129 return false; | 130 return false; |
| 130 } | 131 } |
| 131 | 132 |
| 132 bool success = ChromeThread::PostTask( | 133 bool success = ChromeThread::PostTask( |
| 133 ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod( | 134 ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod( |
| 134 this, &IndexedDBDispatcherHost::OnMessageReceivedWebKit, message)); | 135 this, &IndexedDBDispatcherHost::OnMessageReceivedWebKit, message)); |
| 135 DCHECK(success); | 136 DCHECK(success); |
| 136 return true; | 137 return true; |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 747 | 748 |
| 748 IndexedDBDispatcherHost:: | 749 IndexedDBDispatcherHost:: |
| 749 TransactionDispatcherHost::~TransactionDispatcherHost() { | 750 TransactionDispatcherHost::~TransactionDispatcherHost() { |
| 750 } | 751 } |
| 751 | 752 |
| 752 bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived( | 753 bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived( |
| 753 const IPC::Message& message, bool* msg_is_ok) { | 754 const IPC::Message& message, bool* msg_is_ok) { |
| 754 bool handled = true; | 755 bool handled = true; |
| 755 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::TransactionDispatcherHost, | 756 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::TransactionDispatcherHost, |
| 756 message, *msg_is_ok) | 757 message, *msg_is_ok) |
| 758 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBTransactionObjectStore, OnObj ectStore) | |
|
jorlow
2010/08/24 08:46:17
>80
| |
| 757 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionDestroyed, OnDestroyed) | 759 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionDestroyed, OnDestroyed) |
| 758 IPC_MESSAGE_UNHANDLED(handled = false) | 760 IPC_MESSAGE_UNHANDLED(handled = false) |
| 759 IPC_END_MESSAGE_MAP() | 761 IPC_END_MESSAGE_MAP() |
| 760 return handled; | 762 return handled; |
| 761 } | 763 } |
| 762 | 764 |
| 763 void IndexedDBDispatcherHost::TransactionDispatcherHost::Send( | 765 void IndexedDBDispatcherHost::TransactionDispatcherHost::Send( |
| 764 IPC::Message* message) { | 766 IPC::Message* message) { |
| 765 // The macro magic in OnMessageReceived requires this to link, but it should | 767 // The macro magic in OnMessageReceived requires this to link, but it should |
| 766 // never actually be called. | 768 // never actually be called. |
| 767 NOTREACHED(); | 769 NOTREACHED(); |
| 768 parent_->Send(message); | 770 parent_->Send(message); |
| 769 } | 771 } |
| 770 | 772 |
| 773 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStore( | |
| 774 int32 transaction_id, const string16& name, IPC::Message* reply_msg) { | |
| 775 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | |
| 776 &map_, transaction_id, reply_msg, | |
| 777 ViewHostMsg_IDBDatabaseObjectStore::ID); | |
| 778 if (!idb_transaction) | |
| 779 return; | |
| 780 | |
| 781 WebIDBObjectStore* object_store = idb_transaction->objectStore(name); | |
| 782 int32 object_id = object_store ? parent_->Add(object_store) : 0; | |
| 783 ViewHostMsg_IDBTransactionObjectStore::WriteReplyParams( | |
| 784 reply_msg, object_id); | |
| 785 parent_->Send(reply_msg); | |
| 786 } | |
| 787 | |
| 771 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 788 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
| 772 int32 object_id) { | 789 int32 object_id) { |
| 773 parent_->DestroyObject( | 790 parent_->DestroyObject( |
| 774 &map_, object_id, ViewHostMsg_IDBTransactionDestroyed::ID); | 791 &map_, object_id, ViewHostMsg_IDBTransactionDestroyed::ID); |
| 775 } | 792 } |
| OLD | NEW |