| 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/runner/child_process_host.h" | 5 #include "mojo/runner/child_process_host.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/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/process/kill.h" | 14 #include "base/process/kill.h" |
| 15 #include "base/process/launch.h" | 15 #include "base/process/launch.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
| 18 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
| 19 #include "base/task_runner_util.h" | 19 #include "base/task_runner_util.h" |
| 20 #include "mojo/edk/embedder/embedder.h" | 20 #include "mojo/edk/embedder/embedder.h" |
| 21 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
| 21 #include "mojo/public/cpp/system/core.h" | 22 #include "mojo/public/cpp/system/core.h" |
| 22 #include "mojo/runner/context.h" | 23 #include "mojo/runner/context.h" |
| 23 #include "mojo/runner/switches.h" | 24 #include "mojo/runner/switches.h" |
| 24 #include "mojo/runner/task_runners.h" | 25 #include "mojo/runner/task_runners.h" |
| 25 #include "ui/gl/gl_switches.h" | 26 #include "ui/gl/gl_switches.h" |
| 26 | 27 |
| 27 namespace mojo { | 28 namespace mojo { |
| 28 namespace runner { | 29 namespace runner { |
| 29 | 30 |
| 30 ChildProcessHost::ChildProcessHost(Context* context, const std::string& name) | 31 ChildProcessHost::ChildProcessHost(Context* context, const std::string& name) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 void ChildProcessHost::Start() { | 45 void ChildProcessHost::Start() { |
| 45 DCHECK(!child_process_.IsValid()); | 46 DCHECK(!child_process_.IsValid()); |
| 46 DCHECK(platform_channel_.is_valid()); | 47 DCHECK(platform_channel_.is_valid()); |
| 47 | 48 |
| 48 ScopedMessagePipeHandle handle(embedder::CreateChannel( | 49 ScopedMessagePipeHandle handle(embedder::CreateChannel( |
| 49 platform_channel_.Pass(), context_->task_runners()->io_runner(), | 50 platform_channel_.Pass(), context_->task_runners()->io_runner(), |
| 50 base::Bind(&ChildProcessHost::DidCreateChannel, base::Unretained(this)), | 51 base::Bind(&ChildProcessHost::DidCreateChannel, base::Unretained(this)), |
| 51 base::MessageLoop::current()->message_loop_proxy())); | 52 base::MessageLoop::current()->message_loop_proxy())); |
| 52 | 53 |
| 53 controller_.Bind(handle.Pass()); | 54 controller_.Bind(InterfacePtrInfo<ChildController>(handle.Pass(), 0u)); |
| 54 | 55 |
| 55 CHECK(base::PostTaskAndReplyWithResult( | 56 CHECK(base::PostTaskAndReplyWithResult( |
| 56 context_->task_runners()->blocking_pool(), FROM_HERE, | 57 context_->task_runners()->blocking_pool(), FROM_HERE, |
| 57 base::Bind(&ChildProcessHost::DoLaunch, base::Unretained(this)), | 58 base::Bind(&ChildProcessHost::DoLaunch, base::Unretained(this)), |
| 58 base::Bind(&ChildProcessHost::DidStart, base::Unretained(this)))); | 59 base::Bind(&ChildProcessHost::DidStart, base::Unretained(this)))); |
| 59 } | 60 } |
| 60 | 61 |
| 61 int ChildProcessHost::Join() { | 62 int ChildProcessHost::Join() { |
| 62 DCHECK(child_process_.IsValid()); | 63 DCHECK(child_process_.IsValid()); |
| 63 int rv = -1; | 64 int rv = -1; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 155 |
| 155 void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) { | 156 void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) { |
| 156 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()"; | 157 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()"; |
| 157 | 158 |
| 158 CHECK(channel_info); | 159 CHECK(channel_info); |
| 159 channel_info_ = channel_info; | 160 channel_info_ = channel_info; |
| 160 } | 161 } |
| 161 | 162 |
| 162 } // namespace runner | 163 } // namespace runner |
| 163 } // namespace mojo | 164 } // namespace mojo |
| OLD | NEW |