| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 | 211 |
| 212 void IOSurfaceImageTransportSurface::AdjustBufferAllocation() { | 212 void IOSurfaceImageTransportSurface::AdjustBufferAllocation() { |
| 213 // On mac, the frontbuffer and backbuffer are the same buffer. The buffer is | 213 // On mac, the frontbuffer and backbuffer are the same buffer. The buffer is |
| 214 // free'd when both the browser and gpu processes have Unref'd the IOSurface. | 214 // free'd when both the browser and gpu processes have Unref'd the IOSurface. |
| 215 if (!backbuffer_suggested_allocation_ && | 215 if (!backbuffer_suggested_allocation_ && |
| 216 !frontbuffer_suggested_allocation_ && | 216 !frontbuffer_suggested_allocation_ && |
| 217 io_surface_.get()) { | 217 io_surface_.get()) { |
| 218 UnrefIOSurface(); | 218 UnrefIOSurface(); |
| 219 helper_->Suspend(); | 219 helper_->Suspend(); |
| 220 } else if (backbuffer_suggested_allocation_ && !io_surface_.get()) { | 220 } else if (backbuffer_suggested_allocation_ && !io_surface_) { |
| 221 CreateIOSurface(); | 221 CreateIOSurface(); |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 bool IOSurfaceImageTransportSurface::SwapBuffers() { | 225 bool IOSurfaceImageTransportSurface::SwapBuffers() { |
| 226 DCHECK(backbuffer_suggested_allocation_); | 226 DCHECK(backbuffer_suggested_allocation_); |
| 227 if (!frontbuffer_suggested_allocation_) | 227 if (!frontbuffer_suggested_allocation_) |
| 228 return true; | 228 return true; |
| 229 glFlush(); | 229 glFlush(); |
| 230 | 230 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 manager, stub, surface.get(), false)); | 478 manager, stub, surface.get(), false)); |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 | 481 |
| 482 // static | 482 // static |
| 483 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 483 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
| 484 g_allow_os_mesa = allow; | 484 g_allow_os_mesa = allow; |
| 485 } | 485 } |
| 486 | 486 |
| 487 } // namespace content | 487 } // namespace content |
| OLD | NEW |