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

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: Fix a compile error 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
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 304c589e7c69caf194802ab4eaaeb0913aafa6e7..7910d8c6b50d5204fb348ba7524b2d26a20d4001 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());
@@ -878,11 +890,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();
@@ -896,7 +908,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_)
@@ -904,7 +916,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)
@@ -923,7 +935,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();
@@ -931,7 +943,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
@@ -943,7 +955,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();
@@ -982,7 +994,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) {
@@ -1505,8 +1517,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());
@@ -1673,7 +1685,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;
}
@@ -1779,32 +1791,38 @@ 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());
+#if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA)
+ } else {
piman 2016/07/07 21:02:20 nit: same here re: #ifdefs vs {}
Peng 2016/07/07 21:33:37 Done.
+ gpu_channel_ = ui::GpuService::GetInstance()->EstablishGpuChannelSync();
+#endif
+ }
return gpu_channel_;
}
@@ -1820,10 +1838,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();

Powered by Google App Engine
This is Rietveld 408576698