| 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 24 matching lines...) Expand all Loading... |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 ChildProcessHost::ChildProcessHost(Context* context) | 37 ChildProcessHost::ChildProcessHost(Context* context) |
| 38 : context_(context), channel_info_(nullptr) { | 38 : context_(context), channel_info_(nullptr) { |
| 39 } | 39 } |
| 40 | 40 |
| 41 ChildProcessHost::~ChildProcessHost() { | 41 ChildProcessHost::~ChildProcessHost() { |
| 42 DCHECK(!child_process_.IsValid()); | 42 DCHECK(!child_process_.IsValid()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void ChildProcessHost::Start() { | 45 void ChildProcessHost::Start(bool require_32_bit) { |
| 46 DCHECK(!child_process_.IsValid()); | 46 DCHECK(!child_process_.IsValid()); |
| 47 | 47 |
| 48 scoped_ptr<LaunchData> launch_data(new LaunchData()); | 48 scoped_ptr<LaunchData> launch_data(new LaunchData()); |
| 49 launch_data->child_path = context_->mojo_shell_child_path(); | 49 if (require_32_bit) |
| 50 launch_data->child_path = context_->mojo_shell_child_path_32_bit(); |
| 51 else |
| 52 launch_data->child_path = context_->mojo_shell_child_path(); |
| 50 | 53 |
| 51 // TODO(vtl): Add something for |slave_info|. | 54 // TODO(vtl): Add something for |slave_info|. |
| 52 // TODO(vtl): The "unretained this" is wrong (see also below). | 55 // TODO(vtl): The "unretained this" is wrong (see also below). |
| 53 mojo::ScopedMessagePipeHandle handle(mojo::embedder::ConnectToSlave( | 56 mojo::ScopedMessagePipeHandle handle(mojo::embedder::ConnectToSlave( |
| 54 nullptr, launch_data->platform_channel_pair.PassServerHandle(), | 57 nullptr, launch_data->platform_channel_pair.PassServerHandle(), |
| 55 base::Bind(&ChildProcessHost::DidConnectToSlave, base::Unretained(this)), | 58 base::Bind(&ChildProcessHost::DidConnectToSlave, base::Unretained(this)), |
| 56 base::MessageLoop::current()->message_loop_proxy(), | 59 base::MessageLoop::current()->message_loop_proxy(), |
| 57 &launch_data->child_connection_id, &channel_info_)); | 60 &launch_data->child_connection_id, &channel_info_)); |
| 58 // TODO(vtl): We should destroy the channel on destruction (using | 61 // TODO(vtl): We should destroy the channel on destruction (using |
| 59 // |channel_info_|, but only after the callback has been called. | 62 // |channel_info_|, but only after the callback has been called. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 on_app_complete_.reset(); | 150 on_app_complete_.reset(); |
| 148 on_app_complete.Run(result); | 151 on_app_complete.Run(result); |
| 149 } | 152 } |
| 150 } | 153 } |
| 151 | 154 |
| 152 void ChildProcessHost::OnConnectionError() { | 155 void ChildProcessHost::OnConnectionError() { |
| 153 AppCompleted(MOJO_RESULT_UNKNOWN); | 156 AppCompleted(MOJO_RESULT_UNKNOWN); |
| 154 } | 157 } |
| 155 | 158 |
| 156 } // namespace shell | 159 } // namespace shell |
| OLD | NEW |