Chromium Code Reviews| 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 "components/nacl/browser/nacl_process_host.h" | 5 #include "components/nacl/browser/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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 585 env->SetVar(kPath, new_path); | 585 env->SetVar(kPath, new_path); |
| 586 } | 586 } |
| 587 #endif // _DLL | 587 #endif // _DLL |
| 588 } | 588 } |
| 589 #endif | 589 #endif |
| 590 | 590 |
| 591 scoped_ptr<CommandLine> cmd_line(new CommandLine(exe_path)); | 591 scoped_ptr<CommandLine> cmd_line(new CommandLine(exe_path)); |
| 592 CopyNaClCommandLineArguments(cmd_line.get()); | 592 CopyNaClCommandLineArguments(cmd_line.get()); |
| 593 | 593 |
| 594 cmd_line->AppendSwitchASCII(switches::kProcessType, | 594 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 595 uses_nonsfi_mode_ ? | |
| 596 switches::kNaClNonSfiLoaderProcess : | |
|
Mark Seaborn
2014/03/28 15:38:42
Have you checked all the places that use kNaClLoad
hamaji
2014/03/30 03:31:35
Sorry, I forgot to check this. It seems the one yo
| |
| 595 switches::kNaClLoaderProcess); | 597 switches::kNaClLoaderProcess); |
| 596 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 598 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| 597 if (NaClBrowser::GetDelegate()->DialogsAreSuppressed()) | 599 if (NaClBrowser::GetDelegate()->DialogsAreSuppressed()) |
| 598 cmd_line->AppendSwitch(switches::kNoErrorDialogs); | 600 cmd_line->AppendSwitch(switches::kNoErrorDialogs); |
| 599 | 601 |
| 600 // On Windows we might need to start the broker process to launch a new loader | 602 // On Windows we might need to start the broker process to launch a new loader |
| 601 #if defined(OS_WIN) | 603 #if defined(OS_WIN) |
| 602 if (RunningOnWOW64()) { | 604 if (RunningOnWOW64()) { |
| 603 if (!NaClBrokerService::GetInstance()->LaunchLoader( | 605 if (!NaClBrokerService::GetInstance()->LaunchLoader( |
| 604 weak_factory_.GetWeakPtr(), channel_id)) { | 606 weak_factory_.GetWeakPtr(), channel_id)) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); | 772 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); |
| 771 params.validation_cache_key = nacl_browser->GetValidationCacheKey(); | 773 params.validation_cache_key = nacl_browser->GetValidationCacheKey(); |
| 772 params.version = NaClBrowser::GetDelegate()->GetVersionString(); | 774 params.version = NaClBrowser::GetDelegate()->GetVersionString(); |
| 773 params.enable_exception_handling = enable_exception_handling_; | 775 params.enable_exception_handling = enable_exception_handling_; |
| 774 params.enable_debug_stub = enable_debug_stub_ && | 776 params.enable_debug_stub = enable_debug_stub_ && |
| 775 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_); | 777 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_); |
| 776 // Enable PPAPI proxy channel creation only for renderer processes. | 778 // Enable PPAPI proxy channel creation only for renderer processes. |
| 777 params.enable_ipc_proxy = enable_ppapi_proxy(); | 779 params.enable_ipc_proxy = enable_ppapi_proxy(); |
| 778 params.uses_irt = uses_irt_; | 780 params.uses_irt = uses_irt_; |
| 779 params.enable_dyncode_syscalls = enable_dyncode_syscalls_; | 781 params.enable_dyncode_syscalls = enable_dyncode_syscalls_; |
| 780 params.uses_nonsfi_mode = uses_nonsfi_mode_; | |
| 781 | 782 |
| 782 const ChildProcessData& data = process_->GetData(); | 783 const ChildProcessData& data = process_->GetData(); |
| 783 if (!ShareHandleToSelLdr(data.handle, | 784 if (!ShareHandleToSelLdr(data.handle, |
| 784 internal_->socket_for_sel_ldr, true, | 785 internal_->socket_for_sel_ldr, true, |
| 785 ¶ms.handles)) { | 786 ¶ms.handles)) { |
| 786 return false; | 787 return false; |
| 787 } | 788 } |
| 788 | 789 |
| 789 if (params.uses_irt) { | 790 if (params.uses_irt) { |
| 790 base::PlatformFile irt_file = nacl_browser->IrtFile(); | 791 base::PlatformFile irt_file = nacl_browser->IrtFile(); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 820 #if defined(OS_POSIX) | 821 #if defined(OS_POSIX) |
| 821 if (params.enable_debug_stub) { | 822 if (params.enable_debug_stub) { |
| 822 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle(); | 823 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle(); |
| 823 if (server_bound_socket != net::kInvalidSocket) { | 824 if (server_bound_socket != net::kInvalidSocket) { |
| 824 params.debug_stub_server_bound_socket = | 825 params.debug_stub_server_bound_socket = |
| 825 FileDescriptor(server_bound_socket, true); | 826 FileDescriptor(server_bound_socket, true); |
| 826 } | 827 } |
| 827 } | 828 } |
| 828 #endif | 829 #endif |
| 829 | 830 |
| 830 if (params.uses_nonsfi_mode) { | 831 if (uses_nonsfi_mode_) { |
| 831 #if defined(OS_LINUX) | 832 #if defined(OS_LINUX) |
| 832 const bool kNonSFIModeSupported = true; | 833 const bool kNonSFIModeSupported = true; |
| 833 #else | 834 #else |
| 834 const bool kNonSFIModeSupported = false; | 835 const bool kNonSFIModeSupported = false; |
| 835 #endif | 836 #endif |
| 836 if (!kNonSFIModeSupported || | 837 if (!kNonSFIModeSupported || |
|
Mark Seaborn
2014/03/28 15:38:42
This sanity check now happens after we've launched
hamaji
2014/03/30 03:31:35
Done. I've moved this to Launch(). It seems there
| |
| 837 !CommandLine::ForCurrentProcess()->HasSwitch( | 838 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 838 switches::kEnableNaClNonSfiMode)) { | 839 switches::kEnableNaClNonSfiMode)) { |
| 839 return false; | 840 return false; |
| 840 } | 841 } |
| 841 } | 842 } |
| 842 | 843 |
| 843 process_->Send(new NaClProcessMsg_Start(params)); | 844 process_->Send(new NaClProcessMsg_Start(params)); |
| 844 | 845 |
| 845 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE; | 846 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE; |
| 846 return true; | 847 return true; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1081 process_handle.Take(), info, | 1082 process_handle.Take(), info, |
| 1082 base::MessageLoopProxy::current(), | 1083 base::MessageLoopProxy::current(), |
| 1083 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1084 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 1084 weak_factory_.GetWeakPtr())); | 1085 weak_factory_.GetWeakPtr())); |
| 1085 return true; | 1086 return true; |
| 1086 } | 1087 } |
| 1087 } | 1088 } |
| 1088 #endif | 1089 #endif |
| 1089 | 1090 |
| 1090 } // namespace nacl | 1091 } // namespace nacl |
| OLD | NEW |