Chromium Code Reviews| 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 "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 53 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 54 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; | 54 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 55 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 55 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 56 | 56 |
| 57 protected: | 57 protected: |
| 58 // ImageTransportSurface implementation | 58 // ImageTransportSurface implementation |
| 59 virtual void OnBufferPresented( | 59 virtual void OnBufferPresented( |
| 60 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 60 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
| 61 virtual void OnResizeViewACK() OVERRIDE; | 61 virtual void OnResizeViewACK() OVERRIDE; |
| 62 virtual void OnResize(gfx::Size size) OVERRIDE; | 62 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 63 virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; | |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; | 66 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; |
| 66 | 67 |
| 67 void AdjustBufferAllocation(); | 68 void AdjustBufferAllocation(); |
| 68 void UnrefIOSurface(); | 69 void UnrefIOSurface(); |
| 69 void CreateIOSurface(); | 70 void CreateIOSurface(); |
| 70 | 71 |
| 71 // Tracks the current buffer allocation state. | 72 // Tracks the current buffer allocation state. |
| 72 bool backbuffer_suggested_allocation_; | 73 bool backbuffer_suggested_allocation_; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", | 291 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", |
| 291 "old_width", size_.width(), "new_width", size.width()); | 292 "old_width", size_.width(), "new_width", size.width()); |
| 292 // Caching |context_| from OnMakeCurrent. It should still be current. | 293 // Caching |context_| from OnMakeCurrent. It should still be current. |
| 293 DCHECK(context_->IsCurrent(this)); | 294 DCHECK(context_->IsCurrent(this)); |
| 294 | 295 |
| 295 size_ = size; | 296 size_ = size; |
| 296 | 297 |
| 297 CreateIOSurface(); | 298 CreateIOSurface(); |
| 298 } | 299 } |
| 299 | 300 |
| 301 void IOSurfaceImageTransportSurface::SetLatencyInfo( | |
| 302 const cc::LatencyInfo&) { | |
| 303 // TODO: implement | |
|
piman
2013/04/03 18:05:09
Is there anything to do here beyond keeping it aro
| |
| 304 } | |
| 305 | |
| 300 void IOSurfaceImageTransportSurface::UnrefIOSurface() { | 306 void IOSurfaceImageTransportSurface::UnrefIOSurface() { |
| 301 // If we have resources to destroy, then make sure that we have a current | 307 // If we have resources to destroy, then make sure that we have a current |
| 302 // context which we can use to delete the resources. | 308 // context which we can use to delete the resources. |
| 303 if (context_ || fbo_id_ || texture_id_) { | 309 if (context_ || fbo_id_ || texture_id_) { |
| 304 DCHECK(gfx::GLContext::GetCurrent() == context_); | 310 DCHECK(gfx::GLContext::GetCurrent() == context_); |
| 305 DCHECK(context_->IsCurrent(this)); | 311 DCHECK(context_->IsCurrent(this)); |
| 306 DCHECK(CGLGetCurrentContext()); | 312 DCHECK(CGLGetCurrentContext()); |
| 307 } | 313 } |
| 308 | 314 |
| 309 if (fbo_id_) { | 315 if (fbo_id_) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 manager, stub, surface.get(), false)); | 474 manager, stub, surface.get(), false)); |
| 469 } | 475 } |
| 470 } | 476 } |
| 471 | 477 |
| 472 // static | 478 // static |
| 473 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 479 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
| 474 g_allow_os_mesa = allow; | 480 g_allow_os_mesa = allow; |
| 475 } | 481 } |
| 476 | 482 |
| 477 } // namespace content | 483 } // namespace content |
| OLD | NEW |