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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/guid.h" | 12 #include "base/guid.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "content/browser/bad_message.h" | 18 #include "content/browser/bad_message.h" |
19 #include "content/browser/child_process_security_policy_impl.h" | 19 #include "content/browser/child_process_security_policy_impl.h" |
20 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 20 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
21 #include "content/browser/indexed_db/indexed_db_connection.h" | 21 #include "content/browser/indexed_db/indexed_db_connection.h" |
22 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 22 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
23 #include "content/browser/indexed_db/indexed_db_cursor.h" | 23 #include "content/browser/indexed_db/indexed_db_cursor.h" |
24 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 24 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
25 #include "content/browser/indexed_db/indexed_db_metadata.h" | 25 #include "content/browser/indexed_db/indexed_db_metadata.h" |
26 #include "content/browser/indexed_db/indexed_db_pending_connection.h" | 26 #include "content/browser/indexed_db/indexed_db_pending_connection.h" |
27 #include "content/browser/indexed_db/indexed_db_value.h" | 27 #include "content/browser/indexed_db/indexed_db_value.h" |
28 #include "content/browser/renderer_host/render_message_filter.h" | 28 #include "content/browser/renderer_host/render_message_filter.h" |
29 #include "content/common/indexed_db/indexed_db_messages.h" | |
30 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
31 #include "content/public/browser/user_metrics.h" | 30 #include "content/public/browser/user_metrics.h" |
32 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
33 #include "content/public/common/result_codes.h" | 32 #include "content/public/common/result_codes.h" |
34 #include "storage/browser/blob/blob_data_builder.h" | 33 #include "storage/browser/blob/blob_data_builder.h" |
35 #include "storage/browser/blob/blob_storage_context.h" | 34 #include "storage/browser/blob/blob_storage_context.h" |
36 #include "storage/browser/database/database_util.h" | 35 #include "storage/browser/database/database_util.h" |
37 #include "storage/browser/quota/quota_manager_proxy.h" | 36 #include "storage/browser/quota/quota_manager_proxy.h" |
38 #include "storage/common/database/database_identifier.h" | 37 #include "storage/common/database/database_identifier.h" |
39 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" | 38 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" |
40 #include "url/origin.h" | 39 #include "url/origin.h" |
41 | 40 |
42 using storage::DatabaseUtil; | 41 using storage::DatabaseUtil; |
43 using blink::WebIDBKey; | 42 using blink::WebIDBKey; |
44 | 43 |
45 namespace content { | 44 namespace content { |
46 | 45 |
47 namespace { | 46 namespace { |
48 | 47 |
49 bool IsValidOrigin(const url::Origin& origin) { | 48 bool IsValidOrigin(const url::Origin& origin) { |
50 return !origin.unique(); | 49 return !origin.unique(); |
51 } | 50 } |
52 | 51 |
53 } // namespace | 52 } // namespace |
54 | 53 |
| 54 #if 0 |
55 IndexedDBDispatcherHost::IndexedDBDispatcherHost( | 55 IndexedDBDispatcherHost::IndexedDBDispatcherHost( |
56 int ipc_process_id, | 56 int ipc_process_id, |
57 net::URLRequestContextGetter* request_context_getter, | 57 net::URLRequestContextGetter* request_context_getter, |
58 IndexedDBContextImpl* indexed_db_context, | 58 IndexedDBContextImpl* indexed_db_context, |
59 ChromeBlobStorageContext* blob_storage_context) | 59 ChromeBlobStorageContext* blob_storage_context) |
60 : BrowserMessageFilter(IndexedDBMsgStart), | 60 : BrowserMessageFilter(IndexedDBMsgStart), |
61 request_context_getter_(request_context_getter), | 61 request_context_getter_(request_context_getter), |
62 request_context_(NULL), | 62 request_context_(NULL), |
63 indexed_db_context_(indexed_db_context), | 63 indexed_db_context_(indexed_db_context), |
64 blob_storage_context_(blob_storage_context), | 64 blob_storage_context_(blob_storage_context), |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore | 350 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
351 // created) if this origin is already over quota. | 351 // created) if this origin is already over quota. |
352 scoped_refptr<IndexedDBCallbacks> callbacks = new IndexedDBCallbacks( | 352 scoped_refptr<IndexedDBCallbacks> callbacks = new IndexedDBCallbacks( |
353 this, params.ipc_thread_id, params.ipc_callbacks_id, | 353 this, params.ipc_thread_id, params.ipc_callbacks_id, |
354 params.ipc_database_callbacks_id, host_transaction_id, params.origin); | 354 params.ipc_database_callbacks_id, host_transaction_id, params.origin); |
355 callbacks->SetConnectionOpenStartTime(begin_time); | 355 callbacks->SetConnectionOpenStartTime(begin_time); |
356 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks = | 356 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks = |
357 new IndexedDBDatabaseCallbacks( | 357 new IndexedDBDatabaseCallbacks( |
358 this, params.ipc_thread_id, params.ipc_database_callbacks_id); | 358 this, params.ipc_thread_id, params.ipc_database_callbacks_id); |
| 359 scoped_refptr<IndexedDBOpenRequestObserver> open_observer = |
| 360 new IndexedDBOpenRequestObserver(); |
359 IndexedDBPendingConnection connection(callbacks, | 361 IndexedDBPendingConnection connection(callbacks, |
360 database_callbacks, | 362 database_callbacks, |
| 363 open_observer, |
361 ipc_process_id_, | 364 ipc_process_id_, |
362 host_transaction_id, | 365 host_transaction_id, |
363 params.version); | 366 params.version); |
364 DCHECK(request_context_); | 367 DCHECK(request_context_); |
365 context()->GetIDBFactory()->Open(params.name, connection, request_context_, | 368 context()->GetIDBFactory()->Open(params.name, connection, request_context_, |
366 params.origin, indexed_db_path); | 369 params.origin, indexed_db_path); |
367 } | 370 } |
368 | 371 |
369 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( | 372 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( |
370 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { | 373 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 if (!s.ok()) | 1071 if (!s.ok()) |
1069 DLOG(ERROR) << "Unable to reset prefetch"; | 1072 DLOG(ERROR) << "Unable to reset prefetch"; |
1070 } | 1073 } |
1071 | 1074 |
1072 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 1075 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
1073 int32_t ipc_object_id) { | 1076 int32_t ipc_object_id) { |
1074 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); | 1077 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); |
1075 parent_->DestroyObject(&map_, ipc_object_id); | 1078 parent_->DestroyObject(&map_, ipc_object_id); |
1076 } | 1079 } |
1077 | 1080 |
| 1081 #endif |
| 1082 |
1078 } // namespace content | 1083 } // namespace content |
OLD | NEW |