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 |
(...skipping 15 matching lines...) Expand all Loading... |
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/renderer_host/chrome_render_message_filter.h" | 28 #include "chrome/browser/renderer_host/chrome_render_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" | 30 #include "chrome/common/chrome_constants.h" |
31 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
32 #include "chrome/common/chrome_process_type.h" | 32 #include "chrome/common/chrome_process_type.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/chrome_version_info.h" | 34 #include "chrome/common/chrome_version_info.h" |
35 #include "chrome/common/logging_chrome.h" | 35 #include "chrome/common/logging_chrome.h" |
36 #include "chrome/common/nacl_cmd_line.h" | |
37 #include "chrome/common/nacl_messages.h" | |
38 #include "chrome/common/render_messages.h" | 36 #include "chrome/common/render_messages.h" |
| 37 #include "components/nacl/common/nacl_delegate.h" |
| 38 #include "components/nacl/common/nacl_messages.h" |
| 39 #include "components/nacl/common/nacl_switches.h" |
39 #include "content/public/browser/browser_child_process_host.h" | 40 #include "content/public/browser/browser_child_process_host.h" |
40 #include "content/public/browser/browser_ppapi_host.h" | 41 #include "content/public/browser/browser_ppapi_host.h" |
41 #include "content/public/browser/child_process_data.h" | 42 #include "content/public/browser/child_process_data.h" |
42 #include "content/public/common/child_process_host.h" | 43 #include "content/public/common/child_process_host.h" |
43 #include "content/public/common/process_type.h" | 44 #include "content/public/common/process_type.h" |
44 #include "extensions/common/constants.h" | 45 #include "extensions/common/constants.h" |
45 #include "ipc/ipc_channel.h" | 46 #include "ipc/ipc_channel.h" |
46 #include "ipc/ipc_switches.h" | 47 #include "ipc/ipc_switches.h" |
47 #include "native_client/src/shared/imc/nacl_imc_c.h" | 48 #include "native_client/src/shared/imc/nacl_imc_c.h" |
48 #include "net/base/net_util.h" | 49 #include "net/base/net_util.h" |
49 #include "net/socket/tcp_listen_socket.h" | 50 #include "net/socket/tcp_listen_socket.h" |
50 #include "ppapi/host/ppapi_host.h" | 51 #include "ppapi/host/ppapi_host.h" |
51 #include "ppapi/proxy/ppapi_messages.h" | 52 #include "ppapi/proxy/ppapi_messages.h" |
52 #include "ppapi/shared_impl/ppapi_nacl_channel_args.h" | 53 #include "ppapi/shared_impl/ppapi_nacl_channel_args.h" |
53 | 54 |
54 #if defined(OS_POSIX) | 55 #if defined(OS_POSIX) |
55 #include <fcntl.h> | 56 #include <fcntl.h> |
56 | 57 |
57 #include "ipc/ipc_channel_posix.h" | 58 #include "ipc/ipc_channel_posix.h" |
58 #elif defined(OS_WIN) | 59 #elif defined(OS_WIN) |
59 #include <windows.h> | 60 #include <windows.h> |
60 | 61 |
61 #include "base/threading/thread.h" | 62 #include "base/threading/thread.h" |
62 #include "base/win/scoped_handle.h" | 63 #include "base/win/scoped_handle.h" |
63 #include "chrome/browser/nacl_host/nacl_broker_service_win.h" | 64 #include "chrome/browser/nacl_host/nacl_broker_service_win.h" |
64 #include "chrome/common/nacl_debug_exception_handler_win.h" | 65 #include "components/nacl/common/nacl_debug_exception_handler_win.h" |
65 #include "content/public/common/sandbox_init.h" | 66 #include "content/public/common/sandbox_init.h" |
66 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 67 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
67 #endif | 68 #endif |
68 | 69 |
69 using content::BrowserThread; | 70 using content::BrowserThread; |
70 using content::ChildProcessData; | 71 using content::ChildProcessData; |
71 using content::ChildProcessHost; | 72 using content::ChildProcessHost; |
72 using ppapi::proxy::SerializedHandle; | 73 using ppapi::proxy::SerializedHandle; |
73 | 74 |
74 namespace { | 75 namespace { |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 base::FilePath module_path; | 446 base::FilePath module_path; |
446 if (!PathService::Get(base::FILE_MODULE, &module_path)) { | 447 if (!PathService::Get(base::FILE_MODULE, &module_path)) { |
447 LOG(ERROR) << "NaCl process launch failed: could not resolve module"; | 448 LOG(ERROR) << "NaCl process launch failed: could not resolve module"; |
448 return false; | 449 return false; |
449 } | 450 } |
450 exe_path = module_path.DirName().Append(chrome::kNaClAppName); | 451 exe_path = module_path.DirName().Append(chrome::kNaClAppName); |
451 } | 452 } |
452 #endif | 453 #endif |
453 | 454 |
454 scoped_ptr<CommandLine> cmd_line(new CommandLine(exe_path)); | 455 scoped_ptr<CommandLine> cmd_line(new CommandLine(exe_path)); |
455 nacl::CopyNaClCommandLineArguments(cmd_line.get()); | 456 GetNaClDelegate()->CopyNaClCommandLineArguments(cmd_line.get()); |
456 | 457 |
457 cmd_line->AppendSwitchASCII(switches::kProcessType, | 458 cmd_line->AppendSwitchASCII(switches::kProcessType, |
458 switches::kNaClLoaderProcess); | 459 switches::kNaClLoaderProcess); |
459 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 460 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
460 if (logging::DialogsAreSuppressed()) | 461 if (logging::DialogsAreSuppressed()) |
461 cmd_line->AppendSwitch(switches::kNoErrorDialogs); | 462 cmd_line->AppendSwitch(switches::kNoErrorDialogs); |
462 | 463 |
463 if (!nacl_loader_prefix.empty()) | 464 if (!nacl_loader_prefix.empty()) |
464 cmd_line->PrependWrapper(nacl_loader_prefix); | 465 cmd_line->PrependWrapper(nacl_loader_prefix); |
465 | 466 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 } else { | 930 } else { |
930 NaClStartDebugExceptionHandlerThread( | 931 NaClStartDebugExceptionHandlerThread( |
931 process_handle.Take(), info, | 932 process_handle.Take(), info, |
932 base::MessageLoopProxy::current(), | 933 base::MessageLoopProxy::current(), |
933 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 934 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
934 weak_factory_.GetWeakPtr())); | 935 weak_factory_.GetWeakPtr())); |
935 return true; | 936 return true; |
936 } | 937 } |
937 } | 938 } |
938 #endif | 939 #endif |
OLD | NEW |