| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/broker/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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // this code is running in. | 99 // this code is running in. |
| 100 base::FilePath exe_path; | 100 base::FilePath exe_path; |
| 101 PathService::Get(base::FILE_EXE, &exe_path); | 101 PathService::Get(base::FILE_EXE, &exe_path); |
| 102 if (!exe_path.empty()) { | 102 if (!exe_path.empty()) { |
| 103 base::CommandLine* cmd_line = new base::CommandLine(exe_path); | 103 base::CommandLine* cmd_line = new base::CommandLine(exe_path); |
| 104 nacl::CopyNaClCommandLineArguments(cmd_line); | 104 nacl::CopyNaClCommandLineArguments(cmd_line); |
| 105 | 105 |
| 106 cmd_line->AppendSwitchASCII(switches::kProcessType, | 106 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 107 switches::kNaClLoaderProcess); | 107 switches::kNaClLoaderProcess); |
| 108 | 108 |
| 109 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, | 109 cmd_line->AppendSwitchASCII(switches::kMojoChannelToken, |
| 110 loader_channel_id); | 110 loader_channel_id); |
| 111 | 111 |
| 112 base::Process loader_process; | 112 base::Process loader_process; |
| 113 sandbox::ResultCode result = content::StartSandboxedProcess( | 113 sandbox::ResultCode result = content::StartSandboxedProcess( |
| 114 this, cmd_line, base::HandlesToInheritVector(), &loader_process); | 114 this, cmd_line, base::HandlesToInheritVector(), &loader_process); |
| 115 | 115 |
| 116 if (result == sandbox::SBOX_ALL_OK) { | 116 if (result == sandbox::SBOX_ALL_OK) { |
| 117 // Note: PROCESS_DUP_HANDLE is necessary here, because: | 117 // Note: PROCESS_DUP_HANDLE is necessary here, because: |
| 118 // 1) The current process is the broker, which is the loader's parent. | 118 // 1) The current process is the broker, which is the loader's parent. |
| 119 // 2) The browser is not the loader's parent, and so only gets the | 119 // 2) The browser is not the loader's parent, and so only gets the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 139 const std::string& startup_info) { | 139 const std::string& startup_info) { |
| 140 NaClStartDebugExceptionHandlerThread( | 140 NaClStartDebugExceptionHandlerThread( |
| 141 base::Process(process_handle), startup_info, | 141 base::Process(process_handle), startup_info, |
| 142 base::ThreadTaskRunnerHandle::Get(), | 142 base::ThreadTaskRunnerHandle::Get(), |
| 143 base::Bind(SendReply, channel_.get(), pid)); | 143 base::Bind(SendReply, channel_.get(), pid)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void NaClBrokerListener::OnStopBroker() { | 146 void NaClBrokerListener::OnStopBroker() { |
| 147 base::MessageLoop::current()->QuitWhenIdle(); | 147 base::MessageLoop::current()->QuitWhenIdle(); |
| 148 } | 148 } |
| OLD | NEW |