| 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 <vector> | 7 #include <vector> |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 using WebKit::WebIDBDatabase; | 42 using WebKit::WebIDBDatabase; |
| 43 using WebKit::WebIDBDatabaseError; | 43 using WebKit::WebIDBDatabaseError; |
| 44 using WebKit::WebIDBKey; | 44 using WebKit::WebIDBKey; |
| 45 using WebKit::WebIDBMetadata; | 45 using WebKit::WebIDBMetadata; |
| 46 using WebKit::WebString; | 46 using WebKit::WebString; |
| 47 using WebKit::WebVector; | 47 using WebKit::WebVector; |
| 48 | 48 |
| 49 namespace content { | 49 namespace content { |
| 50 namespace { | 50 namespace { |
| 51 | 51 |
| 52 template <class T> void DeleteOnWebKitThread(T* obj) { | 52 template <class T> |
| 53 void DeleteOnWebKitThread(T* obj) { |
| 53 if (!BrowserThread::DeleteSoon( | 54 if (!BrowserThread::DeleteSoon( |
| 54 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, obj)) | 55 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, obj)) |
| 55 delete obj; | 56 delete obj; |
| 56 } | 57 } |
| 57 } | 58 } |
| 58 | 59 |
| 59 IndexedDBDispatcherHost::IndexedDBDispatcherHost( | 60 IndexedDBDispatcherHost::IndexedDBDispatcherHost( |
| 60 int ipc_process_id, | 61 int ipc_process_id, |
| 61 IndexedDBContextImpl* indexed_db_context) | 62 IndexedDBContextImpl* indexed_db_context) |
| 62 : indexed_db_context_(indexed_db_context), | 63 : indexed_db_context_(indexed_db_context), |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( | 735 bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( |
| 735 const IPC::Message& message, | 736 const IPC::Message& message, |
| 736 bool* msg_is_ok) { | 737 bool* msg_is_ok) { |
| 737 bool handled = true; | 738 bool handled = true; |
| 738 IPC_BEGIN_MESSAGE_MAP_EX( | 739 IPC_BEGIN_MESSAGE_MAP_EX( |
| 739 IndexedDBDispatcherHost::CursorDispatcherHost, message, *msg_is_ok) | 740 IndexedDBDispatcherHost::CursorDispatcherHost, message, *msg_is_ok) |
| 740 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorAdvance, OnAdvance) | 741 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorAdvance, OnAdvance) |
| 741 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorContinue, OnContinue) | 742 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorContinue, OnContinue) |
| 742 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorPrefetch, OnPrefetch) | 743 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorPrefetch, OnPrefetch) |
| 743 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorPrefetchReset, OnPrefetchReset) | 744 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorPrefetchReset, OnPrefetchReset) |
| 744 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDelete, OnDelete) | |
| 745 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDestroyed, OnDestroyed) | 745 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDestroyed, OnDestroyed) |
| 746 IPC_MESSAGE_UNHANDLED(handled = false) | 746 IPC_MESSAGE_UNHANDLED(handled = false) |
| 747 IPC_END_MESSAGE_MAP() | 747 IPC_END_MESSAGE_MAP() |
| 748 return handled; | 748 return handled; |
| 749 } | 749 } |
| 750 | 750 |
| 751 void IndexedDBDispatcherHost::CursorDispatcherHost::Send( | 751 void IndexedDBDispatcherHost::CursorDispatcherHost::Send( |
| 752 IPC::Message* message) { | 752 IPC::Message* message) { |
| 753 parent_->Send(message); | 753 parent_->Send(message); |
| 754 } | 754 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 int unused_prefetches) { | 810 int unused_prefetches) { |
| 811 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 811 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 812 WebIDBCursor* idb_cursor = | 812 WebIDBCursor* idb_cursor = |
| 813 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | 813 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); |
| 814 if (!idb_cursor) | 814 if (!idb_cursor) |
| 815 return; | 815 return; |
| 816 | 816 |
| 817 idb_cursor->prefetchReset(used_prefetches, unused_prefetches); | 817 idb_cursor->prefetchReset(used_prefetches, unused_prefetches); |
| 818 } | 818 } |
| 819 | 819 |
| 820 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( | |
| 821 int32 ipc_cursor_id, | |
| 822 int32 ipc_thread_id, | |
| 823 int32 ipc_callbacks_id) { | |
| 824 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | |
| 825 WebIDBCursor* idb_cursor = | |
| 826 parent_->GetOrTerminateProcess(&map_, ipc_cursor_id); | |
| 827 if (!idb_cursor) | |
| 828 return; | |
| 829 | |
| 830 idb_cursor->deleteFunction(new IndexedDBCallbacks<WebData>( | |
| 831 parent_, ipc_thread_id, ipc_callbacks_id)); | |
| 832 } | |
| 833 | |
| 834 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 820 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
| 835 int32 ipc_object_id) { | 821 int32 ipc_object_id) { |
| 836 parent_->DestroyObject(&map_, ipc_object_id); | 822 parent_->DestroyObject(&map_, ipc_object_id); |
| 837 } | 823 } |
| 838 | 824 |
| 839 } // namespace content | 825 } // namespace content |
| OLD | NEW |