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

Side by Side Diff: components/nacl/browser/nacl_browser.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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 | components/nacl/browser/nacl_file_host.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 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 "components/nacl/browser/nacl_browser.h" 5 #include "components/nacl/browser/nacl_browser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_proxy.h" 10 #include "base/files/file_proxy.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 bool is_executable) { 123 bool is_executable) {
124 // Get a file descriptor. On Windows, we need 'GENERIC_EXECUTE' in order to 124 // Get a file descriptor. On Windows, we need 'GENERIC_EXECUTE' in order to
125 // memory map the executable. 125 // memory map the executable.
126 // IMPORTANT: This file descriptor must not have write access - that could 126 // IMPORTANT: This file descriptor must not have write access - that could
127 // allow a NaCl inner sandbox escape. 127 // allow a NaCl inner sandbox escape.
128 uint32_t flags = base::File::FLAG_OPEN | base::File::FLAG_READ; 128 uint32_t flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
129 if (is_executable) 129 if (is_executable)
130 flags |= base::File::FLAG_EXECUTE; // Windows only flag. 130 flags |= base::File::FLAG_EXECUTE; // Windows only flag.
131 base::File file(file_path, flags); 131 base::File file(file_path, flags);
132 if (!file.IsValid()) 132 if (!file.IsValid())
133 return file.Pass(); 133 return file;
134 134
135 // Check that the file does not reference a directory. Returning a descriptor 135 // Check that the file does not reference a directory. Returning a descriptor
136 // to an extension directory could allow an outer sandbox escape. openat(...) 136 // to an extension directory could allow an outer sandbox escape. openat(...)
137 // could be used to traverse into the file system. 137 // could be used to traverse into the file system.
138 base::File::Info file_info; 138 base::File::Info file_info;
139 if (!file.GetInfo(&file_info) || file_info.is_directory) 139 if (!file.GetInfo(&file_info) || file_info.is_directory)
140 return base::File(); 140 return base::File();
141 141
142 return file.Pass(); 142 return file;
143 } 143 }
144 144
145 NaClBrowser::NaClBrowser() 145 NaClBrowser::NaClBrowser()
146 : irt_filepath_(), 146 : irt_filepath_(),
147 irt_state_(NaClResourceUninitialized), 147 irt_state_(NaClResourceUninitialized),
148 validation_cache_file_path_(), 148 validation_cache_file_path_(),
149 validation_cache_is_enabled_(false), 149 validation_cache_is_enabled_(false),
150 validation_cache_is_modified_(false), 150 validation_cache_is_modified_(false),
151 validation_cache_state_(NaClResourceUninitialized), 151 validation_cache_state_(NaClResourceUninitialized),
152 path_cache_(kFilePathCacheSize), 152 path_cache_(kFilePathCacheSize),
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 bool NaClBrowser::IsThrottled() { 565 bool NaClBrowser::IsThrottled() {
566 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 566 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
567 if (crash_times_.size() != kMaxCrashesPerInterval) { 567 if (crash_times_.size() != kMaxCrashesPerInterval) {
568 return false; 568 return false;
569 } 569 }
570 base::TimeDelta delta = base::Time::Now() - crash_times_.front(); 570 base::TimeDelta delta = base::Time::Now() - crash_times_.front();
571 return delta.InSeconds() <= kCrashesIntervalInSeconds; 571 return delta.InSeconds() <= kCrashesIntervalInSeconds;
572 } 572 }
573 573
574 } // namespace nacl 574 } // namespace nacl
OLDNEW
« no previous file with comments | « no previous file | components/nacl/browser/nacl_file_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698