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

Side by Side 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, 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 unified diff | Download patch
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/common/nacl_paths.h" 5 #include "components/nacl/common/nacl_paths.h"
6 6
7 #include "base/command_line.h"
7 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
8 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "components/nacl/common/nacl_switches.h"
9 11
10 namespace { 12 namespace {
11 13
12 #if defined(OS_POSIX) && !defined(OS_MACOSX) 14 #if defined(OS_LINUX)
13 // File name of the nacl_helper and nacl_helper_bootstrap, Linux only. 15 // File name of the nacl_helper and nacl_helper_bootstrap, Linux only.
14 const base::FilePath::CharType kInternalNaClHelperFileName[] = 16 const base::FilePath::CharType kInternalNaClHelperFileName[] =
15 FILE_PATH_LITERAL("nacl_helper"); 17 FILE_PATH_LITERAL("nacl_helper");
18 const base::FilePath::CharType kInternalNaClHelperNonSfiFileName[] =
19 FILE_PATH_LITERAL("nacl_helper_nonsfi");
16 const base::FilePath::CharType kInternalNaClHelperBootstrapFileName[] = 20 const base::FilePath::CharType kInternalNaClHelperBootstrapFileName[] =
17 FILE_PATH_LITERAL("nacl_helper_bootstrap"); 21 FILE_PATH_LITERAL("nacl_helper_bootstrap");
22
23 bool GetNaClHelperPath(const base::FilePath::CharType* filename,
24 base::FilePath* output) {
25 if (!PathService::Get(base::DIR_MODULE, output))
26 return false;
27 *output = output->Append(filename);
28 return true;
29 }
30
18 #endif 31 #endif
19 32
20 } // namespace 33 } // namespace
21 34
22 namespace nacl { 35 namespace nacl {
23 36
24 bool PathProvider(int key, base::FilePath* result) { 37 bool PathProvider(int key, base::FilePath* result) {
25 base::FilePath cur;
26 switch (key) { 38 switch (key) {
27 #if defined(OS_LINUX) 39 #if defined(OS_LINUX)
28 case FILE_NACL_HELPER: 40 case FILE_NACL_HELPER:
29 if (!PathService::Get(base::DIR_MODULE, &cur)) 41 return GetNaClHelperPath(kInternalNaClHelperFileName, result);
30 return false; 42 case FILE_NACL_HELPER_NONSFI:
31 cur = cur.Append(kInternalNaClHelperFileName); 43 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
32 break; 44 switches::kUseNaClHelperNonSfi)) {
45 // Currently nacl_helper_nonsfi is disabled, so use nacl_helper
46 // in Non-SFI mode instead.
hamaji 2014/10/28 07:13:17 TODO: remove this code path?
hidehiko 2014/10/28 08:47:02 Done.
47 return GetNaClHelperPath(kInternalNaClHelperFileName, result);
48 }
49 return GetNaClHelperPath(kInternalNaClHelperNonSfiFileName, result);
33 case FILE_NACL_HELPER_BOOTSTRAP: 50 case FILE_NACL_HELPER_BOOTSTRAP:
34 if (!PathService::Get(base::DIR_MODULE, &cur)) 51 return GetNaClHelperPath(kInternalNaClHelperBootstrapFileName, result);
35 return false;
36 cur = cur.Append(kInternalNaClHelperBootstrapFileName);
37 break;
38 #endif 52 #endif
39 default: 53 default:
40 return false; 54 return false;
41 } 55 }
42
43 *result = cur;
44 return true;
45 } 56 }
46 57
47 // This cannot be done as a static initializer sadly since Visual Studio will 58 // This cannot be done as a static initializer sadly since Visual Studio will
48 // eliminate this object file if there is no direct entry point into it. 59 // eliminate this object file if there is no direct entry point into it.
49 void RegisterPathProvider() { 60 void RegisterPathProvider() {
50 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); 61 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
51 } 62 }
52 63
53 } // namespace nacl 64 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698