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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2056833002: WIP HW (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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/public/common/content_switches.cc ('k') | ui/views/mus/window_tree_host_mus.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
}
« no previous file with comments | « content/public/common/content_switches.cc ('k') | ui/views/mus/window_tree_host_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698