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

Unified Diff: components/nacl/common/nacl_paths.cc

Issue 676323002: Non-SFI mode: Add --use-nacl-helper-nonsfi flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/common/nacl_paths.h ('k') | components/nacl/common/nacl_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/common/nacl_paths.cc
diff --git a/components/nacl/common/nacl_paths.cc b/components/nacl/common/nacl_paths.cc
index 98efbfcb88928683392b1c838454456bb35fe057..442d1493689ce75d0dabda3e23b6ab64e6001cf3 100644
--- a/components/nacl/common/nacl_paths.cc
+++ b/components/nacl/common/nacl_paths.cc
@@ -4,17 +4,30 @@
#include "components/nacl/common/nacl_paths.h"
+#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
+#include "components/nacl/common/nacl_switches.h"
namespace {
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_LINUX)
// File name of the nacl_helper and nacl_helper_bootstrap, Linux only.
const base::FilePath::CharType kInternalNaClHelperFileName[] =
FILE_PATH_LITERAL("nacl_helper");
+const base::FilePath::CharType kInternalNaClHelperNonSfiFileName[] =
+ FILE_PATH_LITERAL("nacl_helper_nonsfi");
const base::FilePath::CharType kInternalNaClHelperBootstrapFileName[] =
FILE_PATH_LITERAL("nacl_helper_bootstrap");
+
+bool GetNaClHelperPath(const base::FilePath::CharType* filename,
+ base::FilePath* output) {
+ if (!PathService::Get(base::DIR_MODULE, output))
+ return false;
+ *output = output->Append(filename);
+ return true;
+}
+
#endif
} // namespace
@@ -22,26 +35,26 @@ const base::FilePath::CharType kInternalNaClHelperBootstrapFileName[] =
namespace nacl {
bool PathProvider(int key, base::FilePath* result) {
- base::FilePath cur;
switch (key) {
#if defined(OS_LINUX)
case FILE_NACL_HELPER:
- if (!PathService::Get(base::DIR_MODULE, &cur))
- return false;
- cur = cur.Append(kInternalNaClHelperFileName);
- break;
+ return GetNaClHelperPath(kInternalNaClHelperFileName, result);
+ case FILE_NACL_HELPER_NONSFI:
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUseNaClHelperNonSfi)) {
+ // Currently nacl_helper_nonsfi is disabled, so use nacl_helper
+ // in Non-SFI mode instead.
+ // TODO(hidehiko): Remove this code path after nacl_helper_nonsfi
+ // is supported.
+ return GetNaClHelperPath(kInternalNaClHelperFileName, result);
+ }
+ return GetNaClHelperPath(kInternalNaClHelperNonSfiFileName, result);
case FILE_NACL_HELPER_BOOTSTRAP:
- if (!PathService::Get(base::DIR_MODULE, &cur))
- return false;
- cur = cur.Append(kInternalNaClHelperBootstrapFileName);
- break;
+ return GetNaClHelperPath(kInternalNaClHelperBootstrapFileName, result);
#endif
default:
return false;
}
-
- *result = cur;
- return true;
}
// This cannot be done as a static initializer sadly since Visual Studio will
« no previous file with comments | « components/nacl/common/nacl_paths.h ('k') | components/nacl/common/nacl_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698