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/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 10 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
11 #include "content/common/gpu/gpu_memory_manager.h" | 11 #include "content/common/gpu/gpu_memory_manager.h" |
12 #include "content/common/gpu/gpu_messages.h" | 12 #include "content/common/gpu/gpu_messages.h" |
13 #include "content/common/gpu/sync_point_manager.h" | 13 #include "content/common/gpu/sync_point_manager.h" |
| 14 #include "content/common/input/web_input_event_traits.h" |
14 #include "content/common/message_router.h" | 15 #include "content/common/message_router.h" |
15 #include "gpu/command_buffer/service/feature_info.h" | 16 #include "gpu/command_buffer/service/feature_info.h" |
16 #include "gpu/command_buffer/service/gpu_switches.h" | 17 #include "gpu/command_buffer/service/gpu_switches.h" |
17 #include "gpu/command_buffer/service/mailbox_manager.h" | 18 #include "gpu/command_buffer/service/mailbox_manager.h" |
18 #include "gpu/command_buffer/service/memory_program_cache.h" | 19 #include "gpu/command_buffer/service/memory_program_cache.h" |
19 #include "gpu/command_buffer/service/shader_translator_cache.h" | 20 #include "gpu/command_buffer/service/shader_translator_cache.h" |
20 #include "ipc/message_filter.h" | 21 #include "ipc/message_filter.h" |
21 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
22 #include "ui/gl/gl_share_group.h" | 23 #include "ui/gl/gl_share_group.h" |
23 | 24 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 154 |
154 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { | 155 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { |
155 bool handled = true; | 156 bool handled = true; |
156 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) | 157 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) |
157 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 158 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
158 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 159 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
159 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, | 160 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
160 OnCreateViewCommandBuffer) | 161 OnCreateViewCommandBuffer) |
161 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 162 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
162 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 163 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
| 164 IPC_MESSAGE_HANDLER(GpuMsg_HandleInputEvent, OnHandleInputEvent) |
163 IPC_MESSAGE_UNHANDLED(handled = false) | 165 IPC_MESSAGE_UNHANDLED(handled = false) |
164 IPC_END_MESSAGE_MAP() | 166 IPC_END_MESSAGE_MAP() |
165 return handled; | 167 return handled; |
166 } | 168 } |
167 | 169 |
168 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } | 170 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } |
169 | 171 |
170 void GpuChannelManager::OnEstablishChannel(int client_id, | 172 void GpuChannelManager::OnEstablishChannel(int client_id, |
171 bool share_context, | 173 bool share_context, |
172 bool allow_future_sync_points) { | 174 bool allow_future_sync_points) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 DestroyGpuMemoryBuffer(handle); | 258 DestroyGpuMemoryBuffer(handle); |
257 } else { | 259 } else { |
258 sync_point_manager()->AddSyncPointCallback( | 260 sync_point_manager()->AddSyncPointCallback( |
259 sync_point, | 261 sync_point, |
260 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, | 262 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, |
261 base::Unretained(this), | 263 base::Unretained(this), |
262 handle)); | 264 handle)); |
263 } | 265 } |
264 } | 266 } |
265 | 267 |
| 268 void GpuChannelManager::OnHandleInputEvent( |
| 269 const blink::WebInputEvent* input_event, |
| 270 bool is_keyboard_shortcut) { |
| 271 const char* const event_name = |
| 272 WebInputEventTraits::GetName(input_event->type); |
| 273 TRACE_EVENT1( |
| 274 "gpu", "GpuChannelManager::OnHandleInputEvent", "event", event_name); |
| 275 } |
| 276 |
266 void GpuChannelManager::OnLoadedShader(std::string program_proto) { | 277 void GpuChannelManager::OnLoadedShader(std::string program_proto) { |
267 if (program_cache()) | 278 if (program_cache()) |
268 program_cache()->LoadProgram(program_proto); | 279 program_cache()->LoadProgram(program_proto); |
269 } | 280 } |
270 | 281 |
271 bool GpuChannelManager::HandleMessagesScheduled() { | 282 bool GpuChannelManager::HandleMessagesScheduled() { |
272 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); | 283 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
273 iter != gpu_channels_.end(); ++iter) { | 284 iter != gpu_channels_.end(); ++iter) { |
274 if (iter->second->handle_messages_scheduled()) | 285 if (iter->second->handle_messages_scheduled()) |
275 return true; | 286 return true; |
(...skipping 28 matching lines...) Expand all Loading... |
304 | 315 |
305 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 316 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
306 if (!default_offscreen_surface_.get()) { | 317 if (!default_offscreen_surface_.get()) { |
307 default_offscreen_surface_ = | 318 default_offscreen_surface_ = |
308 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); | 319 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); |
309 } | 320 } |
310 return default_offscreen_surface_.get(); | 321 return default_offscreen_surface_.get(); |
311 } | 322 } |
312 | 323 |
313 } // namespace content | 324 } // namespace content |
OLD | NEW |