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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore | 235 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
236 // created) if this origin is already over quota. | 236 // created) if this origin is already over quota. |
237 scoped_refptr<IndexedDBCallbacksWrapper> callbacks_proxy = | 237 scoped_refptr<IndexedDBCallbacksWrapper> callbacks_proxy = |
238 IndexedDBCallbacksWrapper::Create( | 238 IndexedDBCallbacksWrapper::Create( |
239 new IndexedDBCallbacksDatabase(this, | 239 new IndexedDBCallbacksDatabase(this, |
240 params.ipc_thread_id, | 240 params.ipc_thread_id, |
241 params.ipc_callbacks_id, | 241 params.ipc_callbacks_id, |
242 params.ipc_database_callbacks_id, | 242 params.ipc_database_callbacks_id, |
243 host_transaction_id, | 243 host_transaction_id, |
244 origin_url)); | 244 origin_url)); |
245 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks_proxy = | 245 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks_proxy = |
246 IndexedDBDatabaseCallbacksWrapper::Create(new IndexedDBDatabaseCallbacks( | 246 IndexedDBDatabaseCallbacks::Create( |
247 this, params.ipc_thread_id, params.ipc_database_callbacks_id)); | 247 this, params.ipc_thread_id, params.ipc_database_callbacks_id); |
248 callbacks_proxy->SetDatabaseCallbacks(database_callbacks_proxy); | 248 callbacks_proxy->SetDatabaseCallbacks(database_callbacks_proxy); |
249 Context()->GetIDBFactory()-> | 249 Context()->GetIDBFactory()-> |
250 Open(params.name, | 250 Open(params.name, |
251 params.version, | 251 params.version, |
252 host_transaction_id, | 252 host_transaction_id, |
253 callbacks_proxy, | 253 callbacks_proxy, |
254 database_callbacks_proxy, | 254 database_callbacks_proxy, |
255 base::UTF8ToUTF16(params.database_identifier), | 255 base::UTF8ToUTF16(params.database_identifier), |
256 indexed_db_path); | 256 indexed_db_path); |
257 } | 257 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 467 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
468 WebIDBDatabaseImpl* database = | 468 WebIDBDatabaseImpl* database = |
469 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 469 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
470 if (!database) | 470 if (!database) |
471 return; | 471 return; |
472 | 472 |
473 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 473 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
474 | 474 |
475 database->createTransaction( | 475 database->createTransaction( |
476 host_transaction_id, | 476 host_transaction_id, |
477 new IndexedDBDatabaseCallbacks( | |
478 parent_, params.ipc_thread_id, params.ipc_database_callbacks_id), | |
479 params.object_store_ids, | 477 params.object_store_ids, |
480 params.mode); | 478 params.mode); |
481 transaction_database_map_[host_transaction_id] = params.ipc_database_id; | 479 transaction_database_map_[host_transaction_id] = params.ipc_database_id; |
482 parent_->RegisterTransactionId(host_transaction_id, | 480 parent_->RegisterTransactionId(host_transaction_id, |
483 database_url_map_[params.ipc_database_id]); | 481 database_url_map_[params.ipc_database_id]); |
484 } | 482 } |
485 | 483 |
486 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( | 484 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( |
487 int32 ipc_database_id) { | 485 int32 ipc_database_id) { |
488 DCHECK( | 486 DCHECK( |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 } | 860 } |
863 | 861 |
864 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 862 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
865 int32 ipc_object_id) { | 863 int32 ipc_object_id) { |
866 DCHECK( | 864 DCHECK( |
867 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 865 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
868 parent_->DestroyObject(&map_, ipc_object_id); | 866 parent_->DestroyObject(&map_, ipc_object_id); |
869 } | 867 } |
870 | 868 |
871 } // namespace content | 869 } // namespace content |
OLD | NEW |