Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2100)

Unified Diff: mojo/shell/runner/host/child_process_host.cc

Issue 1755843002: Clean up MojoShellConnection in render processes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/renderer_main.cc ('k') | mojo/shell/runner/host/out_of_process_native_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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),
« no previous file with comments | « content/renderer/renderer_main.cc ('k') | mojo/shell/runner/host/out_of_process_native_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698