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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2096843002: mus+ash: Enable Chrome HW rendering in mus+ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 5 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') | services/ui/common/gpu_service.cc » ('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 0845883e185e198d5d91837bd9fae4da9262772c..1dc6aa2480f694e1fc95b9b94823b894cd47084f 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -454,6 +454,11 @@ scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext(
automatic_flushes, support_locking, limits, attributes, nullptr, type));
}
+bool IsRunningInMash() {
+ const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+ return cmdline->HasSwitch(switches::kIsRunningInMash);
+}
+
} // namespace
// For measuring memory usage after each task. Behind a command line flag.
@@ -641,6 +646,13 @@ void RenderThreadImpl::Init(
// Register this object as the main thread.
ChildProcess::current()->set_main_thread(this);
+#if defined(MOJO_SHELL_CLIENT)
+ if (IsRunningInMash()) {
+ auto* shell_connection = ChildThread::Get()->GetMojoShellConnection();
+ ui::GpuService::Initialize(shell_connection->GetConnector());
+ }
+#endif
+
InitializeWebKit(resource_task_queue);
// In single process the single process is all there is.
@@ -667,7 +679,7 @@ void RenderThreadImpl::Init(
kMaxResourceRequestsPerFlushWhenThrottled));
resource_dispatcher()->set_message_sender(resource_dispatch_throttler_.get());
- media_stream_center_ = NULL;
+ media_stream_center_ = nullptr;
blob_message_filter_ = new BlobMessageFilter(GetFileThreadMessageLoopProxy());
AddFilter(blob_message_filter_.get());
@@ -877,11 +889,11 @@ void RenderThreadImpl::Shutdown() {
// Shutdown in reverse of the initialization order.
if (devtools_agent_message_filter_.get()) {
RemoveFilter(devtools_agent_message_filter_.get());
- devtools_agent_message_filter_ = NULL;
+ devtools_agent_message_filter_ = nullptr;
}
RemoveFilter(audio_input_message_filter_.get());
- audio_input_message_filter_ = NULL;
+ audio_input_message_filter_ = nullptr;
#if defined(ENABLE_WEBRTC)
RTCPeerConnectionHandler::DestructAllHandlers();
@@ -895,7 +907,7 @@ void RenderThreadImpl::Shutdown() {
vc_manager_.reset();
RemoveFilter(db_message_filter_.get());
- db_message_filter_ = NULL;
+ db_message_filter_ = nullptr;
// Shutdown the file thread if it's running.
if (file_thread_)
@@ -903,7 +915,7 @@ void RenderThreadImpl::Shutdown() {
if (compositor_message_filter_.get()) {
RemoveFilter(compositor_message_filter_.get());
- compositor_message_filter_ = NULL;
+ compositor_message_filter_ = nullptr;
}
#if defined(OS_ANDROID)
@@ -922,7 +934,7 @@ void RenderThreadImpl::Shutdown() {
// AudioMessageFilter may be accessed on |media_thread_|, so shutdown after.
RemoveFilter(audio_message_filter_.get());
- audio_message_filter_ = NULL;
+ audio_message_filter_ = nullptr;
categorized_worker_pool_->Shutdown();
@@ -930,7 +942,7 @@ void RenderThreadImpl::Shutdown() {
input_handler_manager_.reset();
if (input_event_filter_.get()) {
RemoveFilter(input_event_filter_.get());
- input_event_filter_ = NULL;
+ input_event_filter_ = nullptr;
}
// RemoveEmbeddedWorkerRoute may be called while deleting
@@ -942,7 +954,7 @@ void RenderThreadImpl::Shutdown() {
// hold pointers to V8 objects (e.g., via pending requests).
main_thread_indexed_db_dispatcher_.reset();
- main_thread_compositor_task_runner_ = NULL;
+ main_thread_compositor_task_runner_ = nullptr;
gpu_factories_.clear();
@@ -981,7 +993,7 @@ void RenderThreadImpl::Shutdown() {
// to the browser process.
main_message_loop_.reset();
- lazy_tls.Pointer()->Set(NULL);
+ lazy_tls.Pointer()->Set(nullptr);
}
bool RenderThreadImpl::Send(IPC::Message* msg) {
@@ -1504,8 +1516,8 @@ scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() {
scoped_refptr<ContextProviderCommandBuffer> shared_context_provider =
SharedMainThreadContextProvider();
if (!shared_context_provider) {
- stream_texture_factory_ = NULL;
- return NULL;
+ stream_texture_factory_ = nullptr;
+ return nullptr;
}
DCHECK(shared_context_provider->GetCommandBufferProxy());
DCHECK(shared_context_provider->GetCommandBufferProxy()->channel());
@@ -1672,7 +1684,7 @@ void RenderThreadImpl::OnChannelError() {
bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
base::ObserverListBase<RenderThreadObserver>::Iterator it(&observers_);
RenderThreadObserver* observer;
- while ((observer = it.GetNext()) != NULL) {
+ while ((observer = it.GetNext()) != nullptr) {
if (observer->OnControlMessageReceived(msg))
return true;
}
@@ -1778,32 +1790,40 @@ 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 (!IsRunningInMash()) {
+ 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 nullptr;
+ }
+ 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 {
+#if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA)
+ gpu_channel_ = ui::GpuService::GetInstance()->EstablishGpuChannelSync();
+#else
+ NOTREACHED();
+#endif
+ }
return gpu_channel_;
}
@@ -1819,10 +1839,9 @@ RenderThreadImpl::CreateCompositorOutputSurface(
use_software = true;
#if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA)
- auto shell_connection = MojoShellConnection::GetForProcess();
+ auto* shell_connection = MojoShellConnection::GetForProcess();
if (shell_connection && !use_software &&
command_line.HasSwitch(switches::kUseMusInRenderer)) {
- ui::GpuService::Initialize(shell_connection->GetConnector());
RenderWidgetMusConnection* connection =
RenderWidgetMusConnection::GetOrCreate(routing_id);
return connection->CreateOutputSurface();
« no previous file with comments | « content/public/common/content_switches.cc ('k') | services/ui/common/gpu_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698