Commit 4c7bc527 authored by Wez's avatar Wez Committed by Commit Bot

[fuchsia] Mark fuchsia.web.Contexts' browser processes as critical.

When launching the browser process for a new fuchsia.web.Context, set it
to be the "critical" process for its job. This causes the kernel to
automatically terminate all child processes of the Context, in the event
of the browser process terminating unexpectedly.

Bug: 1109148, fuchsia:56992
Change-Id: Ia4b5d51362039f301609dc9b23a4ffbe48a5d151
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2316260
Commit-Queue: Wez <wez@chromium.org>
Auto-Submit: Wez <wez@chromium.org>
Reviewed-by: default avatarDavid Dorwin <ddorwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791331}
parent 4fd63f34
......@@ -517,10 +517,19 @@ void ContextProviderImpl::Create(
base::JoinString(cors_exempt_headers, ","));
}
if (launch_for_test_)
launch_for_test_.Run(launch_command, launch_options);
else
base::LaunchProcess(launch_command, launch_options);
base::Process context_process;
if (launch_for_test_) {
context_process = launch_for_test_.Run(launch_command, launch_options);
} else {
context_process = base::LaunchProcess(launch_command, launch_options);
}
if (context_process.IsValid()) {
// Set |context_process| termination to teardown its job and sub-processes.
zx_status_t result = zx_job_set_critical(launch_options.job_handle, 0,
context_process.Handle());
ZX_CHECK(ZX_OK == result, result) << "zx_job_set_critical";
}
// |context_request| and any DevTools channels were transferred (not copied)
// to the Context process.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment