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/in_process_webkit/indexed_db_dispatcher_host.h" | 5 #include "content/browser/in_process_webkit/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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" | 10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 &map_, params.idb_object_store_id); | 704 &map_, params.idb_object_store_id); |
705 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 705 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
706 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); | 706 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); |
707 if (!idb_transaction || !idb_object_store) | 707 if (!idb_transaction || !idb_object_store) |
708 return; | 708 return; |
709 | 709 |
710 *ec = 0; | 710 *ec = 0; |
711 scoped_ptr<WebIDBCallbacks> callbacks( | 711 scoped_ptr<WebIDBCallbacks> callbacks( |
712 new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id, | 712 new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id, |
713 params.response_id)); | 713 params.response_id)); |
| 714 // TODO(alecflett): switch to putWithIndexKeys when available. |
714 idb_object_store->put(params.serialized_value, params.key, params.put_mode, | 715 idb_object_store->put(params.serialized_value, params.key, params.put_mode, |
715 callbacks.release(), *idb_transaction, *ec); | 716 callbacks.release(), *idb_transaction, *ec); |
716 if (*ec) | 717 if (*ec) |
717 return; | 718 return; |
718 int64 size = UTF16ToUTF8(params.serialized_value.data()).size(); | 719 int64 size = UTF16ToUTF8(params.serialized_value.data()).size(); |
719 WebIDBTransactionIDToSizeMap* map = | 720 WebIDBTransactionIDToSizeMap* map = |
720 &parent_->transaction_dispatcher_host_->transaction_size_map_; | 721 &parent_->transaction_dispatcher_host_->transaction_size_map_; |
721 (*map)[params.transaction_id] += size; | 722 (*map)[params.transaction_id] += size; |
722 } | 723 } |
723 | 724 |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 } | 1138 } |
1138 idb_transaction->didCompleteTaskEvents(); | 1139 idb_transaction->didCompleteTaskEvents(); |
1139 } | 1140 } |
1140 | 1141 |
1141 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1142 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
1142 int32 object_id) { | 1143 int32 object_id) { |
1143 transaction_size_map_.erase(object_id); | 1144 transaction_size_map_.erase(object_id); |
1144 transaction_url_map_.erase(object_id); | 1145 transaction_url_map_.erase(object_id); |
1145 parent_->DestroyObject(&map_, object_id); | 1146 parent_->DestroyObject(&map_, object_id); |
1146 } | 1147 } |
OLD | NEW |