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 #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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 if (!stub_.get()) | 202 if (!stub_.get()) |
203 return NULL; | 203 return NULL; |
204 return stub_->decoder(); | 204 return stub_->decoder(); |
205 } | 205 } |
206 | 206 |
207 void ImageTransportHelper::OnSetFrontSurfaceIsProtected( | 207 void ImageTransportHelper::OnSetFrontSurfaceIsProtected( |
208 bool is_protected, uint32 protection_state_id) { | 208 bool is_protected, uint32 protection_state_id) { |
209 surface_->OnSetFrontSurfaceIsProtected(is_protected, protection_state_id); | 209 surface_->OnSetFrontSurfaceIsProtected(is_protected, protection_state_id); |
210 } | 210 } |
211 | 211 |
212 void ImageTransportHelper::OnBufferPresented(uint32 sync_point) { | 212 void ImageTransportHelper::OnBufferPresented(bool presented, |
213 surface_->OnBufferPresented(sync_point); | 213 uint32 sync_point) { |
| 214 surface_->OnBufferPresented(presented, sync_point); |
214 } | 215 } |
215 | 216 |
216 void ImageTransportHelper::OnResizeViewACK() { | 217 void ImageTransportHelper::OnResizeViewACK() { |
217 surface_->OnResizeViewACK(); | 218 surface_->OnResizeViewACK(); |
218 } | 219 } |
219 | 220 |
220 void ImageTransportHelper::Resize(gfx::Size size) { | 221 void ImageTransportHelper::Resize(gfx::Size size) { |
221 // On windows, the surface is recreated and, in case the newly allocated | 222 // On windows, the surface is recreated and, in case the newly allocated |
222 // surface happens to have the same address, it should be invalidated on the | 223 // surface happens to have the same address, it should be invalidated on the |
223 // decoder so that future calls to MakeCurrent do not early out on the | 224 // decoder so that future calls to MakeCurrent do not early out on the |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 302 } |
302 | 303 |
303 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { | 304 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { |
304 if (!did_set_swap_interval_) { | 305 if (!did_set_swap_interval_) { |
305 ImageTransportHelper::SetSwapInterval(context); | 306 ImageTransportHelper::SetSwapInterval(context); |
306 did_set_swap_interval_ = true; | 307 did_set_swap_interval_ = true; |
307 } | 308 } |
308 return true; | 309 return true; |
309 } | 310 } |
310 | 311 |
311 void PassThroughImageTransportSurface::OnBufferPresented(uint32 sync_point) { | 312 void PassThroughImageTransportSurface::OnBufferPresented( |
| 313 bool /* presented */, |
| 314 uint32 /* sync_point */) { |
312 DCHECK(transport_); | 315 DCHECK(transport_); |
313 helper_->SetScheduled(true); | 316 helper_->SetScheduled(true); |
314 } | 317 } |
315 | 318 |
316 void PassThroughImageTransportSurface::OnResizeViewACK() { | 319 void PassThroughImageTransportSurface::OnResizeViewACK() { |
317 DCHECK(transport_); | 320 DCHECK(transport_); |
318 Resize(new_size_); | 321 Resize(new_size_); |
319 | 322 |
320 helper_->SetScheduled(true); | 323 helper_->SetScheduled(true); |
321 } | 324 } |
322 | 325 |
323 void PassThroughImageTransportSurface::OnResize(gfx::Size size) { | 326 void PassThroughImageTransportSurface::OnResize(gfx::Size size) { |
324 new_size_ = size; | 327 new_size_ = size; |
325 | 328 |
326 if (transport_) { | 329 if (transport_) { |
327 helper_->SendResizeView(size); | 330 helper_->SendResizeView(size); |
328 helper_->SetScheduled(false); | 331 helper_->SetScheduled(false); |
329 } else { | 332 } else { |
330 Resize(new_size_); | 333 Resize(new_size_); |
331 } | 334 } |
332 } | 335 } |
333 | 336 |
334 gfx::Size PassThroughImageTransportSurface::GetSize() { | 337 gfx::Size PassThroughImageTransportSurface::GetSize() { |
335 return GLSurfaceAdapter::GetSize(); | 338 return GLSurfaceAdapter::GetSize(); |
336 } | 339 } |
337 | 340 |
338 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} | 341 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} |
339 | 342 |
340 #endif // defined(ENABLE_GPU) | 343 #endif // defined(ENABLE_GPU) |
OLD | NEW |