| 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/nacl/nacl_broker_listener.h" | 5 #include "components/nacl/broker/nacl_broker_listener.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "components/nacl/common/nacl_debug_exception_handler_win.h" |
| 15 #include "chrome/common/nacl_cmd_line.h" | 15 #include "components/nacl/common/nacl_delegate.h" |
| 16 #include "chrome/common/nacl_debug_exception_handler_win.h" | 16 #include "components/nacl/common/nacl_messages.h" |
| 17 #include "chrome/common/nacl_messages.h" | 17 #include "components/nacl/common/nacl_switches.h" |
| 18 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/common/sandbox_init.h" | 19 #include "content/public/common/sandbox_init.h" |
| 19 #include "ipc/ipc_channel.h" | 20 #include "ipc/ipc_channel.h" |
| 20 #include "ipc/ipc_switches.h" | 21 #include "ipc/ipc_switches.h" |
| 21 #include "sandbox/win/src/sandbox_policy.h" | 22 #include "sandbox/win/src/sandbox_policy.h" |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 void SendReply(IPC::Channel* channel, int32 pid, bool result) { | 26 void SendReply(IPC::Channel* channel, int32 pid, bool result) { |
| 26 channel->Send(new NaClProcessMsg_DebugExceptionHandlerLaunched(pid, result)); | 27 channel->Send(new NaClProcessMsg_DebugExceptionHandlerLaunched(pid, result)); |
| 27 } | 28 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 const std::string& loader_channel_id) { | 89 const std::string& loader_channel_id) { |
| 89 base::ProcessHandle loader_process = 0; | 90 base::ProcessHandle loader_process = 0; |
| 90 base::ProcessHandle loader_handle_in_browser = 0; | 91 base::ProcessHandle loader_handle_in_browser = 0; |
| 91 | 92 |
| 92 // Create the path to the nacl broker/loader executable - it's the executable | 93 // Create the path to the nacl broker/loader executable - it's the executable |
| 93 // this code is running in. | 94 // this code is running in. |
| 94 base::FilePath exe_path; | 95 base::FilePath exe_path; |
| 95 PathService::Get(base::FILE_EXE, &exe_path); | 96 PathService::Get(base::FILE_EXE, &exe_path); |
| 96 if (!exe_path.empty()) { | 97 if (!exe_path.empty()) { |
| 97 CommandLine* cmd_line = new CommandLine(exe_path); | 98 CommandLine* cmd_line = new CommandLine(exe_path); |
| 98 nacl::CopyNaClCommandLineArguments(cmd_line); | 99 GetNaClDelegate()->CopyNaClCommandLineArguments(cmd_line); |
| 99 | 100 |
| 100 cmd_line->AppendSwitchASCII(switches::kProcessType, | 101 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 101 switches::kNaClLoaderProcess); | 102 switches::kNaClLoaderProcess); |
| 102 | 103 |
| 103 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, | 104 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, |
| 104 loader_channel_id); | 105 loader_channel_id); |
| 105 | 106 |
| 106 loader_process = content::StartSandboxedProcess(this, cmd_line); | 107 loader_process = content::StartSandboxedProcess(this, cmd_line); |
| 107 if (loader_process) { | 108 if (loader_process) { |
| 108 DuplicateHandle(::GetCurrentProcess(), loader_process, | 109 DuplicateHandle(::GetCurrentProcess(), loader_process, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 120 const std::string& startup_info) { | 121 const std::string& startup_info) { |
| 121 NaClStartDebugExceptionHandlerThread( | 122 NaClStartDebugExceptionHandlerThread( |
| 122 process_handle, startup_info, | 123 process_handle, startup_info, |
| 123 base::MessageLoopProxy::current(), | 124 base::MessageLoopProxy::current(), |
| 124 base::Bind(SendReply, channel_.get(), pid)); | 125 base::Bind(SendReply, channel_.get(), pid)); |
| 125 } | 126 } |
| 126 | 127 |
| 127 void NaClBrokerListener::OnStopBroker() { | 128 void NaClBrokerListener::OnStopBroker() { |
| 128 base::MessageLoop::current()->Quit(); | 129 base::MessageLoop::current()->Quit(); |
| 129 } | 130 } |
| OLD | NEW |