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

Side by Side Diff: content/gpu/gpu_child_thread.cc

Issue 341253002: Revert of Revert of ozone: gpu: Add plumbing for platform-specific gpu messaging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_common.gypi ('k') | ui/ozone/ozone.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/gpu/gpu_child_thread.h" 5 #include "content/gpu/gpu_child_thread.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/threading/worker_pool.h" 9 #include "base/threading/worker_pool.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "content/child/child_process.h" 11 #include "content/child/child_process.h"
12 #include "content/child/thread_safe_sender.h" 12 #include "content/child/thread_safe_sender.h"
13 #include "content/common/gpu/gpu_messages.h" 13 #include "content/common/gpu/gpu_messages.h"
14 #include "content/gpu/gpu_watchdog_thread.h" 14 #include "content/gpu/gpu_watchdog_thread.h"
15 #include "content/public/common/content_client.h" 15 #include "content/public/common/content_client.h"
16 #include "content/public/common/content_switches.h" 16 #include "content/public/common/content_switches.h"
17 #include "gpu/config/gpu_info_collector.h" 17 #include "gpu/config/gpu_info_collector.h"
18 #include "ipc/ipc_channel_handle.h" 18 #include "ipc/ipc_channel_handle.h"
19 #include "ipc/ipc_sync_message_filter.h" 19 #include "ipc/ipc_sync_message_filter.h"
20 #include "ui/gl/gl_implementation.h" 20 #include "ui/gl/gl_implementation.h"
21 21
22 #if defined(USE_OZONE)
23 #include "ui/ozone/ozone_platform.h"
24 #include "ui/ozone/public/gpu_platform_support.h"
25 #endif
26
22 namespace content { 27 namespace content {
23 namespace { 28 namespace {
24 29
25 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > 30 static base::LazyInstance<scoped_refptr<ThreadSafeSender> >
26 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; 31 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER;
27 32
28 bool GpuProcessLogMessageHandler(int severity, 33 bool GpuProcessLogMessageHandler(int severity,
29 const char* file, int line, 34 const char* file, int line,
30 size_t message_start, 35 size_t message_start,
31 const std::string& str) { 36 const std::string& str) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) 111 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean)
107 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) 112 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash)
108 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) 113 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang)
109 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog) 114 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog)
110 IPC_MESSAGE_UNHANDLED(handled = false) 115 IPC_MESSAGE_UNHANDLED(handled = false)
111 IPC_END_MESSAGE_MAP() 116 IPC_END_MESSAGE_MAP()
112 117
113 if (handled) 118 if (handled)
114 return true; 119 return true;
115 120
121 #if defined(USE_OZONE)
122 if (ui::OzonePlatform::GetInstance()
123 ->GetGpuPlatformSupport()
124 ->OnMessageReceived(msg))
125 return true;
126 #endif
127
116 return gpu_channel_manager_.get() && 128 return gpu_channel_manager_.get() &&
117 gpu_channel_manager_->OnMessageReceived(msg); 129 gpu_channel_manager_->OnMessageReceived(msg);
118 } 130 }
119 131
120 void GpuChildThread::OnInitialize() { 132 void GpuChildThread::OnInitialize() {
121 // Record initialization only after collecting the GPU info because that can 133 // Record initialization only after collecting the GPU info because that can
122 // take a significant amount of time. 134 // take a significant amount of time.
123 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; 135 gpu_info_.initialization_time = base::Time::Now() - process_start_time_;
124 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); 136 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_));
125 while (!deferred_messages_.empty()) { 137 while (!deferred_messages_.empty()) {
(...skipping 19 matching lines...) Expand all
145 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); 157 logging::SetLogMessageHandler(GpuProcessLogMessageHandler);
146 158
147 // Defer creation of the render thread. This is to prevent it from handling 159 // Defer creation of the render thread. This is to prevent it from handling
148 // IPC messages before the sandbox has been enabled and all other necessary 160 // IPC messages before the sandbox has been enabled and all other necessary
149 // initialization has succeeded. 161 // initialization has succeeded.
150 gpu_channel_manager_.reset( 162 gpu_channel_manager_.reset(
151 new GpuChannelManager(GetRouter(), 163 new GpuChannelManager(GetRouter(),
152 watchdog_thread_.get(), 164 watchdog_thread_.get(),
153 ChildProcess::current()->io_message_loop_proxy(), 165 ChildProcess::current()->io_message_loop_proxy(),
154 ChildProcess::current()->GetShutDownEvent())); 166 ChildProcess::current()->GetShutDownEvent()));
167
168 #if defined(USE_OZONE)
169 ui::OzonePlatform::GetInstance()
170 ->GetGpuPlatformSupport()
171 ->OnChannelEstablished(this);
172 #endif
155 } 173 }
156 174
157 void GpuChildThread::StopWatchdog() { 175 void GpuChildThread::StopWatchdog() {
158 if (watchdog_thread_.get()) { 176 if (watchdog_thread_.get()) {
159 watchdog_thread_->Stop(); 177 watchdog_thread_->Stop();
160 } 178 }
161 } 179 }
162 180
163 void GpuChildThread::OnCollectGraphicsInfo() { 181 void GpuChildThread::OnCollectGraphicsInfo() {
164 #if defined(OS_WIN) 182 #if defined(OS_WIN)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // the future posting of tasks to the message loop. 256 // the future posting of tasks to the message loop.
239 if (watchdog_thread_->message_loop()) 257 if (watchdog_thread_->message_loop())
240 watchdog_thread_->PostAcknowledge(); 258 watchdog_thread_->PostAcknowledge();
241 // Prevent rearming. 259 // Prevent rearming.
242 watchdog_thread_->Stop(); 260 watchdog_thread_->Stop();
243 } 261 }
244 } 262 }
245 263
246 } // namespace content 264 } // namespace content
247 265
OLDNEW
« no previous file with comments | « content/content_common.gypi ('k') | ui/ozone/ozone.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698