| 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/message_router.h" | 13 #include "content/common/message_router.h" |
| 14 #include "gpu/command_buffer/common/value_state.h" |
| 14 #include "gpu/command_buffer/service/feature_info.h" | 15 #include "gpu/command_buffer/service/feature_info.h" |
| 15 #include "gpu/command_buffer/service/gpu_switches.h" | 16 #include "gpu/command_buffer/service/gpu_switches.h" |
| 16 #include "gpu/command_buffer/service/mailbox_manager_impl.h" | 17 #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
| 17 #include "gpu/command_buffer/service/memory_program_cache.h" | 18 #include "gpu/command_buffer/service/memory_program_cache.h" |
| 18 #include "gpu/command_buffer/service/shader_translator_cache.h" | 19 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 19 #include "gpu/command_buffer/service/sync_point_manager.h" | 20 #include "gpu/command_buffer/service/sync_point_manager.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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 156 |
| 156 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { | 157 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { |
| 157 bool handled = true; | 158 bool handled = true; |
| 158 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) | 159 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) |
| 159 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 160 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
| 160 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 161 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
| 161 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, | 162 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
| 162 OnCreateViewCommandBuffer) | 163 OnCreateViewCommandBuffer) |
| 163 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 164 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
| 164 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 165 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
| 166 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) |
| 165 IPC_MESSAGE_UNHANDLED(handled = false) | 167 IPC_MESSAGE_UNHANDLED(handled = false) |
| 166 IPC_END_MESSAGE_MAP() | 168 IPC_END_MESSAGE_MAP() |
| 167 return handled; | 169 return handled; |
| 168 } | 170 } |
| 169 | 171 |
| 170 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } | 172 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } |
| 171 | 173 |
| 172 void GpuChannelManager::OnEstablishChannel(int client_id, | 174 void GpuChannelManager::OnEstablishChannel(int client_id, |
| 173 bool share_context, | 175 bool share_context, |
| 174 bool allow_future_sync_points) { | 176 bool allow_future_sync_points) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 sync_point_manager()->AddSyncPointCallback( | 271 sync_point_manager()->AddSyncPointCallback( |
| 270 sync_point, | 272 sync_point, |
| 271 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, | 273 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, |
| 272 base::Unretained(this), | 274 base::Unretained(this), |
| 273 type, | 275 type, |
| 274 id, | 276 id, |
| 275 client_id)); | 277 client_id)); |
| 276 } | 278 } |
| 277 } | 279 } |
| 278 | 280 |
| 281 void GpuChannelManager::OnUpdateValueState( |
| 282 int client_id, unsigned int target, const gpu::ValueState& state) { |
| 283 // Only pass updated state to the channel corresponding to the |
| 284 // render_widget_host where the event originated. |
| 285 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
| 286 if (iter != gpu_channels_.end()) { |
| 287 iter->second->HandleUpdateValueState(target, state); |
| 288 } |
| 289 } |
| 290 |
| 279 void GpuChannelManager::OnLoadedShader(std::string program_proto) { | 291 void GpuChannelManager::OnLoadedShader(std::string program_proto) { |
| 280 if (program_cache()) | 292 if (program_cache()) |
| 281 program_cache()->LoadProgram(program_proto); | 293 program_cache()->LoadProgram(program_proto); |
| 282 } | 294 } |
| 283 | 295 |
| 284 bool GpuChannelManager::HandleMessagesScheduled() { | 296 bool GpuChannelManager::HandleMessagesScheduled() { |
| 285 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); | 297 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
| 286 iter != gpu_channels_.end(); ++iter) { | 298 iter != gpu_channels_.end(); ++iter) { |
| 287 if (iter->second->handle_messages_scheduled()) | 299 if (iter->second->handle_messages_scheduled()) |
| 288 return true; | 300 return true; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 317 | 329 |
| 318 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 330 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
| 319 if (!default_offscreen_surface_.get()) { | 331 if (!default_offscreen_surface_.get()) { |
| 320 default_offscreen_surface_ = | 332 default_offscreen_surface_ = |
| 321 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); | 333 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); |
| 322 } | 334 } |
| 323 return default_offscreen_surface_.get(); | 335 return default_offscreen_surface_.get(); |
| 324 } | 336 } |
| 325 | 337 |
| 326 } // namespace content | 338 } // namespace content |
| OLD | NEW |