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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 } | 879 } |
880 | 880 |
881 bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( | 881 bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( |
882 const IPC::Message& message, bool* msg_is_ok) { | 882 const IPC::Message& message, bool* msg_is_ok) { |
883 bool handled = true; | 883 bool handled = true; |
884 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::CursorDispatcherHost, | 884 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::CursorDispatcherHost, |
885 message, *msg_is_ok) | 885 message, *msg_is_ok) |
886 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDirection, OnDirection) | 886 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDirection, OnDirection) |
887 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorUpdate, OnUpdate) | 887 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorUpdate, OnUpdate) |
888 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorContinue, OnContinue) | 888 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorContinue, OnContinue) |
| 889 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorPrefetch, OnPrefetch) |
| 890 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorPrefetchReset, OnPrefetchReset) |
889 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDelete, OnDelete) | 891 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDelete, OnDelete) |
890 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDestroyed, OnDestroyed) | 892 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDestroyed, OnDestroyed) |
891 IPC_MESSAGE_UNHANDLED(handled = false) | 893 IPC_MESSAGE_UNHANDLED(handled = false) |
892 IPC_END_MESSAGE_MAP() | 894 IPC_END_MESSAGE_MAP() |
893 return handled; | 895 return handled; |
894 } | 896 } |
895 | 897 |
896 | 898 |
897 void IndexedDBDispatcherHost::CursorDispatcherHost::Send( | 899 void IndexedDBDispatcherHost::CursorDispatcherHost::Send( |
898 IPC::Message* message) { | 900 IPC::Message* message) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); | 962 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
961 if (!idb_cursor) | 963 if (!idb_cursor) |
962 return; | 964 return; |
963 | 965 |
964 *ec = 0; | 966 *ec = 0; |
965 idb_cursor->continueFunction( | 967 idb_cursor->continueFunction( |
966 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id, | 968 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id, |
967 cursor_id), *ec); | 969 cursor_id), *ec); |
968 } | 970 } |
969 | 971 |
| 972 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch( |
| 973 int32 cursor_id, |
| 974 int32 response_id, |
| 975 int n, |
| 976 WebKit::WebExceptionCode* ec) { |
| 977 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 978 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
| 979 if (!idb_cursor) |
| 980 return; |
| 981 |
| 982 *ec = 0; |
| 983 idb_cursor->prefetchContinue( |
| 984 n, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id, |
| 985 cursor_id), *ec); |
| 986 } |
| 987 |
| 988 void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset( |
| 989 int32 cursor_id, int used_prefetches, int unused_prefetches) { |
| 990 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 991 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
| 992 if (!idb_cursor) |
| 993 return; |
| 994 |
| 995 idb_cursor->prefetchReset(used_prefetches, unused_prefetches); |
| 996 } |
| 997 |
970 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( | 998 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( |
971 int32 cursor_id, | 999 int32 cursor_id, |
972 int32 response_id, | 1000 int32 response_id, |
973 WebKit::WebExceptionCode* ec) { | 1001 WebKit::WebExceptionCode* ec) { |
974 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 1002 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
975 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); | 1003 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
976 if (!idb_cursor) | 1004 if (!idb_cursor) |
977 return; | 1005 return; |
978 | 1006 |
979 *ec = 0; | 1007 *ec = 0; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 } | 1105 } |
1078 idb_transaction->didCompleteTaskEvents(); | 1106 idb_transaction->didCompleteTaskEvents(); |
1079 } | 1107 } |
1080 | 1108 |
1081 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1109 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
1082 int32 object_id) { | 1110 int32 object_id) { |
1083 transaction_size_map_.erase(object_id); | 1111 transaction_size_map_.erase(object_id); |
1084 transaction_url_map_.erase(object_id); | 1112 transaction_url_map_.erase(object_id); |
1085 parent_->DestroyObject(&map_, object_id); | 1113 parent_->DestroyObject(&map_, object_id); |
1086 } | 1114 } |
OLD | NEW |