| 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_manager.h" | 10 #include "content/common/gpu/gpu_memory_manager.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { | 104 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { |
| 105 bool handled = true; | 105 bool handled = true; |
| 106 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) | 106 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) |
| 107 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 107 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
| 108 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 108 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
| 109 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, | 109 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
| 110 OnCreateViewCommandBuffer) | 110 OnCreateViewCommandBuffer) |
| 111 IPC_MESSAGE_HANDLER(GpuMsg_CreateImage, OnCreateImage) | 111 IPC_MESSAGE_HANDLER(GpuMsg_CreateImage, OnCreateImage) |
| 112 IPC_MESSAGE_HANDLER(GpuMsg_DeleteImage, OnDeleteImage) | 112 IPC_MESSAGE_HANDLER(GpuMsg_DeleteImage, OnDeleteImage) |
| 113 IPC_MESSAGE_HANDLER(GpuMsg_CreateGpuMemoryBuffer, OnCreateGpuMemoryBuffer) |
| 114 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
| 113 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 115 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
| 114 IPC_MESSAGE_UNHANDLED(handled = false) | 116 IPC_MESSAGE_UNHANDLED(handled = false) |
| 115 IPC_END_MESSAGE_MAP() | 117 IPC_END_MESSAGE_MAP() |
| 116 return handled; | 118 return handled; |
| 117 } | 119 } |
| 118 | 120 |
| 119 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } | 121 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } |
| 120 | 122 |
| 121 void GpuChannelManager::OnEstablishChannel(int client_id, bool share_context) { | 123 void GpuChannelManager::OnEstablishChannel(int client_id, bool share_context) { |
| 122 IPC::ChannelHandle channel_handle; | 124 IPC::ChannelHandle channel_handle; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // Check if operation has a pending sync point. | 250 // Check if operation has a pending sync point. |
| 249 if (image_operations_.front()->sync_point) | 251 if (image_operations_.front()->sync_point) |
| 250 return; | 252 return; |
| 251 | 253 |
| 252 image_operations_.front()->callback.Run(); | 254 image_operations_.front()->callback.Run(); |
| 253 delete image_operations_.front(); | 255 delete image_operations_.front(); |
| 254 image_operations_.pop_front(); | 256 image_operations_.pop_front(); |
| 255 } | 257 } |
| 256 } | 258 } |
| 257 | 259 |
| 260 void GpuChannelManager::OnCreateGpuMemoryBuffer( |
| 261 const gfx::GpuMemoryBufferHandle& handle, |
| 262 const gfx::Size& size, |
| 263 unsigned internalformat, |
| 264 unsigned usage) { |
| 265 Send(new GpuHostMsg_GpuMemoryBufferCreated(gfx::GpuMemoryBufferHandle())); |
| 266 } |
| 267 |
| 268 void GpuChannelManager::OnDestroyGpuMemoryBuffer( |
| 269 const gfx::GpuMemoryBufferHandle& handle, |
| 270 int32 sync_point) { |
| 271 } |
| 272 |
| 258 void GpuChannelManager::OnLoadedShader(std::string program_proto) { | 273 void GpuChannelManager::OnLoadedShader(std::string program_proto) { |
| 259 if (program_cache()) | 274 if (program_cache()) |
| 260 program_cache()->LoadProgram(program_proto); | 275 program_cache()->LoadProgram(program_proto); |
| 261 } | 276 } |
| 262 | 277 |
| 263 bool GpuChannelManager::HandleMessagesScheduled() { | 278 bool GpuChannelManager::HandleMessagesScheduled() { |
| 264 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); | 279 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
| 265 iter != gpu_channels_.end(); ++iter) { | 280 iter != gpu_channels_.end(); ++iter) { |
| 266 if (iter->second->handle_messages_scheduled()) | 281 if (iter->second->handle_messages_scheduled()) |
| 267 return true; | 282 return true; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 296 | 311 |
| 297 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 312 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
| 298 if (!default_offscreen_surface_.get()) { | 313 if (!default_offscreen_surface_.get()) { |
| 299 default_offscreen_surface_ = | 314 default_offscreen_surface_ = |
| 300 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); | 315 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); |
| 301 } | 316 } |
| 302 return default_offscreen_surface_.get(); | 317 return default_offscreen_surface_.get(); |
| 303 } | 318 } |
| 304 | 319 |
| 305 } // namespace content | 320 } // namespace content |
| OLD | NEW |