OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/indexed_db/webidbdatabase_impl.h" | 5 #include "content/child/indexed_db/webidbdatabase_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 9 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
10 #include "content/child/indexed_db/indexed_db_key_builders.h" | 10 #include "content/child/indexed_db/indexed_db_key_builders.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 long long transaction_id, | 130 long long transaction_id, |
131 long long object_store_id, | 131 long long object_store_id, |
132 const WebIDBKey& primary_key, | 132 const WebIDBKey& primary_key, |
133 const WebVector<long long>& index_ids, | 133 const WebVector<long long>& index_ids, |
134 const WebVector<WebIndexKeys>& index_keys) { | 134 const WebVector<WebIndexKeys>& index_keys) { |
135 IndexedDBHostMsg_DatabaseSetIndexKeys_Params params; | 135 IndexedDBHostMsg_DatabaseSetIndexKeys_Params params; |
136 params.ipc_database_id = ipc_database_id_; | 136 params.ipc_database_id = ipc_database_id_; |
137 params.transaction_id = transaction_id; | 137 params.transaction_id = transaction_id; |
138 params.object_store_id = object_store_id; | 138 params.object_store_id = object_store_id; |
139 params.primary_key = IndexedDBKeyBuilder::Build(primary_key); | 139 params.primary_key = IndexedDBKeyBuilder::Build(primary_key); |
140 COMPILE_ASSERT(sizeof(params.index_ids[0]) == sizeof(index_ids[0]), | |
141 Cant_copy); | |
142 params.index_ids.assign(index_ids.data(), | |
143 index_ids.data() + index_ids.size()); | |
144 | 140 |
145 params.index_keys.resize(index_keys.size()); | 141 DCHECK_EQ(index_ids.size(), index_keys.size()); |
146 for (size_t i = 0; i < index_keys.size(); ++i) { | 142 params.index_keys.resize(index_ids.size()); |
147 params.index_keys[i].resize(index_keys[i].size()); | 143 for (size_t i = 0, len = index_ids.size(); i < len; ++i) { |
| 144 params.index_keys[i].first = index_ids[i]; |
| 145 params.index_keys[i].second.resize(index_keys[i].size()); |
148 for (size_t j = 0; j < index_keys[i].size(); ++j) { | 146 for (size_t j = 0; j < index_keys[i].size(); ++j) { |
149 params.index_keys[i][j] = IndexedDBKeyBuilder::Build(index_keys[i][j]); | 147 params.index_keys[i].second[j] = |
| 148 IndexedDBKey(IndexedDBKeyBuilder::Build(index_keys[i][j])); |
150 } | 149 } |
151 } | 150 } |
| 151 |
152 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexKeys(params)); | 152 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexKeys(params)); |
153 } | 153 } |
154 | 154 |
155 void WebIDBDatabaseImpl::setIndexesReady( | 155 void WebIDBDatabaseImpl::setIndexesReady( |
156 long long transaction_id, | 156 long long transaction_id, |
157 long long object_store_id, | 157 long long object_store_id, |
158 const WebVector<long long>& web_index_ids) { | 158 const WebVector<long long>& web_index_ids) { |
159 std::vector<int64> index_ids(web_index_ids.data(), | 159 std::vector<int64> index_ids(web_index_ids.data(), |
160 web_index_ids.data() + web_index_ids.size()); | 160 web_index_ids.data() + web_index_ids.size()); |
161 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexesReady( | 161 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexesReady( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 thread_safe_sender_->Send( | 254 thread_safe_sender_->Send( |
255 new IndexedDBHostMsg_DatabaseAbort(ipc_database_id_, transaction_id)); | 255 new IndexedDBHostMsg_DatabaseAbort(ipc_database_id_, transaction_id)); |
256 } | 256 } |
257 | 257 |
258 void WebIDBDatabaseImpl::commit(long long transaction_id) { | 258 void WebIDBDatabaseImpl::commit(long long transaction_id) { |
259 thread_safe_sender_->Send( | 259 thread_safe_sender_->Send( |
260 new IndexedDBHostMsg_DatabaseCommit(ipc_database_id_, transaction_id)); | 260 new IndexedDBHostMsg_DatabaseCommit(ipc_database_id_, transaction_id)); |
261 } | 261 } |
262 | 262 |
263 } // namespace content | 263 } // namespace content |
OLD | NEW |