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 <unistd.h> | 5 #include <unistd.h> |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 shell::InitializeLogging(); | 288 shell::InitializeLogging(); |
289 | 289 |
290 // Make sure that we're really meant to be invoked as the child process. | 290 // Make sure that we're really meant to be invoked as the child process. |
291 | 291 |
292 CHECK(command_line.HasSwitch(switches::kChildConnectionId)); | 292 CHECK(command_line.HasSwitch(switches::kChildConnectionId)); |
293 std::string child_connection_id = | 293 std::string child_connection_id = |
294 command_line.GetSwitchValueASCII(switches::kChildConnectionId); | 294 command_line.GetSwitchValueASCII(switches::kChildConnectionId); |
295 CHECK(!child_connection_id.empty()); | 295 CHECK(!child_connection_id.empty()); |
296 | 296 |
| 297 std::string platform_channel_info = |
| 298 command_line.GetSwitchValueASCII(switches::kPlatformChannelHandleInfo); |
297 mojo::embedder::ScopedPlatformHandle platform_handle = | 299 mojo::embedder::ScopedPlatformHandle platform_handle = |
298 mojo::embedder::PlatformChannelPair::PassClientHandleFromParentProcess( | 300 mojo::embedder::PlatformChannelPair::PassClientHandleFromParentProcess( |
299 command_line); | 301 platform_channel_info); |
300 CHECK(platform_handle.is_valid()); | 302 CHECK(platform_handle.is_valid()); |
301 | 303 |
302 shell::AppContext app_context; | 304 shell::AppContext app_context; |
303 app_context.Init(platform_handle.Pass()); | 305 app_context.Init(platform_handle.Pass()); |
304 | 306 |
305 shell::Blocker blocker; | 307 shell::Blocker blocker; |
306 app_context.controller_runner()->PostTask( | 308 app_context.controller_runner()->PostTask( |
307 FROM_HERE, base::Bind(&shell::ChildControllerImpl::Init, | 309 FROM_HERE, base::Bind(&shell::ChildControllerImpl::Init, |
308 base::Unretained(&app_context), child_connection_id, | 310 base::Unretained(&app_context), child_connection_id, |
309 blocker.GetUnblocker())); | 311 blocker.GetUnblocker())); |
310 // This will block, then run whatever the controller wants. | 312 // This will block, then run whatever the controller wants. |
311 blocker.Block(); | 313 blocker.Block(); |
312 | 314 |
313 app_context.Shutdown(); | 315 app_context.Shutdown(); |
314 | 316 |
315 return 0; | 317 return 0; |
316 } | 318 } |
OLD | NEW |