| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 } | 875 } |
| 876 | 876 |
| 877 bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( | 877 bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( |
| 878 const IPC::Message& message, bool* msg_is_ok) { | 878 const IPC::Message& message, bool* msg_is_ok) { |
| 879 bool handled = true; | 879 bool handled = true; |
| 880 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::CursorDispatcherHost, | 880 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::CursorDispatcherHost, |
| 881 message, *msg_is_ok) | 881 message, *msg_is_ok) |
| 882 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDirection, OnDirection) | 882 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDirection, OnDirection) |
| 883 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorUpdate, OnUpdate) | 883 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorUpdate, OnUpdate) |
| 884 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorContinue, OnContinue) | 884 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorContinue, OnContinue) |
| 885 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorPrefetch, OnPrefetch) |
| 886 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorPrefetchReset, OnPrefetchReset) |
| 885 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDelete, OnDelete) | 887 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDelete, OnDelete) |
| 886 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDestroyed, OnDestroyed) | 888 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDestroyed, OnDestroyed) |
| 887 IPC_MESSAGE_UNHANDLED(handled = false) | 889 IPC_MESSAGE_UNHANDLED(handled = false) |
| 888 IPC_END_MESSAGE_MAP() | 890 IPC_END_MESSAGE_MAP() |
| 889 return handled; | 891 return handled; |
| 890 } | 892 } |
| 891 | 893 |
| 892 | 894 |
| 893 void IndexedDBDispatcherHost::CursorDispatcherHost::Send( | 895 void IndexedDBDispatcherHost::CursorDispatcherHost::Send( |
| 894 IPC::Message* message) { | 896 IPC::Message* message) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); | 958 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
| 957 if (!idb_cursor) | 959 if (!idb_cursor) |
| 958 return; | 960 return; |
| 959 | 961 |
| 960 *ec = 0; | 962 *ec = 0; |
| 961 idb_cursor->continueFunction( | 963 idb_cursor->continueFunction( |
| 962 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id, | 964 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id, |
| 963 cursor_id), *ec); | 965 cursor_id), *ec); |
| 964 } | 966 } |
| 965 | 967 |
| 968 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch( |
| 969 int32 cursor_id, |
| 970 int32 response_id, |
| 971 int n, |
| 972 WebKit::WebExceptionCode* ec) { |
| 973 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 974 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
| 975 if (!idb_cursor) |
| 976 return; |
| 977 |
| 978 *ec = 0; |
| 979 idb_cursor->prefetchContinue( |
| 980 n, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id, |
| 981 cursor_id), *ec); |
| 982 } |
| 983 |
| 984 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset( |
| 985 int32 cursor_id, int used_prefetches, int unused_prefetches) { |
| 986 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 987 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
| 988 if (!idb_cursor) |
| 989 return; |
| 990 |
| 991 idb_cursor->prefetchReset(used_prefetches, unused_prefetches); |
| 992 } |
| 993 |
| 966 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( | 994 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( |
| 967 int32 cursor_id, | 995 int32 cursor_id, |
| 968 int32 response_id, | 996 int32 response_id, |
| 969 WebKit::WebExceptionCode* ec) { | 997 WebKit::WebExceptionCode* ec) { |
| 970 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 998 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 971 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); | 999 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
| 972 if (!idb_cursor) | 1000 if (!idb_cursor) |
| 973 return; | 1001 return; |
| 974 | 1002 |
| 975 *ec = 0; | 1003 *ec = 0; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 } | 1101 } |
| 1074 idb_transaction->didCompleteTaskEvents(); | 1102 idb_transaction->didCompleteTaskEvents(); |
| 1075 } | 1103 } |
| 1076 | 1104 |
| 1077 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1105 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
| 1078 int32 object_id) { | 1106 int32 object_id) { |
| 1079 transaction_size_map_.erase(object_id); | 1107 transaction_size_map_.erase(object_id); |
| 1080 transaction_url_map_.erase(object_id); | 1108 transaction_url_map_.erase(object_id); |
| 1081 parent_->DestroyObject(&map_, object_id); | 1109 parent_->DestroyObject(&map_, object_id); |
| 1082 } | 1110 } |
| OLD | NEW |