OLD | NEW |
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 #if defined(TOOLKIT_GTK) |
| 22 #include "ui/gl/gl_surface_glx.h" |
| 23 #endif |
21 | 24 |
22 namespace content { | 25 namespace content { |
23 namespace { | 26 namespace { |
24 | 27 |
25 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > | 28 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > |
26 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; | 29 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; |
27 | 30 |
28 bool GpuProcessLogMessageHandler(int severity, | 31 bool GpuProcessLogMessageHandler(int severity, |
29 const char* file, int line, | 32 const char* file, int line, |
30 size_t message_start, | 33 size_t message_start, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 bool handled = true; | 101 bool handled = true; |
99 IPC_BEGIN_MESSAGE_MAP_EX(GpuChildThread, msg, msg_is_ok) | 102 IPC_BEGIN_MESSAGE_MAP_EX(GpuChildThread, msg, msg_is_ok) |
100 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) | 103 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) |
101 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) | 104 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) |
102 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats, | 105 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats, |
103 OnGetVideoMemoryUsageStats) | 106 OnGetVideoMemoryUsageStats) |
104 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) | 107 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) |
105 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) | 108 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) |
106 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) | 109 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) |
107 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog) | 110 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog) |
| 111 IPC_MESSAGE_HANDLER(GpuMsg_AcceleratedCompositingStateChange, |
| 112 OnAcceleratedCompositingStateChange) |
108 IPC_MESSAGE_UNHANDLED(handled = false) | 113 IPC_MESSAGE_UNHANDLED(handled = false) |
109 IPC_END_MESSAGE_MAP_EX() | 114 IPC_END_MESSAGE_MAP_EX() |
110 | 115 |
111 if (handled) | 116 if (handled) |
112 return true; | 117 return true; |
113 | 118 |
114 return gpu_channel_manager_.get() && | 119 return gpu_channel_manager_.get() && |
115 gpu_channel_manager_->OnMessageReceived(msg); | 120 gpu_channel_manager_->OnMessageReceived(msg); |
116 } | 121 } |
117 | 122 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (watchdog_thread_.get()) { | 234 if (watchdog_thread_.get()) { |
230 // Disarm the watchdog before shutting down the message loop. This prevents | 235 // Disarm the watchdog before shutting down the message loop. This prevents |
231 // the future posting of tasks to the message loop. | 236 // the future posting of tasks to the message loop. |
232 if (watchdog_thread_->message_loop()) | 237 if (watchdog_thread_->message_loop()) |
233 watchdog_thread_->PostAcknowledge(); | 238 watchdog_thread_->PostAcknowledge(); |
234 // Prevent rearming. | 239 // Prevent rearming. |
235 watchdog_thread_->Stop(); | 240 watchdog_thread_->Stop(); |
236 } | 241 } |
237 } | 242 } |
238 | 243 |
| 244 #if defined(TOOLKIT_GTK) |
| 245 void GpuChildThread::OnAcceleratedCompositingStateChange( |
| 246 int32 surface_id, bool surface_compositing_enabled) { |
| 247 gfx::NativeViewGLSurfaceGLX::AcceleratedCompositingStateChange( |
| 248 surface_id, surface_compositing_enabled); |
| 249 } |
| 250 #endif |
| 251 |
239 } // namespace content | 252 } // namespace content |
240 | 253 |
OLD | NEW |