summaryrefslogtreecommitdiffstats
path: root/chrome/browser/nacl_host
diff options
context:
space:
mode:
authormcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-16 21:53:01 +0000
committermcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-16 21:53:01 +0000
commit75e0c50ea17429b69f0a07d17abbed0439d9af88 (patch)
treee6d571c0f557d8bab5c62c3563fa4b7c6fcf91fc /chrome/browser/nacl_host
parent74ce1adb65e73eb76fe37326cf754acfc246380a (diff)
downloadchromium_src-75e0c50ea17429b69f0a07d17abbed0439d9af88.zip
chromium_src-75e0c50ea17429b69f0a07d17abbed0439d9af88.tar.gz
chromium_src-75e0c50ea17429b69f0a07d17abbed0439d9af88.tar.bz2
Fix platform conditionalization of NaCl IRT file name
Recognize ARM vs x86. Give a build error for other machines, where NaCl should not be enabled since it hasn't been ported. BUG= http://code.google.com/p/chromium/issues/detail?id=107883 TEST= nacl_integration R=sehr@google.com Review URL: http://codereview.chromium.org/8964019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114863 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/nacl_host')
-rw-r--r--chrome/browser/nacl_host/nacl_process_host.cc41
1 files changed, 29 insertions, 12 deletions
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc
index 2790c51..ba2fa93 100644
--- a/chrome/browser/nacl_host/nacl_process_host.cc
+++ b/chrome/browser/nacl_host/nacl_process_host.cc
@@ -305,6 +305,34 @@ void NaClProcessHost::OnProcessCrashed(int exit_code) {
LOG(ERROR) << message;
}
+namespace {
+
+// Determine the name of the IRT file based on the architecture.
+
+#define NACL_IRT_FILE_NAME(arch_string) \
+ (FILE_PATH_LITERAL("nacl_irt_") \
+ FILE_PATH_LITERAL(arch_string) \
+ FILE_PATH_LITERAL(".nexe"))
+
+const FilePath::StringType NaClIrtName() {
+#if defined(ARCH_CPU_X86_FAMILY)
+ bool is64 = RunningOnWOW64();
+#if defined(ARCH_CPU_X86_64)
+ is64 = true;
+#endif
+ return is64 ? NACL_IRT_FILE_NAME("x86_64") : NACL_IRT_FILE_NAME("x86_32");
+#elif defined(ARCH_CPU_ARMEL)
+ // TODO(mcgrathr): Eventually we'll need to distinguish arm32 vs thumb2.
+ // That may need to be based on the actual nexe rather than a static
+ // choice, which would require substantial refactoring.
+ return NACL_IRT_FILE_NAME("arm");
+#else
+#error Add support for your architecture to NaCl IRT file selection
+#endif
+}
+
+} // namespace
+
// This only ever runs on the BrowserThread::FILE thread.
// If multiple tasks are posted, the later ones are no-ops.
void NaClBrowser::OpenIrtLibraryFile() {
@@ -331,18 +359,7 @@ void NaClBrowser::OpenIrtLibraryFile() {
return;
}
- bool on_x86_64 = RunningOnWOW64();
-#if defined(__x86_64__)
- on_x86_64 = true;
-#endif
- FilePath::StringType irt_name;
- if (on_x86_64) {
- irt_name = FILE_PATH_LITERAL("nacl_irt_x86_64.nexe");
- } else {
- irt_name = FILE_PATH_LITERAL("nacl_irt_x86_32.nexe");
- }
-
- irt_filepath = plugin_dir.Append(irt_name);
+ irt_filepath = plugin_dir.Append(NaClIrtName());
}
base::PlatformFileError error_code;