| 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" |
| 11 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" | 11 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" |
| 12 #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h" | 12 #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h" |
| 13 #include "content/browser/renderer_host/render_message_filter.h" | 13 #include "content/browser/renderer_host/render_message_filter.h" |
| 14 #include "content/browser/user_metrics.h" | |
| 15 #include "content/common/indexed_db_messages.h" | 14 #include "content/common/indexed_db_messages.h" |
| 16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/user_metrics.h" |
| 17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/common/result_codes.h" | 18 #include "content/public/common/result_codes.h" |
| 19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" |
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h
" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h
" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
| 31 #include "webkit/glue/webkit_glue.h" | 31 #include "webkit/glue/webkit_glue.h" |
| 32 | 32 |
| 33 using content::BrowserThread; | 33 using content::BrowserThread; |
| 34 using content::UserMetricsAction; |
| 34 using WebKit::WebDOMStringList; | 35 using WebKit::WebDOMStringList; |
| 35 using WebKit::WebExceptionCode; | 36 using WebKit::WebExceptionCode; |
| 36 using WebKit::WebIDBCallbacks; | 37 using WebKit::WebIDBCallbacks; |
| 37 using WebKit::WebIDBCursor; | 38 using WebKit::WebIDBCursor; |
| 38 using WebKit::WebIDBDatabase; | 39 using WebKit::WebIDBDatabase; |
| 39 using WebKit::WebIDBDatabaseError; | 40 using WebKit::WebIDBDatabaseError; |
| 40 using WebKit::WebIDBIndex; | 41 using WebKit::WebIDBIndex; |
| 41 using WebKit::WebIDBKey; | 42 using WebKit::WebIDBKey; |
| 42 using WebKit::WebIDBKeyRange; | 43 using WebKit::WebIDBKeyRange; |
| 43 using WebKit::WebIDBObjectStore; | 44 using WebKit::WebIDBObjectStore; |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 ////////////////////////////////////////////////////////////////////// | 277 ////////////////////////////////////////////////////////////////////// |
| 277 // Helper templates. | 278 // Helper templates. |
| 278 // | 279 // |
| 279 | 280 |
| 280 template <typename ObjectType> | 281 template <typename ObjectType> |
| 281 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( | 282 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( |
| 282 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) { | 283 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) { |
| 283 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 284 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 284 ObjectType* return_object = map->Lookup(return_object_id); | 285 ObjectType* return_object = map->Lookup(return_object_id); |
| 285 if (!return_object) { | 286 if (!return_object) { |
| 286 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF")); | 287 content::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF")); |
| 287 BadMessageReceived(); | 288 BadMessageReceived(); |
| 288 } | 289 } |
| 289 return return_object; | 290 return return_object; |
| 290 } | 291 } |
| 291 | 292 |
| 292 template <typename ReplyType, typename MapObjectType, typename Method> | 293 template <typename ReplyType, typename MapObjectType, typename Method> |
| 293 void IndexedDBDispatcherHost::SyncGetter( | 294 void IndexedDBDispatcherHost::SyncGetter( |
| 294 IDMap<MapObjectType, IDMapOwnPointer>* map, int32 object_id, | 295 IDMap<MapObjectType, IDMapOwnPointer>* map, int32 object_id, |
| 295 ReplyType* reply, Method method) { | 296 ReplyType* reply, Method method) { |
| 296 MapObjectType* object = GetOrTerminateProcess(map, object_id); | 297 MapObjectType* object = GetOrTerminateProcess(map, object_id); |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 } | 1104 } |
| 1104 idb_transaction->didCompleteTaskEvents(); | 1105 idb_transaction->didCompleteTaskEvents(); |
| 1105 } | 1106 } |
| 1106 | 1107 |
| 1107 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1108 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
| 1108 int32 object_id) { | 1109 int32 object_id) { |
| 1109 transaction_size_map_.erase(object_id); | 1110 transaction_size_map_.erase(object_id); |
| 1110 transaction_url_map_.erase(object_id); | 1111 transaction_url_map_.erase(object_id); |
| 1111 parent_->DestroyObject(&map_, object_id); | 1112 parent_->DestroyObject(&map_, object_id); |
| 1112 } | 1113 } |
| OLD | NEW |