| 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 <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "content/common/child_thread.h" | 11 #include "content/common/child_thread.h" |
| 10 #include "content/common/gpu/gpu_channel.h" | 12 #include "content/common/gpu/gpu_channel.h" |
| 11 #include "content/common/gpu/gpu_memory_manager.h" | 13 #include "content/common/gpu/gpu_memory_manager.h" |
| 12 #include "content/common/gpu/gpu_messages.h" | 14 #include "content/common/gpu/gpu_messages.h" |
| 13 #include "content/common/gpu/sync_point_manager.h" | 15 #include "content/common/gpu/sync_point_manager.h" |
| 14 #include "gpu/command_buffer/service/feature_info.h" | 16 #include "gpu/command_buffer/service/feature_info.h" |
| 15 #include "gpu/command_buffer/service/gpu_switches.h" | 17 #include "gpu/command_buffer/service/gpu_switches.h" |
| 16 #include "gpu/command_buffer/service/mailbox_manager.h" | 18 #include "gpu/command_buffer/service/mailbox_manager.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 bool msg_is_ok = true; | 100 bool msg_is_ok = true; |
| 99 bool handled = true; | 101 bool handled = true; |
| 100 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) | 102 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) |
| 101 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 103 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
| 102 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 104 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
| 103 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, | 105 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
| 104 OnCreateViewCommandBuffer) | 106 OnCreateViewCommandBuffer) |
| 105 IPC_MESSAGE_HANDLER(GpuMsg_CreateImage, OnCreateImage) | 107 IPC_MESSAGE_HANDLER(GpuMsg_CreateImage, OnCreateImage) |
| 106 IPC_MESSAGE_HANDLER(GpuMsg_DeleteImage, OnDeleteImage) | 108 IPC_MESSAGE_HANDLER(GpuMsg_DeleteImage, OnDeleteImage) |
| 107 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 109 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
| 110 IPC_MESSAGE_HANDLER(GpuMsg_DestroySurface, OnDestroySurface) |
| 108 IPC_MESSAGE_UNHANDLED(handled = false) | 111 IPC_MESSAGE_UNHANDLED(handled = false) |
| 109 IPC_END_MESSAGE_MAP_EX() | 112 IPC_END_MESSAGE_MAP_EX() |
| 110 return handled; | 113 return handled; |
| 111 } | 114 } |
| 112 | 115 |
| 113 bool GpuChannelManager::Send(IPC::Message* msg) { | 116 bool GpuChannelManager::Send(IPC::Message* msg) { |
| 114 return gpu_child_thread_->Send(msg); | 117 return gpu_child_thread_->Send(msg); |
| 115 } | 118 } |
| 116 | 119 |
| 117 void GpuChannelManager::OnEstablishChannel(int client_id, bool share_context) { | 120 void GpuChannelManager::OnEstablishChannel(int client_id, bool share_context) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 delete image_operations_.front(); | 255 delete image_operations_.front(); |
| 253 image_operations_.pop_front(); | 256 image_operations_.pop_front(); |
| 254 } | 257 } |
| 255 } | 258 } |
| 256 | 259 |
| 257 void GpuChannelManager::OnLoadedShader(std::string program_proto) { | 260 void GpuChannelManager::OnLoadedShader(std::string program_proto) { |
| 258 if (program_cache()) | 261 if (program_cache()) |
| 259 program_cache()->LoadProgram(program_proto); | 262 program_cache()->LoadProgram(program_proto); |
| 260 } | 263 } |
| 261 | 264 |
| 265 void GpuChannelManager::OnDestroySurface(int client_id, |
| 266 int route_id, |
| 267 int surface_id) { |
| 268 if (mailbox_manager_) { |
| 269 GpuChannel* channel = LookupChannel(client_id); |
| 270 if (channel) |
| 271 channel->OnDestroySurface(route_id, surface_id); |
| 272 } |
| 273 } |
| 274 |
| 262 bool GpuChannelManager::HandleMessagesScheduled() { | 275 bool GpuChannelManager::HandleMessagesScheduled() { |
| 263 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); | 276 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
| 264 iter != gpu_channels_.end(); ++iter) { | 277 iter != gpu_channels_.end(); ++iter) { |
| 265 if (iter->second->handle_messages_scheduled()) | 278 if (iter->second->handle_messages_scheduled()) |
| 266 return true; | 279 return true; |
| 267 } | 280 } |
| 268 return false; | 281 return false; |
| 269 } | 282 } |
| 270 | 283 |
| 271 uint64 GpuChannelManager::MessagesProcessed() { | 284 uint64 GpuChannelManager::MessagesProcessed() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 291 | 304 |
| 292 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 305 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
| 293 if (!default_offscreen_surface_.get()) { | 306 if (!default_offscreen_surface_.get()) { |
| 294 default_offscreen_surface_ = gfx::GLSurface::CreateOffscreenGLSurface( | 307 default_offscreen_surface_ = gfx::GLSurface::CreateOffscreenGLSurface( |
| 295 false, gfx::Size(1, 1)); | 308 false, gfx::Size(1, 1)); |
| 296 } | 309 } |
| 297 return default_offscreen_surface_.get(); | 310 return default_offscreen_surface_.get(); |
| 298 } | 311 } |
| 299 | 312 |
| 300 } // namespace content | 313 } // namespace content |
| OLD | NEW |