| OLD | NEW |
| 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_process_host.h" | 5 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "chrome/browser/extensions/extension_info_map.h" | 26 #include "chrome/browser/extensions/extension_info_map.h" |
| 27 #include "chrome/browser/nacl_host/nacl_browser.h" | 27 #include "chrome/browser/nacl_host/nacl_browser.h" |
| 28 #include "chrome/browser/nacl_host/nacl_host_message_filter.h" | 28 #include "chrome/browser/nacl_host/nacl_host_message_filter.h" |
| 29 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory
.h" | 29 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory
.h" |
| 30 #include "chrome/common/chrome_constants.h" | |
| 31 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
| 32 #include "chrome/common/chrome_process_type.h" | 31 #include "chrome/common/chrome_process_type.h" |
| 33 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/chrome_version_info.h" | 33 #include "chrome/common/chrome_version_info.h" |
| 35 #include "chrome/common/logging_chrome.h" | 34 #include "chrome/common/logging_chrome.h" |
| 36 #include "chrome/common/nacl_cmd_line.h" | 35 #include "chrome/common/nacl_cmd_line.h" |
| 37 #include "chrome/common/nacl_host_messages.h" | 36 #include "chrome/common/nacl_host_messages.h" |
| 38 #include "chrome/common/nacl_messages.h" | 37 #include "chrome/common/nacl_messages.h" |
| 39 #include "chrome/common/render_messages.h" | 38 #include "chrome/common/render_messages.h" |
| 40 #include "content/public/browser/browser_child_process_host.h" | 39 #include "content/public/browser/browser_child_process_host.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 int flags = ChildProcessHost::CHILD_NORMAL; | 435 int flags = ChildProcessHost::CHILD_NORMAL; |
| 437 #endif | 436 #endif |
| 438 | 437 |
| 439 base::FilePath exe_path = ChildProcessHost::GetChildPath(flags); | 438 base::FilePath exe_path = ChildProcessHost::GetChildPath(flags); |
| 440 if (exe_path.empty()) | 439 if (exe_path.empty()) |
| 441 return false; | 440 return false; |
| 442 | 441 |
| 443 #if defined(OS_WIN) | 442 #if defined(OS_WIN) |
| 444 // On Windows 64-bit NaCl loader is called nacl64.exe instead of chrome.exe | 443 // On Windows 64-bit NaCl loader is called nacl64.exe instead of chrome.exe |
| 445 if (RunningOnWOW64()) { | 444 if (RunningOnWOW64()) { |
| 446 base::FilePath module_path; | 445 if (!NaClBrowser::GetInstance()->GetNaCl64ExePath(&exe_path)) { |
| 447 if (!PathService::Get(base::FILE_MODULE, &module_path)) { | |
| 448 LOG(ERROR) << "NaCl process launch failed: could not resolve module"; | |
| 449 return false; | 446 return false; |
| 450 } | 447 } |
| 451 exe_path = module_path.DirName().Append(chrome::kNaClAppName); | |
| 452 } | 448 } |
| 453 #endif | 449 #endif |
| 454 | 450 |
| 455 scoped_ptr<CommandLine> cmd_line(new CommandLine(exe_path)); | 451 scoped_ptr<CommandLine> cmd_line(new CommandLine(exe_path)); |
| 456 nacl::CopyNaClCommandLineArguments(cmd_line.get()); | 452 nacl::CopyNaClCommandLineArguments(cmd_line.get()); |
| 457 | 453 |
| 458 cmd_line->AppendSwitchASCII(switches::kProcessType, | 454 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 459 switches::kNaClLoaderProcess); | 455 switches::kNaClLoaderProcess); |
| 460 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 456 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| 461 if (logging::DialogsAreSuppressed()) | 457 if (logging::DialogsAreSuppressed()) |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 } else { | 926 } else { |
| 931 NaClStartDebugExceptionHandlerThread( | 927 NaClStartDebugExceptionHandlerThread( |
| 932 process_handle.Take(), info, | 928 process_handle.Take(), info, |
| 933 base::MessageLoopProxy::current(), | 929 base::MessageLoopProxy::current(), |
| 934 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 930 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 935 weak_factory_.GetWeakPtr())); | 931 weak_factory_.GetWeakPtr())); |
| 936 return true; | 932 return true; |
| 937 } | 933 } |
| 938 } | 934 } |
| 939 #endif | 935 #endif |
| OLD | NEW |