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

Side by Side Diff: apps/saved_files_service.cc

Issue 2255123002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "apps/saved_files_service.h" 5 #include "apps/saved_files_service.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 SavedFilesService::SavedFiles::~SavedFiles() {} 309 SavedFilesService::SavedFiles::~SavedFiles() {}
310 310
311 void SavedFilesService::SavedFiles::RegisterFileEntry( 311 void SavedFilesService::SavedFiles::RegisterFileEntry(
312 const std::string& id, 312 const std::string& id,
313 const base::FilePath& file_path, 313 const base::FilePath& file_path,
314 bool is_directory) { 314 bool is_directory) {
315 if (ContainsKey(registered_file_entries_, id)) 315 if (ContainsKey(registered_file_entries_, id))
316 return; 316 return;
317 317
318 registered_file_entries_.add( 318 registered_file_entries_.add(
319 id, base::WrapUnique(new SavedFileEntry(id, file_path, is_directory, 0))); 319 id, base::MakeUnique<SavedFileEntry>(id, file_path, is_directory, 0));
320 } 320 }
321 321
322 void SavedFilesService::SavedFiles::EnqueueFileEntry(const std::string& id) { 322 void SavedFilesService::SavedFiles::EnqueueFileEntry(const std::string& id) {
323 auto it = registered_file_entries_.find(id); 323 auto it = registered_file_entries_.find(id);
324 DCHECK(it != registered_file_entries_.end()); 324 DCHECK(it != registered_file_entries_.end());
325 325
326 SavedFileEntry* file_entry = it->second; 326 SavedFileEntry* file_entry = it->second;
327 int old_sequence_number = file_entry->sequence_number; 327 int old_sequence_number = file_entry->sequence_number;
328 if (!saved_file_lru_.empty()) { 328 if (!saved_file_lru_.empty()) {
329 // Get the sequence number after the last file entry in the LRU. 329 // Get the sequence number after the last file entry in the LRU.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 void SavedFilesService::SetLruSizeForTest(int size) { 442 void SavedFilesService::SetLruSizeForTest(int size) {
443 g_max_saved_file_entries = size; 443 g_max_saved_file_entries = size;
444 } 444 }
445 445
446 // static 446 // static
447 void SavedFilesService::ClearLruSizeForTest() { 447 void SavedFilesService::ClearLruSizeForTest() {
448 g_max_saved_file_entries = kMaxSavedFileEntries; 448 g_max_saved_file_entries = kMaxSavedFileEntries;
449 } 449 }
450 450
451 } // namespace apps 451 } // namespace apps
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698