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_value.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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 529 |
529 IndexedDBConnection* connection = | 530 IndexedDBConnection* connection = |
530 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); | 531 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); |
531 if (!connection || !connection->IsConnected()) | 532 if (!connection || !connection->IsConnected()) |
532 return; | 533 return; |
533 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( | 534 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
534 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); | 535 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); |
535 | 536 |
536 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 537 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
537 // TODO(alecflett): Avoid a copy here. | 538 // TODO(alecflett): Avoid a copy here. |
538 std::string value_copy(params.value); | 539 IndexedDBValue value; |
| 540 value.bits = params.value; |
539 connection->database()->Put( | 541 connection->database()->Put( |
540 host_transaction_id, | 542 host_transaction_id, |
541 params.object_store_id, | 543 params.object_store_id, |
542 &value_copy, | 544 &value, |
543 make_scoped_ptr(new IndexedDBKey(params.key)), | 545 make_scoped_ptr(new IndexedDBKey(params.key)), |
544 static_cast<IndexedDBDatabase::PutMode>(params.put_mode), | 546 static_cast<IndexedDBDatabase::PutMode>(params.put_mode), |
545 callbacks, | 547 callbacks, |
546 params.index_keys); | 548 params.index_keys); |
547 TransactionIDToSizeMap* map = | 549 TransactionIDToSizeMap* map = |
548 &parent_->database_dispatcher_host_->transaction_size_map_; | 550 &parent_->database_dispatcher_host_->transaction_size_map_; |
549 // Size can't be big enough to overflow because it represents the | 551 // Size can't be big enough to overflow because it represents the |
550 // actual bytes passed through IPC. | 552 // actual bytes passed through IPC. |
551 (*map)[host_transaction_id] += params.value.size(); | 553 (*map)[host_transaction_id] += params.value.size(); |
552 } | 554 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 } | 847 } |
846 | 848 |
847 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 849 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
848 int32 ipc_object_id) { | 850 int32 ipc_object_id) { |
849 DCHECK( | 851 DCHECK( |
850 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 852 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
851 parent_->DestroyObject(&map_, ipc_object_id); | 853 parent_->DestroyObject(&map_, ipc_object_id); |
852 } | 854 } |
853 | 855 |
854 } // namespace content | 856 } // namespace content |
OLD | NEW |