| 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 "mojo/shell/runner/host/child_process_host.h" | 5 #include "mojo/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/task_runner.h" | 19 #include "base/task_runner.h" |
| 20 #include "base/thread_task_runner_handle.h" | 20 #include "base/thread_task_runner_handle.h" |
| 21 #include "mojo/edk/embedder/embedder.h" | 21 #include "mojo/edk/embedder/embedder.h" |
| 22 #include "mojo/public/cpp/bindings/interface_ptr_info.h" | 22 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
| 23 #include "mojo/public/cpp/system/core.h" | 23 #include "mojo/public/cpp/system/core.h" |
| 24 #include "mojo/shell/runner/common/switches.h" | 24 #include "mojo/shell/runner/common/switches.h" |
| 25 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | |
| 26 | 25 |
| 27 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 26 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 28 #include "sandbox/linux/services/namespace_sandbox.h" | 27 #include "sandbox/linux/services/namespace_sandbox.h" |
| 29 #endif | 28 #endif |
| 30 | 29 |
| 31 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 32 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
| 33 #endif | 32 #endif |
| 34 | 33 |
| 35 namespace mojo { | 34 namespace mojo { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 << " support."; | 189 << " support."; |
| 191 } | 190 } |
| 192 } else | 191 } else |
| 193 #endif | 192 #endif |
| 194 child_process_ = base::LaunchProcess(child_command_line, options); | 193 child_process_ = base::LaunchProcess(child_command_line, options); |
| 195 | 194 |
| 196 if (child_process_.IsValid()) { | 195 if (child_process_.IsValid()) { |
| 197 platform_channel_pair_.ChildProcessLaunched(); | 196 platform_channel_pair_.ChildProcessLaunched(); |
| 198 if (node_channel_.get()) { | 197 if (node_channel_.get()) { |
| 199 node_channel_->ChildProcessLaunched(); | 198 node_channel_->ChildProcessLaunched(); |
| 200 mojo::embedder::ChildProcessLaunched( | 199 mojo::edk::ChildProcessLaunched( |
| 201 child_process_.Handle(), | 200 child_process_.Handle(), |
| 202 mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle( | 201 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle( |
| 203 node_channel_->PassServerHandle().release().handle))); | 202 node_channel_->PassServerHandle().release().handle))); |
| 204 } | 203 } |
| 205 } | 204 } |
| 206 start_child_process_event_.Signal(); | 205 start_child_process_event_.Signal(); |
| 207 } | 206 } |
| 208 | 207 |
| 209 void ChildProcessHost::AppCompleted(int32_t result) { | 208 void ChildProcessHost::AppCompleted(int32_t result) { |
| 210 if (!on_app_complete_.is_null()) { | 209 if (!on_app_complete_.is_null()) { |
| 211 auto on_app_complete = on_app_complete_; | 210 auto on_app_complete = on_app_complete_; |
| 212 on_app_complete_.reset(); | 211 on_app_complete_.reset(); |
| 213 on_app_complete.Run(result); | 212 on_app_complete.Run(result); |
| 214 } | 213 } |
| 215 } | 214 } |
| 216 | 215 |
| 217 } // namespace shell | 216 } // namespace shell |
| 218 } // namespace mojo | 217 } // namespace mojo |
| OLD | NEW |