Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h" | 5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 return buffer_queue_->current_texture_id(); | 68 return buffer_queue_->current_texture_id(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( | 71 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( |
| 72 cc::CompositorFrame frame) { | 72 cc::CompositorFrame frame) { |
| 73 DCHECK(buffer_queue_); | 73 DCHECK(buffer_queue_); |
| 74 buffer_queue_->SwapBuffers(frame.gl_frame_data->sub_buffer_rect); | 74 buffer_queue_->SwapBuffers(frame.gl_frame_data->sub_buffer_rect); |
| 75 GpuBrowserCompositorOutputSurface::SwapBuffers(std::move(frame)); | 75 GpuBrowserCompositorOutputSurface::SwapBuffers(std::move(frame)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() { | |
| 79 DCHECK(buffer_queue_); | |
| 80 buffer_queue_->PageFlipComplete(); | |
| 81 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete(); | |
| 82 } | |
| 83 | |
| 84 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { | 78 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { |
| 85 DCHECK(buffer_queue_); | 79 DCHECK(buffer_queue_); |
| 86 buffer_queue_->BindFramebuffer(); | 80 buffer_queue_->BindFramebuffer(); |
| 87 } | 81 } |
| 88 | 82 |
| 89 GLenum GpuSurfacelessBrowserCompositorOutputSurface:: | 83 GLenum GpuSurfacelessBrowserCompositorOutputSurface:: |
| 90 GetFramebufferCopyTextureFormat() { | 84 GetFramebufferCopyTextureFormat() { |
| 91 return buffer_queue_->internal_format(); | 85 return buffer_queue_->internal_format(); |
| 92 } | 86 } |
| 93 | 87 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 107 gfx::SwapResult result, | 101 gfx::SwapResult result, |
| 108 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { | 102 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
| 109 bool force_swap = false; | 103 bool force_swap = false; |
| 110 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) { | 104 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) { |
| 111 // Even through the swap failed, this is a fixable error so we can pretend | 105 // Even through the swap failed, this is a fixable error so we can pretend |
| 112 // it succeeded to the rest of the system. | 106 // it succeeded to the rest of the system. |
| 113 result = gfx::SwapResult::SWAP_ACK; | 107 result = gfx::SwapResult::SWAP_ACK; |
| 114 buffer_queue_->RecreateBuffers(); | 108 buffer_queue_->RecreateBuffers(); |
| 115 force_swap = true; | 109 force_swap = true; |
| 116 } | 110 } |
| 111 buffer_queue_->PageFlipComplete(); | |
|
boliu
2016/09/26 17:14:50
copy the DCHECK from old code too?
danakj
2016/09/26 18:54:44
I'm not sure what value it is TBH. We set this mem
| |
| 117 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 112 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
| 118 latency_info, result, params_mac); | 113 latency_info, result, params_mac); |
| 119 if (force_swap) | 114 if (force_swap) |
| 120 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); | 115 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); |
| 121 } | 116 } |
| 122 | 117 |
| 123 } // namespace content | 118 } // namespace content |
| OLD | NEW |