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/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 54 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
55 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; | 55 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
56 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 56 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
57 | 57 |
58 protected: | 58 protected: |
59 // ImageTransportSurface implementation | 59 // ImageTransportSurface implementation |
60 virtual void OnBufferPresented( | 60 virtual void OnBufferPresented( |
61 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 61 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
62 virtual void OnResizeViewACK() OVERRIDE; | 62 virtual void OnResizeViewACK() OVERRIDE; |
63 virtual void OnResize(gfx::Size size) OVERRIDE; | 63 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 64 virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; |
64 | 65 |
65 private: | 66 private: |
66 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; | 67 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; |
67 | 68 |
68 void AdjustBufferAllocation(); | 69 void AdjustBufferAllocation(); |
69 void UnrefIOSurface(); | 70 void UnrefIOSurface(); |
70 void CreateIOSurface(); | 71 void CreateIOSurface(); |
71 | 72 |
72 // Tracks the current buffer allocation state. | 73 // Tracks the current buffer allocation state. |
73 bool backbuffer_suggested_allocation_; | 74 bool backbuffer_suggested_allocation_; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", | 289 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", |
289 "old_width", size_.width(), "new_width", size.width()); | 290 "old_width", size_.width(), "new_width", size.width()); |
290 // Caching |context_| from OnMakeCurrent. It should still be current. | 291 // Caching |context_| from OnMakeCurrent. It should still be current. |
291 DCHECK(context_->IsCurrent(this)); | 292 DCHECK(context_->IsCurrent(this)); |
292 | 293 |
293 size_ = size; | 294 size_ = size; |
294 | 295 |
295 CreateIOSurface(); | 296 CreateIOSurface(); |
296 } | 297 } |
297 | 298 |
| 299 void IOSurfaceImageTransportSurface::SetLatencyInfo( |
| 300 const cc::LatencyInfo&) { |
| 301 // TODO: implement |
| 302 } |
| 303 |
298 void IOSurfaceImageTransportSurface::UnrefIOSurface() { | 304 void IOSurfaceImageTransportSurface::UnrefIOSurface() { |
299 // If we have resources to destroy, then make sure that we have a current | 305 // If we have resources to destroy, then make sure that we have a current |
300 // context which we can use to delete the resources. | 306 // context which we can use to delete the resources. |
301 if (context_ || fbo_id_ || texture_id_) { | 307 if (context_ || fbo_id_ || texture_id_) { |
302 DCHECK(gfx::GLContext::GetCurrent() == context_); | 308 DCHECK(gfx::GLContext::GetCurrent() == context_); |
303 DCHECK(context_->IsCurrent(this)); | 309 DCHECK(context_->IsCurrent(this)); |
304 DCHECK(CGLGetCurrentContext()); | 310 DCHECK(CGLGetCurrentContext()); |
305 } | 311 } |
306 | 312 |
307 if (fbo_id_) { | 313 if (fbo_id_) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } | 443 } |
438 if (surface->Initialize()) | 444 if (surface->Initialize()) |
439 return surface; | 445 return surface; |
440 else | 446 else |
441 return NULL; | 447 return NULL; |
442 } | 448 } |
443 | 449 |
444 } // namespace content | 450 } // namespace content |
445 | 451 |
446 #endif // defined(USE_GPU) | 452 #endif // defined(USE_GPU) |
OLD | NEW |