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

Side by Side Diff: ui/base/resource/data_pack.cc

Issue 1539583003: Convert Pass()→std::move() in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « ui/base/models/list_model.h ('k') | ui/base/resource/data_pack_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/base/resource/data_pack.h" 5 #include "ui/base/resource/data_pack.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <utility>
8 9
9 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
10 #include "base/files/memory_mapped_file.h" 11 #include "base/files/memory_mapped_file.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/memory/ref_counted_memory.h" 13 #include "base/memory/ref_counted_memory.h"
13 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
14 #include "base/strings/string_piece.h" 15 #include "base/strings/string_piece.h"
15 16
16 // For details of the file layout, see 17 // For details of the file layout, see
17 // http://dev.chromium.org/developers/design-documents/linuxresourcesandlocalize dstrings 18 // http://dev.chromium.org/developers/design-documents/linuxresourcesandlocalize dstrings
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 DLOG(ERROR) << "Failed to mmap datapack"; 80 DLOG(ERROR) << "Failed to mmap datapack";
80 UMA_HISTOGRAM_ENUMERATION("DataPack.Load", INIT_FAILED, 81 UMA_HISTOGRAM_ENUMERATION("DataPack.Load", INIT_FAILED,
81 LOAD_ERRORS_COUNT); 82 LOAD_ERRORS_COUNT);
82 mmap_.reset(); 83 mmap_.reset();
83 return false; 84 return false;
84 } 85 }
85 return LoadImpl(); 86 return LoadImpl();
86 } 87 }
87 88
88 bool DataPack::LoadFromFile(base::File file) { 89 bool DataPack::LoadFromFile(base::File file) {
89 return LoadFromFileRegion(file.Pass(), 90 return LoadFromFileRegion(std::move(file),
90 base::MemoryMappedFile::Region::kWholeFile); 91 base::MemoryMappedFile::Region::kWholeFile);
91 } 92 }
92 93
93 bool DataPack::LoadFromFileRegion( 94 bool DataPack::LoadFromFileRegion(
94 base::File file, 95 base::File file,
95 const base::MemoryMappedFile::Region& region) { 96 const base::MemoryMappedFile::Region& region) {
96 mmap_.reset(new base::MemoryMappedFile); 97 mmap_.reset(new base::MemoryMappedFile);
97 if (!mmap_->Initialize(file.Pass(), region)) { 98 if (!mmap_->Initialize(std::move(file), region)) {
98 DLOG(ERROR) << "Failed to mmap datapack"; 99 DLOG(ERROR) << "Failed to mmap datapack";
99 UMA_HISTOGRAM_ENUMERATION("DataPack.Load", INIT_FAILED_FROM_FILE, 100 UMA_HISTOGRAM_ENUMERATION("DataPack.Load", INIT_FAILED_FROM_FILE,
100 LOAD_ERRORS_COUNT); 101 LOAD_ERRORS_COUNT);
101 mmap_.reset(); 102 mmap_.reset();
102 return false; 103 return false;
103 } 104 }
104 return LoadImpl(); 105 return LoadImpl();
105 } 106 }
106 107
107 bool DataPack::LoadImpl() { 108 bool DataPack::LoadImpl() {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 return false; 345 return false;
345 } 346 }
346 } 347 }
347 348
348 base::CloseFile(file); 349 base::CloseFile(file);
349 350
350 return true; 351 return true;
351 } 352 }
352 353
353 } // namespace ui 354 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/models/list_model.h ('k') | ui/base/resource/data_pack_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698