| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); | 176 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
| 177 if (iter != gpu_channels_.end()) { | 177 if (iter != gpu_channels_.end()) { |
| 178 succeeded = iter->second->CreateViewCommandBuffer( | 178 succeeded = iter->second->CreateViewCommandBuffer( |
| 179 window, surface_id, init_params, route_id); | 179 window, surface_id, init_params, route_id); |
| 180 } | 180 } |
| 181 | 181 |
| 182 Send(new GpuHostMsg_CommandBufferCreated(succeeded)); | 182 Send(new GpuHostMsg_CommandBufferCreated(succeeded)); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void GpuChannelManager::CreateImage( | 185 void GpuChannelManager::CreateImage( |
| 186 gfx::PluginWindowHandle window, int32 client_id, int32 image_id) { | 186 const gfx::GpuMemoryBufferHandle& handle, |
| 187 gfx::Size size; | 187 const gfx::Size& size, |
| 188 | 188 unsigned internalformat, |
| 189 int32 client_id, |
| 190 int32 image_id) { |
| 189 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); | 191 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
| 190 if (iter != gpu_channels_.end()) { | 192 Send(new GpuHostMsg_ImageCreated( |
| 191 iter->second->CreateImage(window, image_id, &size); | 193 iter != gpu_channels_.end() |
| 192 } | 194 ? iter->second->CreateImage(handle, size, internalformat, image_id) |
| 193 | 195 : false)); |
| 194 Send(new GpuHostMsg_ImageCreated(size)); | |
| 195 } | 196 } |
| 196 | 197 |
| 197 void GpuChannelManager::OnCreateImage( | 198 void GpuChannelManager::OnCreateImage( |
| 198 gfx::PluginWindowHandle window, int32 client_id, int32 image_id) { | 199 const gfx::GpuMemoryBufferHandle& handle, |
| 200 const gfx::Size& size, |
| 201 unsigned internalformat, |
| 202 int32 client_id, |
| 203 int32 image_id) { |
| 199 DCHECK(image_id); | 204 DCHECK(image_id); |
| 200 | 205 |
| 201 if (image_operations_.empty()) { | 206 if (image_operations_.empty()) { |
| 202 CreateImage(window, client_id, image_id); | 207 CreateImage(handle, size, internalformat, client_id, image_id); |
| 203 } else { | 208 } else { |
| 204 image_operations_.push_back( | 209 image_operations_.push_back( |
| 205 new ImageOperation(0, base::Bind(&GpuChannelManager::CreateImage, | 210 new ImageOperation(0, base::Bind(&GpuChannelManager::CreateImage, |
| 206 base::Unretained(this), | 211 base::Unretained(this), |
| 207 window, | 212 handle, |
| 213 size, |
| 214 internalformat, |
| 208 client_id, | 215 client_id, |
| 209 image_id))); | 216 image_id))); |
| 210 } | 217 } |
| 211 } | 218 } |
| 212 | 219 |
| 213 void GpuChannelManager::DeleteImage(int32 client_id, int32 image_id) { | 220 void GpuChannelManager::DeleteImage(int32 client_id, int32 image_id) { |
| 214 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); | 221 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
| 215 if (iter != gpu_channels_.end()) { | 222 if (iter != gpu_channels_.end()) { |
| 216 iter->second->DeleteImage(image_id); | 223 iter->second->DeleteImage(image_id); |
| 217 } | 224 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 318 |
| 312 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 319 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
| 313 if (!default_offscreen_surface_.get()) { | 320 if (!default_offscreen_surface_.get()) { |
| 314 default_offscreen_surface_ = | 321 default_offscreen_surface_ = |
| 315 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); | 322 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); |
| 316 } | 323 } |
| 317 return default_offscreen_surface_.get(); | 324 return default_offscreen_surface_.get(); |
| 318 } | 325 } |
| 319 | 326 |
| 320 } // namespace content | 327 } // namespace content |
| OLD | NEW |