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

Side by Side Diff: chrome/browser/nacl_host/nacl_browser.cc

Issue 10825351: Revert 151581 - Eliminate the 'build_ppapi_ipc_proxy_untrusted' build flag for untrusted PPAPI prox… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « build/common.gypi ('k') | chrome/nacl.gypi » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/nacl_host/nacl_browser.h" 5 #include "chrome/browser/nacl_host/nacl_browser.h"
6 6
7 #include "base/command_line.h"
8 #include "base/message_loop.h" 7 #include "base/message_loop.h"
9 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
10 #include "base/path_service.h" 9 #include "base/path_service.h"
11 #include "base/pickle.h" 10 #include "base/pickle.h"
12 #include "base/win/windows_version.h" 11 #include "base/win/windows_version.h"
13 #include "build/build_config.h" 12 #include "build/build_config.h"
14 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/chrome_paths_internal.h" 14 #include "chrome/common/chrome_paths_internal.h"
16 #include "chrome/common/chrome_switches.h"
17 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
18 16
19 namespace { 17 namespace {
20 18
21 // An arbitrary delay to coalesce multiple writes to the cache. 19 // An arbitrary delay to coalesce multiple writes to the cache.
22 const int kValidationCacheCoalescingTimeMS = 6000; 20 const int kValidationCacheCoalescingTimeMS = 6000;
23 const char kValidationCacheSequenceName[] = "NaClValidationCache"; 21 const char kValidationCacheSequenceName[] = "NaClValidationCache";
24 const FilePath::CharType kValidationCacheFileName[] = 22 const FilePath::CharType kValidationCacheFileName[] =
25 FILE_PATH_LITERAL("nacl_validation_cache.bin"); 23 FILE_PATH_LITERAL("nacl_validation_cache.bin");
26 24
27 const bool kValidationCacheEnabledByDefault = true; 25 const bool kValidationCacheEnabledByDefault = true;
28 26
29 enum ValidationCacheStatus { 27 enum ValidationCacheStatus {
30 CACHE_MISS = 0, 28 CACHE_MISS = 0,
31 CACHE_HIT, 29 CACHE_HIT,
32 CACHE_MAX 30 CACHE_MAX
33 }; 31 };
34 32
33 // Determine the name of the IRT file based on the architecture.
34 #define NACL_IRT_FILE_NAME(arch_string) \
35 (FILE_PATH_LITERAL("nacl_irt_") \
36 FILE_PATH_LITERAL(arch_string) \
37 FILE_PATH_LITERAL(".nexe"))
38
35 const FilePath::StringType NaClIrtName() { 39 const FilePath::StringType NaClIrtName() {
36 FilePath::StringType irt_name;
37 if (CommandLine::ForCurrentProcess()->HasSwitch(
38 switches::kEnableNaClIPCProxy))
39 irt_name.append(FILE_PATH_LITERAL("nacl_ipc_irt_"));
40 else
41 irt_name.append(FILE_PATH_LITERAL("nacl_irt_"));
42
43 #if defined(ARCH_CPU_X86_FAMILY) 40 #if defined(ARCH_CPU_X86_FAMILY)
44 #if defined(ARCH_CPU_X86_64) 41 #if defined(ARCH_CPU_X86_64)
45 bool is64 = true; 42 bool is64 = true;
46 #elif defined(OS_WIN) 43 #elif defined(OS_WIN)
47 bool is64 = (base::win::OSInfo::GetInstance()->wow64_status() == 44 bool is64 = (base::win::OSInfo::GetInstance()->wow64_status() ==
48 base::win::OSInfo::WOW64_ENABLED); 45 base::win::OSInfo::WOW64_ENABLED);
49 #else 46 #else
50 bool is64 = false; 47 bool is64 = false;
51 #endif 48 #endif
52 if (is64) 49 return is64 ? NACL_IRT_FILE_NAME("x86_64") : NACL_IRT_FILE_NAME("x86_32");
53 irt_name.append(FILE_PATH_LITERAL("x86_64"));
54 else
55 irt_name.append(FILE_PATH_LITERAL("x86_32"));
56
57 #elif defined(ARCH_CPU_ARMEL) 50 #elif defined(ARCH_CPU_ARMEL)
58 // TODO(mcgrathr): Eventually we'll need to distinguish arm32 vs thumb2. 51 // TODO(mcgrathr): Eventually we'll need to distinguish arm32 vs thumb2.
59 // That may need to be based on the actual nexe rather than a static 52 // That may need to be based on the actual nexe rather than a static
60 // choice, which would require substantial refactoring. 53 // choice, which would require substantial refactoring.
61 irt_name.append(FILE_PATH_LITERAL("arm")); 54 return NACL_IRT_FILE_NAME("arm");
62 #else 55 #else
63 #error Add support for your architecture to NaCl IRT file selection 56 #error Add support for your architecture to NaCl IRT file selection
64 #endif 57 #endif
65 irt_name.append(FILE_PATH_LITERAL(".nexe"));
66 return irt_name;
67 } 58 }
68 59
69 bool CheckEnvVar(const char* name, bool default_value) { 60 bool CheckEnvVar(const char* name, bool default_value) {
70 bool result = default_value; 61 bool result = default_value;
71 const char* var = getenv(name); 62 const char* var = getenv(name);
72 if (var && strlen(var) > 0) { 63 if (var && strlen(var) > 0) {
73 result = var[0] != '0'; 64 result = var[0] != '0';
74 } 65 }
75 return result; 66 return result;
76 } 67 }
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // because it can degrade the responsiveness of the browser. 388 // because it can degrade the responsiveness of the browser.
398 // The task is sequenced so that multiple writes happen in order. 389 // The task is sequenced so that multiple writes happen in order.
399 content::BrowserThread::PostBlockingPoolSequencedTask( 390 content::BrowserThread::PostBlockingPoolSequencedTask(
400 kValidationCacheSequenceName, 391 kValidationCacheSequenceName,
401 FROM_HERE, 392 FROM_HERE,
402 base::Bind(WriteCache, validation_cache_file_path_, 393 base::Bind(WriteCache, validation_cache_file_path_,
403 base::Owned(pickle))); 394 base::Owned(pickle)));
404 } 395 }
405 validation_cache_is_modified_ = false; 396 validation_cache_is_modified_ = false;
406 } 397 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | chrome/nacl.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698