OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "content/common/gpu/image_transport_surface.h" | 7 #include "content/common/gpu/image_transport_surface.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 void PassThroughImageTransportSurface::Destroy() { | 239 void PassThroughImageTransportSurface::Destroy() { |
240 helper_->Destroy(); | 240 helper_->Destroy(); |
241 GLSurfaceAdapter::Destroy(); | 241 GLSurfaceAdapter::Destroy(); |
242 } | 242 } |
243 | 243 |
244 void PassThroughImageTransportSurface::OnNewSurfaceACK( | 244 void PassThroughImageTransportSurface::OnNewSurfaceACK( |
245 uint64 surface_id, TransportDIB::Handle surface_handle) { | 245 uint64 surface_id, TransportDIB::Handle surface_handle) { |
246 } | 246 } |
247 | 247 |
| 248 bool PassThroughImageTransportSurface::SwapBuffers() { |
| 249 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); |
| 250 |
| 251 // Round trip to the browser UI thread, for throttling, by sending a dummy |
| 252 // SwapBuffers message. |
| 253 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
| 254 params.surface_id = 0; |
| 255 #if defined(OS_WIN) |
| 256 params.size = GetSize(); |
| 257 #endif |
| 258 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
| 259 |
| 260 helper_->SetScheduled(false); |
| 261 return result; |
| 262 } |
| 263 |
| 264 bool PassThroughImageTransportSurface::PostSubBuffer( |
| 265 int x, int y, int width, int height) { |
| 266 bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); |
| 267 |
| 268 // Round trip to the browser UI thread, for throttling, by sending a dummy |
| 269 // PostSubBuffer message. |
| 270 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; |
| 271 params.surface_id = 0; |
| 272 params.x = x; |
| 273 params.y = y; |
| 274 params.width = width; |
| 275 params.height = height; |
| 276 helper_->SendAcceleratedSurfacePostSubBuffer(params); |
| 277 |
| 278 helper_->SetScheduled(false); |
| 279 return result; |
| 280 } |
| 281 |
248 void PassThroughImageTransportSurface::OnBuffersSwappedACK() { | 282 void PassThroughImageTransportSurface::OnBuffersSwappedACK() { |
249 NOTREACHED(); | 283 helper_->SetScheduled(true); |
250 } | 284 } |
251 | 285 |
252 void PassThroughImageTransportSurface::OnPostSubBufferACK() { | 286 void PassThroughImageTransportSurface::OnPostSubBufferACK() { |
253 NOTREACHED(); | 287 helper_->SetScheduled(true); |
254 } | 288 } |
255 | 289 |
256 void PassThroughImageTransportSurface::OnResizeViewACK() { | 290 void PassThroughImageTransportSurface::OnResizeViewACK() { |
257 helper_->SetScheduled(true); | 291 helper_->SetScheduled(true); |
258 } | 292 } |
259 | 293 |
260 void PassThroughImageTransportSurface::OnResize(gfx::Size size) { | 294 void PassThroughImageTransportSurface::OnResize(gfx::Size size) { |
261 helper_->SendResizeView(size); | 295 helper_->SendResizeView(size); |
262 helper_->SetScheduled(false); | 296 helper_->SetScheduled(false); |
263 } | 297 } |
264 | 298 |
265 #endif // defined(ENABLE_GPU) | 299 #endif // defined(ENABLE_GPU) |
OLD | NEW |