| 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   launch_data->child_path = context_->mojo_shell_child_path(); | 
| 50 | 50 #if defined(ARCH_CPU_64_BITS) | 
|  | 51   if (require_32_bit) | 
|  | 52     launch_data->child_path = | 
|  | 53         context_->mojo_shell_child_path().InsertBeforeExtensionASCII("_32"); | 
|  | 54 #endif | 
| 51   // TODO(vtl): Add something for |slave_info|. | 55   // TODO(vtl): Add something for |slave_info|. | 
| 52   // TODO(vtl): The "unretained this" is wrong (see also below). | 56   // TODO(vtl): The "unretained this" is wrong (see also below). | 
| 53   mojo::ScopedMessagePipeHandle handle(mojo::embedder::ConnectToSlave( | 57   mojo::ScopedMessagePipeHandle handle(mojo::embedder::ConnectToSlave( | 
| 54       nullptr, launch_data->platform_channel_pair.PassServerHandle(), | 58       nullptr, launch_data->platform_channel_pair.PassServerHandle(), | 
| 55       base::Bind(&ChildProcessHost::DidConnectToSlave, base::Unretained(this)), | 59       base::Bind(&ChildProcessHost::DidConnectToSlave, base::Unretained(this)), | 
| 56       base::MessageLoop::current()->message_loop_proxy(), | 60       base::MessageLoop::current()->message_loop_proxy(), | 
| 57       &launch_data->child_connection_id, &channel_info_)); | 61       &launch_data->child_connection_id, &channel_info_)); | 
| 58   // TODO(vtl): We should destroy the channel on destruction (using | 62   // TODO(vtl): We should destroy the channel on destruction (using | 
| 59   // |channel_info_|, but only after the callback has been called. | 63   // |channel_info_|, but only after the callback has been called. | 
| 60   CHECK(channel_info_); | 64   CHECK(channel_info_); | 
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 147     on_app_complete_.reset(); | 151     on_app_complete_.reset(); | 
| 148     on_app_complete.Run(result); | 152     on_app_complete.Run(result); | 
| 149   } | 153   } | 
| 150 } | 154 } | 
| 151 | 155 | 
| 152 void ChildProcessHost::OnConnectionError() { | 156 void ChildProcessHost::OnConnectionError() { | 
| 153   AppCompleted(MOJO_RESULT_UNKNOWN); | 157   AppCompleted(MOJO_RESULT_UNKNOWN); | 
| 154 } | 158 } | 
| 155 | 159 | 
| 156 }  // namespace shell | 160 }  // namespace shell | 
| OLD | NEW | 
|---|