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/indexed_db/indexed_db_dispatcher_host.h" | 5 #include "content/browser/indexed_db/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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 242 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
243 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 243 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
244 | 244 |
245 GURL origin_url = | 245 GURL origin_url = |
246 webkit_database::GetOriginFromIdentifier(params.database_identifier); | 246 webkit_database::GetOriginFromIdentifier(params.database_identifier); |
247 | 247 |
248 Context()->GetIDBFactory()->GetDatabaseNames( | 248 Context()->GetIDBFactory()->GetDatabaseNames( |
249 new IndexedDBCallbacks( | 249 new IndexedDBCallbacks( |
250 this, params.ipc_thread_id, params.ipc_callbacks_id), | 250 this, params.ipc_thread_id, params.ipc_callbacks_id), |
251 origin_url, | 251 origin_url, |
252 indexed_db_path); | 252 indexed_db_path, |
| 253 Context()->TaskRunner()); |
253 } | 254 } |
254 | 255 |
255 void IndexedDBDispatcherHost::OnIDBFactoryOpen( | 256 void IndexedDBDispatcherHost::OnIDBFactoryOpen( |
256 const IndexedDBHostMsg_FactoryOpen_Params& params) { | 257 const IndexedDBHostMsg_FactoryOpen_Params& params) { |
257 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 258 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
258 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 259 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
259 | 260 |
260 GURL origin_url = | 261 GURL origin_url = |
261 webkit_database::GetOriginFromIdentifier(params.database_identifier); | 262 webkit_database::GetOriginFromIdentifier(params.database_identifier); |
262 | 263 |
263 int64 host_transaction_id = HostTransactionId(params.transaction_id); | 264 int64 host_transaction_id = HostTransactionId(params.transaction_id); |
264 | 265 |
265 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore | 266 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
266 // created) if this origin is already over quota. | 267 // created) if this origin is already over quota. |
267 scoped_refptr<IndexedDBCallbacks> callbacks = | 268 scoped_refptr<IndexedDBCallbacks> callbacks = |
268 new IndexedDBCallbacks(this, | 269 new IndexedDBCallbacks(this, |
269 params.ipc_thread_id, | 270 params.ipc_thread_id, |
270 params.ipc_callbacks_id, | 271 params.ipc_callbacks_id, |
271 params.ipc_database_callbacks_id, | 272 params.ipc_database_callbacks_id, |
272 host_transaction_id, | 273 host_transaction_id, |
273 origin_url); | 274 origin_url); |
274 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks = | 275 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks = |
275 new IndexedDBDatabaseCallbacks( | 276 new IndexedDBDatabaseCallbacks( |
276 this, params.ipc_thread_id, params.ipc_database_callbacks_id); | 277 this, params.ipc_thread_id, params.ipc_database_callbacks_id); |
277 IndexedDBPendingConnection connection(callbacks, | 278 IndexedDBPendingConnection connection(callbacks, |
278 database_callbacks, | 279 database_callbacks, |
279 0 /* TODO(ericu) ipc_process_id */, | 280 0 /* TODO(ericu) ipc_process_id */, |
280 host_transaction_id, | 281 host_transaction_id, |
281 params.version); | 282 params.version); |
282 Context()->GetIDBFactory()->Open( | 283 Context()->GetIDBFactory()->Open(params.name, |
283 params.name, connection, origin_url, indexed_db_path); | 284 connection, |
| 285 origin_url, |
| 286 indexed_db_path, |
| 287 Context()->TaskRunner()); |
284 } | 288 } |
285 | 289 |
286 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( | 290 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( |
287 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { | 291 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { |
288 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 292 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
289 GURL origin_url = | 293 GURL origin_url = |
290 webkit_database::GetOriginFromIdentifier(params.database_identifier); | 294 webkit_database::GetOriginFromIdentifier(params.database_identifier); |
291 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 295 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
292 Context()->GetIDBFactory()->DeleteDatabase( | 296 Context()->GetIDBFactory()->DeleteDatabase( |
293 params.name, | 297 params.name, |
294 new IndexedDBCallbacks( | 298 new IndexedDBCallbacks( |
295 this, params.ipc_thread_id, params.ipc_callbacks_id), | 299 this, params.ipc_thread_id, params.ipc_callbacks_id), |
296 origin_url, | 300 origin_url, |
297 indexed_db_path); | 301 indexed_db_path, |
| 302 Context()->TaskRunner()); |
298 } | 303 } |
299 | 304 |
300 void IndexedDBDispatcherHost::OnAckReceivedBlobs( | 305 void IndexedDBDispatcherHost::OnAckReceivedBlobs( |
301 const std::vector<std::string>& uuids) { | 306 const std::vector<std::string>& uuids) { |
302 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 307 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
303 std::vector<std::string>::const_iterator iter; | 308 std::vector<std::string>::const_iterator iter; |
304 for (iter = uuids.begin(); iter != uuids.end(); ++iter) | 309 for (iter = uuids.begin(); iter != uuids.end(); ++iter) |
305 DropBlobDataHandle(*iter); | 310 DropBlobDataHandle(*iter); |
306 } | 311 } |
307 | 312 |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 } | 881 } |
877 | 882 |
878 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 883 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
879 int32 ipc_object_id) { | 884 int32 ipc_object_id) { |
880 DCHECK( | 885 DCHECK( |
881 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 886 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
882 parent_->DestroyObject(&map_, ipc_object_id); | 887 parent_->DestroyObject(&map_, ipc_object_id); |
883 } | 888 } |
884 | 889 |
885 } // namespace content | 890 } // namespace content |
OLD | NEW |