Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: content/browser/indexed_db/indexed_db_index_writer.cc

Issue 2233153002: IndexedDB: WrapUnique(new T(args..)) -> MakeUnique<T>(args...) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/indexed_db/indexed_db_index_writer.h" 5 #include "content/browser/indexed_db/indexed_db_index_writer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (found == object_store.indexes.end()) 139 if (found == object_store.indexes.end())
140 continue; 140 continue;
141 const IndexedDBIndexMetadata& index = found->second; 141 const IndexedDBIndexMetadata& index = found->second;
142 IndexedDBDatabase::IndexKeys keys = it; 142 IndexedDBDatabase::IndexKeys keys = it;
143 143
144 // If the object_store is using auto_increment, then any indexes with an 144 // If the object_store is using auto_increment, then any indexes with an
145 // identical key_path need to also use the primary (generated) key as a key. 145 // identical key_path need to also use the primary (generated) key as a key.
146 if (key_was_generated && (index.key_path == object_store.key_path)) 146 if (key_was_generated && (index.key_path == object_store.key_path))
147 keys.second.push_back(primary_key); 147 keys.second.push_back(primary_key);
148 148
149 std::unique_ptr<IndexWriter> index_writer(new IndexWriter(index, keys)); 149 std::unique_ptr<IndexWriter> index_writer(
150 base::MakeUnique<IndexWriter>(index, keys));
150 bool can_add_keys = false; 151 bool can_add_keys = false;
151 bool backing_store_success = 152 bool backing_store_success =
152 index_writer->VerifyIndexKeys(backing_store, 153 index_writer->VerifyIndexKeys(backing_store,
153 transaction->BackingStoreTransaction(), 154 transaction->BackingStoreTransaction(),
154 database_id, 155 database_id,
155 object_store.id, 156 object_store.id,
156 index.id, 157 index.id,
157 &can_add_keys, 158 &can_add_keys,
158 primary_key, 159 primary_key,
159 error_message); 160 error_message);
160 if (!backing_store_success) 161 if (!backing_store_success)
161 return false; 162 return false;
162 if (!can_add_keys) 163 if (!can_add_keys)
163 return true; 164 return true;
164 165
165 index_writers->push_back(std::move(index_writer)); 166 index_writers->push_back(std::move(index_writer));
166 } 167 }
167 168
168 *completed = true; 169 *completed = true;
169 return true; 170 return true;
170 } 171 }
171 172
172 } // namespace content 173 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_factory_unittest.cc ('k') | content/browser/indexed_db/indexed_db_leveldb_coding.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698