OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/shell/runner/host/child_process_host.h" | 5 #include "services/shell/runner/host/child_process_host.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/process/kill.h" | 17 #include "base/process/kill.h" |
18 #include "base/process/launch.h" | 18 #include "base/process/launch.h" |
19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
20 #include "base/task_runner.h" | 20 #include "base/task_runner.h" |
21 #include "base/threading/thread_task_runner_handle.h" | 21 #include "base/threading/thread_task_runner_handle.h" |
22 #include "mojo/edk/embedder/embedder.h" | 22 #include "mojo/edk/embedder/embedder.h" |
23 #include "mojo/public/cpp/bindings/interface_ptr_info.h" | 23 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
24 #include "mojo/public/cpp/system/core.h" | 24 #include "mojo/public/cpp/system/core.h" |
25 #include "services/shell/native_runner_delegate.h" | 25 #include "services/shell/native_runner_delegate.h" |
26 #include "services/shell/runner/common/client_util.h" | 26 #include "services/shell/runner/common/client_util.h" |
27 #include "services/shell/runner/common/switches.h" | 27 #include "services/shell/runner/common/switches.h" |
28 | 28 |
29 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 29 #if defined(OS_LINUX) |
30 #include "sandbox/linux/services/namespace_sandbox.h" | 30 #include "sandbox/linux/services/namespace_sandbox.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
34 #include "base/win/windows_version.h" | 34 #include "base/win/windows_version.h" |
35 #endif | 35 #endif |
36 | 36 |
37 #if defined(OS_MACOSX) | 37 #if defined(OS_MACOSX) |
38 #include "services/shell/runner/host/mach_broker.h" | 38 #include "services/shell/runner/host/mach_broker.h" |
39 #endif | 39 #endif |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 handle_passing_info_.push_back(options.stderr_handle); | 170 handle_passing_info_.push_back(options.stderr_handle); |
171 } | 171 } |
172 #elif defined(OS_POSIX) | 172 #elif defined(OS_POSIX) |
173 handle_passing_info_.push_back(std::make_pair(STDIN_FILENO, STDIN_FILENO)); | 173 handle_passing_info_.push_back(std::make_pair(STDIN_FILENO, STDIN_FILENO)); |
174 handle_passing_info_.push_back(std::make_pair(STDOUT_FILENO, STDOUT_FILENO)); | 174 handle_passing_info_.push_back(std::make_pair(STDOUT_FILENO, STDOUT_FILENO)); |
175 handle_passing_info_.push_back(std::make_pair(STDERR_FILENO, STDERR_FILENO)); | 175 handle_passing_info_.push_back(std::make_pair(STDERR_FILENO, STDERR_FILENO)); |
176 options.fds_to_remap = &handle_passing_info_; | 176 options.fds_to_remap = &handle_passing_info_; |
177 #endif | 177 #endif |
178 DVLOG(2) << "Launching child with command line: " | 178 DVLOG(2) << "Launching child with command line: " |
179 << child_command_line->GetCommandLineString(); | 179 << child_command_line->GetCommandLineString(); |
180 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 180 #if defined(OS_LINUX) |
181 if (start_sandboxed_) { | 181 if (start_sandboxed_) { |
182 child_process_ = | 182 child_process_ = |
183 sandbox::NamespaceSandbox::LaunchProcess(*child_command_line, options); | 183 sandbox::NamespaceSandbox::LaunchProcess(*child_command_line, options); |
184 if (!child_process_.IsValid()) { | 184 if (!child_process_.IsValid()) { |
185 LOG(ERROR) << "Starting the process with a sandbox failed. Missing kernel" | 185 LOG(ERROR) << "Starting the process with a sandbox failed. Missing kernel" |
186 << " support."; | 186 << " support."; |
187 } | 187 } |
188 } else | 188 } else |
189 #endif | 189 #endif |
190 { | 190 { |
(...skipping 14 matching lines...) Expand all Loading... |
205 child_process_.Handle(), | 205 child_process_.Handle(), |
206 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle( | 206 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle( |
207 mojo_ipc_channel_->PassServerHandle().release().handle)), | 207 mojo_ipc_channel_->PassServerHandle().release().handle)), |
208 child_token_); | 208 child_token_); |
209 } | 209 } |
210 } | 210 } |
211 start_child_process_event_.Signal(); | 211 start_child_process_event_.Signal(); |
212 } | 212 } |
213 | 213 |
214 } // namespace shell | 214 } // namespace shell |
OLD | NEW |