Commit 90d07f04 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Fix in-GPU-process media service in WebView

WebView environments are configured to run the media service in the GPU
process even though GPU runs in browser process. This means we have a
valid GpuProcessHost with null process_id(). Recent refactoring of
Service Manager code in content misinterpreted this to mean the
GpuProcessHost was invalid and that services couldn't be launched by
it.

This fixes that assumption and always attempts to launch an
in-GPU-process service if the GpuProcessHost is non-null. Also in such
cases where the reported PID is null, this correctly uses the browser's
own PID as the PID for the PID of the launched service instance.

This mirrors the behavior of in-GPU-process services prior to the
refactoring in r663141.

Bug: 967288
Change-Id: Idc9223815f45a2e65766077fa4e695af3e6ceff5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637980Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#665057}
parent c28da155
...@@ -177,7 +177,7 @@ class ContentChildServiceProcessHost ...@@ -177,7 +177,7 @@ class ContentChildServiceProcessHost
// should be packaged into the content_gpu manifest. Then this would be // should be packaged into the content_gpu manifest. Then this would be
// unnecessary. // unnecessary.
GpuProcessHost* process_host = GpuProcessHost::Get(); GpuProcessHost* process_host = GpuProcessHost::Get();
if (!process_host || process_host->process_id() == base::kNullProcessId) { if (!process_host) {
DLOG(ERROR) << "GPU process host not available."; DLOG(ERROR) << "GPU process host not available.";
return mojo::NullRemote(); return mojo::NullRemote();
} }
...@@ -187,7 +187,10 @@ class ContentChildServiceProcessHost ...@@ -187,7 +187,10 @@ class ContentChildServiceProcessHost
// sure we handle these cases correctly. // sure we handle these cases correctly.
process_host->gpu_host()->RunService(identity.name(), process_host->gpu_host()->RunService(identity.name(),
std::move(receiver)); std::move(receiver));
std::move(callback).Run(process_host->process_id()); base::ProcessId process_id = process_host->process_id();
std::move(callback).Run(process_id != base::kNullProcessId
? process_id
: base::GetCurrentProcId());
return remote; return remote;
} }
......
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