| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 GURL origin_url = DatabaseUtil::GetOriginFromIdentifier(params.origin); | 235 GURL origin_url = DatabaseUtil::GetOriginFromIdentifier(params.origin); |
| 236 WebSecurityOrigin origin( | 236 WebSecurityOrigin origin( |
| 237 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); | 237 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); |
| 238 | 238 |
| 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 240 | 240 |
| 241 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore | 241 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
| 242 // created) if this origin is already over quota. | 242 // created) if this origin is already over quota. |
| 243 Context()->GetIDBFactory()->open( | 243 Context()->GetIDBFactory()->open( |
| 244 params.name, | 244 params.name, |
| 245 params.version, |
| 245 new IndexedDBCallbacks<WebIDBDatabase>(this, params.thread_id, | 246 new IndexedDBCallbacks<WebIDBDatabase>(this, params.thread_id, |
| 246 params.response_id, origin_url), | 247 params.response_id, origin_url), |
| 247 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); | 248 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); |
| 248 } | 249 } |
| 249 | 250 |
| 250 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( | 251 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( |
| 251 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { | 252 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { |
| 252 FilePath indexed_db_path = indexed_db_context_->data_path(); | 253 FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 253 | 254 |
| 254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 269 ////////////////////////////////////////////////////////////////////// | 270 ////////////////////////////////////////////////////////////////////// |
| 270 // Helper templates. | 271 // Helper templates. |
| 271 // | 272 // |
| 272 | 273 |
| 273 template <typename ObjectType> | 274 template <typename ObjectType> |
| 274 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( | 275 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( |
| 275 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) { | 276 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id) { |
| 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 277 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 277 ObjectType* return_object = map->Lookup(return_object_id); | 278 ObjectType* return_object = map->Lookup(return_object_id); |
| 278 if (!return_object) { | 279 if (!return_object) { |
| 280 NOTREACHED() << "Uh oh, couldn't find object with id " << return_object_id; |
| 279 content::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF")); | 281 content::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF")); |
| 280 BadMessageReceived(); | 282 BadMessageReceived(); |
| 281 } | 283 } |
| 282 return return_object; | 284 return return_object; |
| 283 } | 285 } |
| 284 | 286 |
| 285 template <typename ReplyType, typename MapObjectType, typename Method> | 287 template <typename ReplyType, typename MapObjectType, typename Method> |
| 286 void IndexedDBDispatcherHost::SyncGetter( | 288 void IndexedDBDispatcherHost::SyncGetter( |
| 287 IDMap<MapObjectType, IDMapOwnPointer>* map, int32 object_id, | 289 IDMap<MapObjectType, IDMapOwnPointer>* map, int32 object_id, |
| 288 ReplyType* reply, Method method) { | 290 ReplyType* reply, Method method) { |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 transaction_url_map_[transaction_id], | 1138 transaction_url_map_[transaction_id], |
| 1137 transaction_size_map_[transaction_id])) { | 1139 transaction_size_map_[transaction_id])) { |
| 1138 idb_transaction->abort(); | 1140 idb_transaction->abort(); |
| 1139 return; | 1141 return; |
| 1140 } | 1142 } |
| 1141 idb_transaction->didCompleteTaskEvents(); | 1143 idb_transaction->didCompleteTaskEvents(); |
| 1142 } | 1144 } |
| 1143 | 1145 |
| 1144 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1146 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
| 1145 int32 object_id) { | 1147 int32 object_id) { |
| 1148 // TODO(dgrogan): This doesn't seem to be happening with some version change |
| 1149 // transactions. Possibly introduced with integer version support. |
| 1146 transaction_size_map_.erase(object_id); | 1150 transaction_size_map_.erase(object_id); |
| 1147 transaction_url_map_.erase(object_id); | 1151 transaction_url_map_.erase(object_id); |
| 1148 parent_->DestroyObject(&map_, object_id); | 1152 parent_->DestroyObject(&map_, object_id); |
| 1149 } | 1153 } |
| OLD | NEW |