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

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

Issue 56833003: Use base::PostTaskAndReplyWithResults() in more places. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix clang error Created 7 years, 1 month 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 04bc7a27675186aefdd83139109874428d005a57..b1f1236b7a29e5cc897198c77f237243b38ed283 100644
--- a/components/nacl/browser/nacl_browser.cc
+++ b/components/nacl/browser/nacl_browser.cc
@@ -119,34 +119,32 @@ const int64 kCrashesIntervalInSeconds = 120;
namespace nacl {
-void OpenNaClExecutableImpl(const base::FilePath& file_path,
- base::PlatformFile* file) {
+base::PlatformFile 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 = 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) {
- *file = base::kInvalidPlatformFileValue;
- return;
- }
+ if (error_code != base::PLATFORM_FILE_OK)
+ return base::kInvalidPlatformFileValue;
+
// 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);
- *file = base::kInvalidPlatformFileValue;
- return;
+ if (!base::GetPlatformFileInfo(file, &file_info) || file_info.is_directory) {
+ base::ClosePlatformFile(file);
+ return base::kInvalidPlatformFileValue;
}
+ return file;
}
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