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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 }; | 129 }; |
130 | 130 |
131 base::CommandLine child_command_line(launch_data->child_path); | 131 base::CommandLine child_command_line(launch_data->child_path); |
132 child_command_line.CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), | 132 child_command_line.CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), |
133 kForwardSwitches, | 133 kForwardSwitches, |
134 arraysize(kForwardSwitches)); | 134 arraysize(kForwardSwitches)); |
135 child_command_line.AppendSwitchASCII(switches::kChildConnectionId, | 135 child_command_line.AppendSwitchASCII(switches::kChildConnectionId, |
136 launch_data->child_connection_id); | 136 launch_data->child_connection_id); |
137 | 137 |
138 mojo::embedder::HandlePassingInformation handle_passing_info; | 138 mojo::embedder::HandlePassingInformation handle_passing_info; |
| 139 std::string platform_channel_info; |
139 launch_data->platform_channel_pair.PrepareToPassClientHandleToChildProcess( | 140 launch_data->platform_channel_pair.PrepareToPassClientHandleToChildProcess( |
140 &child_command_line, &handle_passing_info); | 141 &platform_channel_info, &handle_passing_info); |
| 142 child_command_line.AppendSwitchASCII(switches::kPlatformChannelHandleInfo, |
| 143 platform_channel_info); |
141 | 144 |
142 base::LaunchOptions options; | 145 base::LaunchOptions options; |
143 options.fds_to_remap = &handle_passing_info; | 146 options.fds_to_remap = &handle_passing_info; |
144 #if defined(OS_LINUX) | 147 #if defined(OS_LINUX) |
145 options.allow_new_privs = launch_data->options.allow_new_privs; | 148 options.allow_new_privs = launch_data->options.allow_new_privs; |
146 #endif | 149 #endif |
147 DVLOG(2) << "Launching child with command line: " | 150 DVLOG(2) << "Launching child with command line: " |
148 << child_command_line.GetCommandLineString(); | 151 << child_command_line.GetCommandLineString(); |
149 base::Process child_process = | 152 base::Process child_process = |
150 base::LaunchProcess(child_command_line, options); | 153 base::LaunchProcess(child_command_line, options); |
151 if (child_process.IsValid()) | 154 if (child_process.IsValid()) |
152 launch_data->platform_channel_pair.ChildProcessLaunched(); | 155 launch_data->platform_channel_pair.ChildProcessLaunched(); |
153 return child_process.Pass(); | 156 return child_process.Pass(); |
154 } | 157 } |
155 | 158 |
156 void ChildProcessHost::AppCompleted(int32_t result) { | 159 void ChildProcessHost::AppCompleted(int32_t result) { |
157 if (!on_app_complete_.is_null()) { | 160 if (!on_app_complete_.is_null()) { |
158 auto on_app_complete = on_app_complete_; | 161 auto on_app_complete = on_app_complete_; |
159 on_app_complete_.reset(); | 162 on_app_complete_.reset(); |
160 on_app_complete.Run(result); | 163 on_app_complete.Run(result); |
161 } | 164 } |
162 } | 165 } |
163 | 166 |
164 void ChildProcessHost::OnConnectionError() { | 167 void ChildProcessHost::OnConnectionError() { |
165 AppCompleted(MOJO_RESULT_UNKNOWN); | 168 AppCompleted(MOJO_RESULT_UNKNOWN); |
166 } | 169 } |
167 | 170 |
168 } // namespace shell | 171 } // namespace shell |
OLD | NEW |