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 "shell/child_process_host.h" | 5 #include "shell/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/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 mojo::ScopedMessagePipeHandle handle(mojo::embedder::ConnectToSlave( | 53 mojo::ScopedMessagePipeHandle handle(mojo::embedder::ConnectToSlave( |
54 nullptr, launch_data->platform_channel_pair.PassServerHandle(), | 54 nullptr, launch_data->platform_channel_pair.PassServerHandle(), |
55 base::Bind(&ChildProcessHost::DidConnectToSlave, base::Unretained(this)), | 55 base::Bind(&ChildProcessHost::DidConnectToSlave, base::Unretained(this)), |
56 base::MessageLoop::current()->message_loop_proxy(), | 56 base::MessageLoop::current()->message_loop_proxy(), |
57 &launch_data->child_connection_id, &channel_info_)); | 57 &launch_data->child_connection_id, &channel_info_)); |
58 // TODO(vtl): We should destroy the channel on destruction (using | 58 // TODO(vtl): We should destroy the channel on destruction (using |
59 // |channel_info_|, but only after the callback has been called. | 59 // |channel_info_|, but only after the callback has been called. |
60 CHECK(channel_info_); | 60 CHECK(channel_info_); |
61 | 61 |
62 controller_.Bind(mojo::InterfacePtrInfo<ChildController>(handle.Pass(), 0u)); | 62 controller_.Bind(mojo::InterfacePtrInfo<ChildController>(handle.Pass(), 0u)); |
63 controller_.set_error_handler(this); | 63 controller_.set_connection_error_handler([this]() { OnConnectionError(); }); |
64 | 64 |
65 CHECK(base::PostTaskAndReplyWithResult( | 65 CHECK(base::PostTaskAndReplyWithResult( |
66 context_->task_runners()->blocking_pool(), FROM_HERE, | 66 context_->task_runners()->blocking_pool(), FROM_HERE, |
67 base::Bind(&ChildProcessHost::DoLaunch, base::Unretained(this), | 67 base::Bind(&ChildProcessHost::DoLaunch, base::Unretained(this), |
68 base::Passed(&launch_data)), | 68 base::Passed(&launch_data)), |
69 base::Bind(&ChildProcessHost::DidStart, base::Unretained(this)))); | 69 base::Bind(&ChildProcessHost::DidStart, base::Unretained(this)))); |
70 } | 70 } |
71 | 71 |
72 int ChildProcessHost::Join() { | 72 int ChildProcessHost::Join() { |
73 DCHECK(child_process_.IsValid()); | 73 DCHECK(child_process_.IsValid()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 on_app_complete_.reset(); | 147 on_app_complete_.reset(); |
148 on_app_complete.Run(result); | 148 on_app_complete.Run(result); |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 void ChildProcessHost::OnConnectionError() { | 152 void ChildProcessHost::OnConnectionError() { |
153 AppCompleted(MOJO_RESULT_UNKNOWN); | 153 AppCompleted(MOJO_RESULT_UNKNOWN); |
154 } | 154 } |
155 | 155 |
156 } // namespace shell | 156 } // namespace shell |
OLD | NEW |