| 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" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 12 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
| 13 #include "content/browser/indexed_db/indexed_db_connection.h" | 13 #include "content/browser/indexed_db/indexed_db_connection.h" |
| 14 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 14 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| 15 #include "content/browser/indexed_db/indexed_db_cursor.h" | 15 #include "content/browser/indexed_db/indexed_db_cursor.h" |
| 16 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 16 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
| 17 #include "content/browser/indexed_db/indexed_db_metadata.h" | 17 #include "content/browser/indexed_db/indexed_db_metadata.h" |
| 18 #include "content/browser/indexed_db/indexed_db_pending_connection.h" |
| 18 #include "content/browser/renderer_host/render_message_filter.h" | 19 #include "content/browser/renderer_host/render_message_filter.h" |
| 19 #include "content/common/indexed_db/indexed_db_messages.h" | 20 #include "content/common/indexed_db/indexed_db_messages.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/user_metrics.h" | 22 #include "content/public/browser/user_metrics.h" |
| 22 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 23 #include "content/public/common/result_codes.h" | 24 #include "content/public/common/result_codes.h" |
| 24 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" | 25 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" |
| 25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 26 #include "webkit/browser/database/database_util.h" | 27 #include "webkit/browser/database/database_util.h" |
| 27 #include "webkit/common/database/database_identifier.h" | 28 #include "webkit/common/database/database_identifier.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 scoped_refptr<IndexedDBCallbacks> callbacks = | 246 scoped_refptr<IndexedDBCallbacks> callbacks = |
| 246 new IndexedDBCallbacks(this, | 247 new IndexedDBCallbacks(this, |
| 247 params.ipc_thread_id, | 248 params.ipc_thread_id, |
| 248 params.ipc_callbacks_id, | 249 params.ipc_callbacks_id, |
| 249 params.ipc_database_callbacks_id, | 250 params.ipc_database_callbacks_id, |
| 250 host_transaction_id, | 251 host_transaction_id, |
| 251 origin_url); | 252 origin_url); |
| 252 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks = | 253 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks = |
| 253 new IndexedDBDatabaseCallbacks( | 254 new IndexedDBDatabaseCallbacks( |
| 254 this, params.ipc_thread_id, params.ipc_database_callbacks_id); | 255 this, params.ipc_thread_id, params.ipc_database_callbacks_id); |
| 255 Context()->GetIDBFactory()->Open(params.name, | 256 IndexedDBPendingConnection connection(callbacks, |
| 256 params.version, | 257 database_callbacks, |
| 257 host_transaction_id, | 258 0 /* TODO(ericu) ipc_process_id */, |
| 258 callbacks, | 259 host_transaction_id, |
| 259 database_callbacks, | 260 params.version); |
| 260 origin_url, | 261 Context()->GetIDBFactory()->Open( |
| 261 indexed_db_path); | 262 params.name, connection, origin_url, indexed_db_path); |
| 262 } | 263 } |
| 263 | 264 |
| 264 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( | 265 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( |
| 265 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { | 266 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { |
| 266 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 267 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 267 GURL origin_url = | 268 GURL origin_url = |
| 268 webkit_database::GetOriginFromIdentifier(params.database_identifier); | 269 webkit_database::GetOriginFromIdentifier(params.database_identifier); |
| 269 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 270 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 270 Context()->GetIDBFactory()->DeleteDatabase( | 271 Context()->GetIDBFactory()->DeleteDatabase( |
| 271 params.name, | 272 params.name, |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 } | 846 } |
| 846 | 847 |
| 847 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 848 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
| 848 int32 ipc_object_id) { | 849 int32 ipc_object_id) { |
| 849 DCHECK( | 850 DCHECK( |
| 850 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 851 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| 851 parent_->DestroyObject(&map_, ipc_object_id); | 852 parent_->DestroyObject(&map_, ipc_object_id); |
| 852 } | 853 } |
| 853 | 854 |
| 854 } // namespace content | 855 } // namespace content |
| OLD | NEW |