| 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/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_cftyperef.h" | 7 #include "base/mac/scoped_cftyperef.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/common/gpu/gpu_messages.h" | 9 #include "content/common/gpu/gpu_messages.h" |
| 10 #include "content/common/gpu/texture_image_transport_surface.h" | 10 #include "content/common/gpu/texture_image_transport_surface.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 bool SetBackbufferAllocation(bool allocated) OVERRIDE; | 55 virtual bool 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", | 292 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", |
| 292 "old_width", size_.width(), "new_width", size.width()); | 293 "old_width", size_.width(), "new_width", size.width()); |
| 293 // Caching |context_| from OnMakeCurrent. It should still be current. | 294 // Caching |context_| from OnMakeCurrent. It should still be current. |
| 294 DCHECK(context_->IsCurrent(this)); | 295 DCHECK(context_->IsCurrent(this)); |
| 295 | 296 |
| 296 size_ = size; | 297 size_ = size; |
| 297 | 298 |
| 298 CreateIOSurface(); | 299 CreateIOSurface(); |
| 299 } | 300 } |
| 300 | 301 |
| 302 void IOSurfaceImageTransportSurface::SetLatencyInfo( |
| 303 const cc::LatencyInfo&) { |
| 304 // TODO: implement |
| 305 } |
| 306 |
| 301 void IOSurfaceImageTransportSurface::UnrefIOSurface() { | 307 void IOSurfaceImageTransportSurface::UnrefIOSurface() { |
| 302 // If we have resources to destroy, then make sure that we have a current | 308 // If we have resources to destroy, then make sure that we have a current |
| 303 // context which we can use to delete the resources. | 309 // context which we can use to delete the resources. |
| 304 if (context_ || fbo_id_ || texture_id_) { | 310 if (context_ || fbo_id_ || texture_id_) { |
| 305 DCHECK(gfx::GLContext::GetCurrent() == context_); | 311 DCHECK(gfx::GLContext::GetCurrent() == context_); |
| 306 DCHECK(context_->IsCurrent(this)); | 312 DCHECK(context_->IsCurrent(this)); |
| 307 DCHECK(CGLGetCurrentContext()); | 313 DCHECK(CGLGetCurrentContext()); |
| 308 } | 314 } |
| 309 | 315 |
| 310 if (fbo_id_) { | 316 if (fbo_id_) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 else | 482 else |
| 477 return NULL; | 483 return NULL; |
| 478 } | 484 } |
| 479 | 485 |
| 480 // static | 486 // static |
| 481 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 487 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
| 482 g_allow_os_mesa = allow; | 488 g_allow_os_mesa = allow; |
| 483 } | 489 } |
| 484 | 490 |
| 485 } // namespace content | 491 } // namespace content |
| OLD | NEW |