| 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 "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/output/output_surface_client.h" |
| 8 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" | 9 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" |
| 9 #include "content/browser/compositor/buffer_queue.h" | 10 #include "content/browser/compositor/buffer_queue.h" |
| 10 #include "content/browser/compositor/reflector_impl.h" | 11 #include "content/browser/compositor/reflector_impl.h" |
| 11 #include "content/browser/gpu/gpu_surface_tracker.h" | 12 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 12 #include "content/common/gpu/client/context_provider_command_buffer.h" | 13 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 13 #include "content/common/gpu/client/gl_helper.h" | 14 #include "content/common/gpu/client/gl_helper.h" |
| 14 #include "gpu/GLES2/gl2extchromium.h" | 15 #include "gpu/GLES2/gl2extchromium.h" |
| 15 #include "gpu/command_buffer/client/gles2_interface.h" | 16 #include "gpu/command_buffer/client/gles2_interface.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 const gfx::Size& size, | 91 const gfx::Size& size, |
| 91 float scale_factor) { | 92 float scale_factor) { |
| 92 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor); | 93 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor); |
| 93 DCHECK(output_surface_); | 94 DCHECK(output_surface_); |
| 94 output_surface_->Reshape(SurfaceSize(), scale_factor); | 95 output_surface_->Reshape(SurfaceSize(), scale_factor); |
| 95 } | 96 } |
| 96 | 97 |
| 97 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersCompleted( | 98 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersCompleted( |
| 98 const std::vector<ui::LatencyInfo>& latency_info, | 99 const std::vector<ui::LatencyInfo>& latency_info, |
| 99 gfx::SwapResult result) { | 100 gfx::SwapResult result) { |
| 101 bool force_swap = false; |
| 100 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) { | 102 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) { |
| 101 // Even through the swap failed, this is a fixable error so we can pretend | 103 // Even through the swap failed, this is a fixable error so we can pretend |
| 102 // it succeeded to the rest of the system. | 104 // it succeeded to the rest of the system. |
| 103 result = gfx::SwapResult::SWAP_ACK; | 105 result = gfx::SwapResult::SWAP_ACK; |
| 104 output_surface_->RecreateBuffers(); | 106 output_surface_->RecreateBuffers(); |
| 107 force_swap = true; |
| 105 } | 108 } |
| 106 GpuBrowserCompositorOutputSurface::OnSwapBuffersCompleted(latency_info, | 109 GpuBrowserCompositorOutputSurface::OnSwapBuffersCompleted(latency_info, |
| 107 result); | 110 result); |
| 111 if (force_swap) |
| 112 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); |
| 108 } | 113 } |
| 109 | 114 |
| 110 } // namespace content | 115 } // namespace content |
| OLD | NEW |