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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 DCHECK(output_surface_); | 102 DCHECK(output_surface_); |
102 output_surface_->Reshape(SurfaceSize(), scale_factor); | 103 output_surface_->Reshape(SurfaceSize(), scale_factor); |
103 } | 104 } |
104 | 105 |
105 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersCompleted( | 106 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersCompleted( |
106 const std::vector<ui::LatencyInfo>& latency_info, | 107 const std::vector<ui::LatencyInfo>& latency_info, |
107 gfx::SwapResult result) { | 108 gfx::SwapResult result) { |
108 #if defined(OS_MACOSX) | 109 #if defined(OS_MACOSX) |
109 NOTREACHED(); | 110 NOTREACHED(); |
110 #else | 111 #else |
| 112 bool force_swap = false; |
111 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) { | 113 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) { |
112 // Even through the swap failed, this is a fixable error so we can pretend | 114 // Even through the swap failed, this is a fixable error so we can pretend |
113 // it succeeded to the rest of the system. | 115 // it succeeded to the rest of the system. |
114 result = gfx::SwapResult::SWAP_ACK; | 116 result = gfx::SwapResult::SWAP_ACK; |
115 output_surface_->RecreateBuffers(); | 117 output_surface_->RecreateBuffers(); |
| 118 force_swap = true; |
116 } | 119 } |
117 GpuBrowserCompositorOutputSurface::OnSwapBuffersCompleted(latency_info, | 120 GpuBrowserCompositorOutputSurface::OnSwapBuffersCompleted(latency_info, |
118 result); | 121 result); |
| 122 if (force_swap) |
| 123 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); |
119 #endif | 124 #endif |
120 } | 125 } |
121 | 126 |
122 #if defined(OS_MACOSX) | 127 #if defined(OS_MACOSX) |
123 void GpuSurfacelessBrowserCompositorOutputSurface::OnSurfaceDisplayed() { | 128 void GpuSurfacelessBrowserCompositorOutputSurface::OnSurfaceDisplayed() { |
124 OnSwapBuffersComplete(); | 129 OnSwapBuffersComplete(); |
125 } | 130 } |
126 #endif | 131 #endif |
127 | 132 |
128 } // namespace content | 133 } // namespace content |
OLD | NEW |