| Index: mojo/shell/runner/host/child_process_host.cc
|
| diff --git a/mojo/shell/runner/host/child_process_host.cc b/mojo/shell/runner/host/child_process_host.cc
|
| index b9a1c1fa7f6e90f09aef556933e5d5fbaa3330aa..d487576345b282e7ebd53d6b115756081fa54b39 100644
|
| --- a/mojo/shell/runner/host/child_process_host.cc
|
| +++ b/mojo/shell/runner/host/child_process_host.cc
|
| @@ -85,15 +85,18 @@ int ChildProcessHost::Join() {
|
| start_child_process_event_.Wait();
|
|
|
| controller_ = mojom::ChildControllerPtr();
|
| - DCHECK(child_process_.IsValid());
|
| -
|
| - int rv = -1;
|
| - LOG_IF(ERROR, !child_process_.WaitForExit(&rv))
|
| - << "Failed to wait for child process";
|
| + // This host may be hosting a child process whose lifetime is controlled
|
| + // elsewhere. In this case we have no known process handle to wait on.
|
| + if (child_process_.IsValid()) {
|
| + int rv = -1;
|
| + LOG_IF(ERROR, !child_process_.WaitForExit(&rv))
|
| + << "Failed to wait for child process";
|
|
|
| - child_process_.Close();
|
| + child_process_.Close();
|
| + return rv;
|
| + }
|
|
|
| - return rv;
|
| + return 0;
|
| }
|
|
|
| void ChildProcessHost::StartApp(
|
| @@ -101,6 +104,9 @@ void ChildProcessHost::StartApp(
|
| const mojom::ChildController::StartAppCallback& on_app_complete) {
|
| DCHECK(controller_);
|
|
|
| + // In this case the process must have already been launched.
|
| + start_child_process_event_.Signal();
|
| +
|
| on_app_complete_ = on_app_complete;
|
| controller_->StartApp(
|
| std::move(request),
|
|
|