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_observer_changes.h" |
26 #include "content/browser/indexed_db/indexed_db_pending_connection.h" | 27 #include "content/browser/indexed_db/indexed_db_pending_connection.h" |
27 #include "content/browser/indexed_db/indexed_db_value.h" | 28 #include "content/browser/indexed_db/indexed_db_value.h" |
28 #include "content/browser/renderer_host/render_message_filter.h" | 29 #include "content/browser/renderer_host/render_message_filter.h" |
29 #include "content/common/indexed_db/indexed_db_messages.h" | 30 #include "content/common/indexed_db/indexed_db_messages.h" |
| 31 #include "content/common/indexed_db/indexed_db_observation.h" |
30 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
31 #include "content/public/browser/user_metrics.h" | 33 #include "content/public/browser/user_metrics.h" |
32 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
33 #include "content/public/common/result_codes.h" | 35 #include "content/public/common/result_codes.h" |
34 #include "storage/browser/blob/blob_data_builder.h" | 36 #include "storage/browser/blob/blob_data_builder.h" |
35 #include "storage/browser/blob/blob_storage_context.h" | 37 #include "storage/browser/blob/blob_storage_context.h" |
36 #include "storage/browser/database/database_util.h" | 38 #include "storage/browser/database/database_util.h" |
37 #include "storage/browser/quota/quota_manager_proxy.h" | 39 #include "storage/browser/quota/quota_manager_proxy.h" |
38 #include "storage/common/database/database_identifier.h" | 40 #include "storage/common/database/database_identifier.h" |
39 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" | 41 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 idb_index_metadata.key_path = web_index_metadata.key_path; | 312 idb_index_metadata.key_path = web_index_metadata.key_path; |
311 idb_index_metadata.unique = web_index_metadata.unique; | 313 idb_index_metadata.unique = web_index_metadata.unique; |
312 idb_index_metadata.multi_entry = web_index_metadata.multi_entry; | 314 idb_index_metadata.multi_entry = web_index_metadata.multi_entry; |
313 idb_store_metadata.indexes.push_back(idb_index_metadata); | 315 idb_store_metadata.indexes.push_back(idb_index_metadata); |
314 } | 316 } |
315 metadata.object_stores.push_back(idb_store_metadata); | 317 metadata.object_stores.push_back(idb_store_metadata); |
316 } | 318 } |
317 return metadata; | 319 return metadata; |
318 } | 320 } |
319 | 321 |
| 322 ::IndexedDBObserverChanges IndexedDBDispatcherHost::ConvertObserverChanges( |
| 323 content::IndexedDBObserverChanges* changes) { |
| 324 ::IndexedDBObserverChanges idb_changes; |
| 325 // TODO(palakj): Move the map instead of copying? |
| 326 idb_changes.observation_index = changes->observation_index; |
| 327 for (auto& iter : changes->observations) { |
| 328 ::IndexedDBObservation idb_observation = ConvertObservation(iter.release()); |
| 329 } |
| 330 return idb_changes; |
| 331 } |
| 332 |
| 333 ::IndexedDBObservation IndexedDBDispatcherHost::ConvertObservation( |
| 334 content::IndexedDBObservation* observation) { |
| 335 // TODO(palakj): Modify function for different observation constructors. |
| 336 ::IndexedDBObservation idb_observation; |
| 337 idb_observation.type = observation->type(); |
| 338 idb_observation.key_range = observation->key_range(); |
| 339 return idb_observation; |
| 340 } |
| 341 |
320 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( | 342 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( |
321 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { | 343 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { |
322 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 344 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
323 | 345 |
324 if (!IsValidOrigin(params.origin)) { | 346 if (!IsValidOrigin(params.origin)) { |
325 bad_message::ReceivedBadMessage(this, bad_message::IDBDH_INVALID_ORIGIN); | 347 bad_message::ReceivedBadMessage(this, bad_message::IDBDH_INVALID_ORIGIN); |
326 return; | 348 return; |
327 } | 349 } |
328 | 350 |
329 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 351 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 DLOG(ERROR) << "Unable to reset prefetch"; | 1091 DLOG(ERROR) << "Unable to reset prefetch"; |
1070 } | 1092 } |
1071 | 1093 |
1072 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 1094 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
1073 int32_t ipc_object_id) { | 1095 int32_t ipc_object_id) { |
1074 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); | 1096 DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread()); |
1075 parent_->DestroyObject(&map_, ipc_object_id); | 1097 parent_->DestroyObject(&map_, ipc_object_id); |
1076 } | 1098 } |
1077 | 1099 |
1078 } // namespace content | 1100 } // namespace content |
OLD | NEW |