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/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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 const IPC::Message& message, bool* msg_is_ok) { | 699 const IPC::Message& message, bool* msg_is_ok) { |
700 bool handled = true; | 700 bool handled = true; |
701 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::ObjectStoreDispatcherHost, | 701 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::ObjectStoreDispatcherHost, |
702 message, *msg_is_ok) | 702 message, *msg_is_ok) |
703 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreName, OnName) | 703 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreName, OnName) |
704 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreKeyPath, OnKeyPath) | 704 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreKeyPath, OnKeyPath) |
705 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndexNames, OnIndexNames) | 705 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndexNames, OnIndexNames) |
706 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreGet, OnGet) | 706 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreGet, OnGet) |
707 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePut, OnPut) | 707 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePut, OnPut) |
708 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDelete, OnDelete) | 708 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDelete, OnDelete) |
| 709 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteRange, OnDeleteRange) |
709 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreClear, OnClear) | 710 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreClear, OnClear) |
710 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCreateIndex, OnCreateIndex) | 711 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCreateIndex, OnCreateIndex) |
711 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndex, OnIndex) | 712 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndex, OnIndex) |
712 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndex, OnDeleteIndex) | 713 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndex, OnDeleteIndex) |
713 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreOpenCursor, OnOpenCursor) | 714 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreOpenCursor, OnOpenCursor) |
714 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCount, OnCount) | 715 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCount, OnCount) |
715 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDestroyed, OnDestroyed) | 716 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDestroyed, OnDestroyed) |
716 IPC_MESSAGE_UNHANDLED(handled = false) | 717 IPC_MESSAGE_UNHANDLED(handled = false) |
717 IPC_END_MESSAGE_MAP() | 718 IPC_END_MESSAGE_MAP() |
718 return handled; | 719 return handled; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 return; | 812 return; |
812 | 813 |
813 *ec = 0; | 814 *ec = 0; |
814 scoped_ptr<WebIDBCallbacks> callbacks( | 815 scoped_ptr<WebIDBCallbacks> callbacks( |
815 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, | 816 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, |
816 response_id)); | 817 response_id)); |
817 idb_object_store->deleteFunction( | 818 idb_object_store->deleteFunction( |
818 key, callbacks.release(), *idb_transaction, *ec); | 819 key, callbacks.release(), *idb_transaction, *ec); |
819 } | 820 } |
820 | 821 |
| 822 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDeleteRange( |
| 823 int idb_object_store_id, |
| 824 int32 thread_id, |
| 825 int32 response_id, |
| 826 const IndexedDBKeyRange& key_range, |
| 827 int32 transaction_id, |
| 828 WebKit::WebExceptionCode* ec) { |
| 829 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 830 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( |
| 831 &map_, idb_object_store_id); |
| 832 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
| 833 &parent_->transaction_dispatcher_host_->map_, transaction_id); |
| 834 if (!idb_transaction || !idb_object_store) |
| 835 return; |
| 836 |
| 837 *ec = 0; |
| 838 scoped_ptr<WebIDBCallbacks> callbacks( |
| 839 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, |
| 840 response_id)); |
| 841 idb_object_store->deleteFunction( |
| 842 key_range, callbacks.release(), *idb_transaction, *ec); |
| 843 } |
| 844 |
821 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnClear( | 845 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnClear( |
822 int idb_object_store_id, | 846 int idb_object_store_id, |
823 int32 thread_id, | 847 int32 thread_id, |
824 int32 response_id, | 848 int32 response_id, |
825 int32 transaction_id, | 849 int32 transaction_id, |
826 WebKit::WebExceptionCode* ec) { | 850 WebKit::WebExceptionCode* ec) { |
827 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 851 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
828 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( | 852 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( |
829 &map_, idb_object_store_id); | 853 &map_, idb_object_store_id); |
830 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 854 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 } | 1215 } |
1192 idb_transaction->didCompleteTaskEvents(); | 1216 idb_transaction->didCompleteTaskEvents(); |
1193 } | 1217 } |
1194 | 1218 |
1195 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1219 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
1196 int32 object_id) { | 1220 int32 object_id) { |
1197 transaction_size_map_.erase(object_id); | 1221 transaction_size_map_.erase(object_id); |
1198 transaction_url_map_.erase(object_id); | 1222 transaction_url_map_.erase(object_id); |
1199 parent_->DestroyObject(&map_, object_id); | 1223 parent_->DestroyObject(&map_, object_id); |
1200 } | 1224 } |
OLD | NEW |