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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.cc

Issue 2334613003: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Changes from review by sky Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" 5 #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 *value = transaction.second; 174 *value = transaction.second;
175 return leveldb::Status(); 175 return leveldb::Status();
176 case DELETE_OPERATION: 176 case DELETE_OPERATION:
177 return leveldb::Status::NotFound(leveldb::Slice()); 177 return leveldb::Status::NotFound(leveldb::Slice());
178 } 178 }
179 NOTREACHED(); 179 NOTREACHED();
180 return leveldb::Status::NotSupported("Not supported operation."); 180 return leveldb::Status::NotSupported("Not supported operation.");
181 } 181 }
182 182
183 std::unique_ptr<LevelDBWrapper::Iterator> LevelDBWrapper::NewIterator() { 183 std::unique_ptr<LevelDBWrapper::Iterator> LevelDBWrapper::NewIterator() {
184 return base::WrapUnique(new Iterator(this)); 184 return base::MakeUnique<Iterator>(this);
185 } 185 }
186 186
187 leveldb::Status LevelDBWrapper::Commit() { 187 leveldb::Status LevelDBWrapper::Commit() {
188 leveldb::WriteBatch batch; 188 leveldb::WriteBatch batch;
189 for (PendingOperationMap::iterator itr = pending_.begin(); 189 for (PendingOperationMap::iterator itr = pending_.begin();
190 itr != pending_.end(); ++itr) { 190 itr != pending_.end(); ++itr) {
191 const leveldb::Slice key(itr->first); 191 const leveldb::Slice key(itr->first);
192 const Transaction& transaction = itr->second; 192 const Transaction& transaction = itr->second;
193 switch (transaction.first) { 193 switch (transaction.first) {
194 case PUT_OPERATION: 194 case PUT_OPERATION:
(...skipping 18 matching lines...) Expand all
213 num_puts_ = 0; 213 num_puts_ = 0;
214 num_deletes_ = 0; 214 num_deletes_ = 0;
215 } 215 }
216 216
217 leveldb::DB* LevelDBWrapper::GetLevelDB() { 217 leveldb::DB* LevelDBWrapper::GetLevelDB() {
218 return db_.get(); 218 return db_.get();
219 } 219 }
220 220
221 } // namespace drive_backend 221 } // namespace drive_backend
222 } // namespace sync_file_system 222 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698