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

Unified Diff: components/nacl/browser/nacl_browser.cc

Issue 165663002: Remove some PlatformFile uses from NaCl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add empty line Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/nacl/browser/nacl_browser.h ('k') | components/nacl/browser/nacl_file_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/browser/nacl_browser.cc
diff --git a/components/nacl/browser/nacl_browser.cc b/components/nacl/browser/nacl_browser.cc
index b6a14fe1282e416a76ecc239315ac257129b2e6f..3d336db484ca00f777729fe77d80712e1a61bb44 100644
--- a/components/nacl/browser/nacl_browser.cc
+++ b/components/nacl/browser/nacl_browser.cc
@@ -119,32 +119,26 @@ const int64 kCrashesIntervalInSeconds = 120;
namespace nacl {
-base::PlatformFile OpenNaClExecutableImpl(const base::FilePath& file_path) {
+base::File OpenNaClExecutableImpl(const base::FilePath& file_path) {
// Get a file descriptor. On Windows, we need 'GENERIC_EXECUTE' in order to
// memory map the executable.
// IMPORTANT: This file descriptor must not have write access - that could
// allow a NaCl inner sandbox escape.
- base::PlatformFile file;
- base::PlatformFileError error_code;
- file = base::CreatePlatformFile(
- file_path,
- (base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
- base::PLATFORM_FILE_EXECUTE), // Windows only flag.
- NULL,
- &error_code);
- if (error_code != base::PLATFORM_FILE_OK)
- return base::kInvalidPlatformFileValue;
+ base::File file(file_path,
+ (base::File::FLAG_OPEN |
+ base::File::FLAG_READ |
+ base::File::FLAG_EXECUTE)); // Windows only flag.
+ if (!file.IsValid())
+ return file.Pass();
// Check that the file does not reference a directory. Returning a descriptor
// to an extension directory could allow an outer sandbox escape. openat(...)
// could be used to traverse into the file system.
- base::PlatformFileInfo file_info;
- if (!base::GetPlatformFileInfo(file, &file_info) || file_info.is_directory) {
- base::ClosePlatformFile(file);
- return base::kInvalidPlatformFileValue;
- }
- return file;
+ base::File::Info file_info;
+ if (!file.GetInfo(&file_info) || file_info.is_directory)
+ return base::File();
+
+ return file.Pass();
}
NaClBrowser::NaClBrowser()
« no previous file with comments | « components/nacl/browser/nacl_browser.h ('k') | components/nacl/browser/nacl_file_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698