| Index: content/renderer/render_thread_impl.cc
|
| diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
|
| index 8c8005ec80fbc20357051c2f0bec2ce0cc2c8e3e..5064f6b1f994a5da97e0e7841de737c76a49023a 100644
|
| --- a/content/renderer/render_thread_impl.cc
|
| +++ b/content/renderer/render_thread_impl.cc
|
| @@ -46,6 +46,7 @@
|
| #include "cc/raster/task_graph_runner.h"
|
| #include "cc/trees/layer_tree_host_common.h"
|
| #include "cc/trees/layer_tree_settings.h"
|
| +#include "components/mus/common/gpu_service.h"
|
| #include "components/scheduler/child/compositor_worker_scheduler.h"
|
| #include "components/scheduler/child/webthread_base.h"
|
| #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h"
|
| @@ -441,6 +442,11 @@ scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext(
|
| attributes, nullptr, type));
|
| }
|
|
|
| +bool IsRunningInMojoShell() {
|
| + const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
|
| + return cmdline->HasSwitch(switches::kIsRunningInMojoShell);
|
| +}
|
| +
|
| } // namespace
|
|
|
| // For measuring memory usage after each task. Behind a command line flag.
|
| @@ -1603,7 +1609,11 @@ RenderThreadImpl::GetCompositorImplThreadTaskRunner() {
|
| }
|
|
|
| gpu::GpuMemoryBufferManager* RenderThreadImpl::GetGpuMemoryBufferManager() {
|
| - return gpu_memory_buffer_manager();
|
| + if (!IsRunningInMojoShell()) {
|
| + return gpu_memory_buffer_manager();
|
| + } else {
|
| + return mus::GpuService::GetInstance()->gpu_memory_buffer_manager();
|
| + }
|
| }
|
|
|
| scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() {
|
| @@ -1766,32 +1776,37 @@ scoped_refptr<gpu::GpuChannelHost> RenderThreadImpl::EstablishGpuChannelSync(
|
|
|
| // Recreate the channel if it has been lost.
|
| gpu_channel_->DestroyChannel();
|
| - gpu_channel_ = NULL;
|
| + gpu_channel_ = nullptr;
|
| }
|
|
|
| - // Ask the browser for the channel name.
|
| - int client_id = 0;
|
| - IPC::ChannelHandle channel_handle;
|
| - gpu::GPUInfo gpu_info;
|
| - if (!Send(new ChildProcessHostMsg_EstablishGpuChannel(
|
| - cause_for_gpu_launch, &client_id, &channel_handle, &gpu_info)) ||
|
| + if (!IsRunningInMojoShell()) {
|
| + int client_id = 0;
|
| + IPC::ChannelHandle channel_handle;
|
| + gpu::GPUInfo gpu_info;
|
| + // Ask the browser for the channel name.
|
| + if (!Send(new ChildProcessHostMsg_EstablishGpuChannel(
|
| + cause_for_gpu_launch, &client_id, &channel_handle, &gpu_info)) ||
|
| #if defined(OS_POSIX)
|
| - channel_handle.socket.fd == -1 ||
|
| + channel_handle.socket.fd == -1 ||
|
| #endif
|
| - channel_handle.name.empty()) {
|
| - // Otherwise cancel the connection.
|
| - return NULL;
|
| - }
|
| -
|
| - GetContentClient()->SetGpuInfo(gpu_info);
|
| + channel_handle.name.empty()) {
|
| + // Otherwise cancel the connection.
|
| + return NULL;
|
| + }
|
| + GetContentClient()->SetGpuInfo(gpu_info);
|
|
|
| - // Cache some variables that are needed on the compositor thread for our
|
| - // implementation of GpuChannelHostFactory.
|
| - io_thread_task_runner_ = ChildProcess::current()->io_task_runner();
|
| + // Cache some variables that are needed on the compositor thread for our
|
| + // implementation of GpuChannelHostFactory.
|
| + io_thread_task_runner_ = ChildProcess::current()->io_task_runner();
|
|
|
| - gpu_channel_ = gpu::GpuChannelHost::Create(
|
| - this, client_id, gpu_info, channel_handle,
|
| - ChildProcess::current()->GetShutDownEvent(), gpu_memory_buffer_manager());
|
| + gpu_channel_ =
|
| + gpu::GpuChannelHost::Create(this, client_id, gpu_info, channel_handle,
|
| + ChildProcess::current()->GetShutDownEvent(),
|
| + gpu_memory_buffer_manager());
|
| + } else {
|
| + gpu_channel_ = mus::GpuService::GetInstance()->EstablishGpuChannelSync(
|
| + MojoShellConnection::GetForProcess()->GetConnector());
|
| + }
|
| return gpu_channel_;
|
| }
|
|
|
|
|