OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/offscreen_browser_compositor_output_surface
.h" | 5 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void OffscreenBrowserCompositorOutputSurface::SwapBuffers( | 139 void OffscreenBrowserCompositorOutputSurface::SwapBuffers( |
140 cc::CompositorFrame frame) { | 140 cc::CompositorFrame frame) { |
141 if (reflector_) { | 141 if (reflector_) { |
142 if (frame.gl_frame_data->sub_buffer_rect == | 142 if (frame.gl_frame_data->sub_buffer_rect == |
143 gfx::Rect(frame.gl_frame_data->size)) | 143 gfx::Rect(frame.gl_frame_data->size)) |
144 reflector_->OnSourceSwapBuffers(); | 144 reflector_->OnSourceSwapBuffers(); |
145 else | 145 else |
146 reflector_->OnSourcePostSubBuffer(frame.gl_frame_data->sub_buffer_rect); | 146 reflector_->OnSourcePostSubBuffer(frame.gl_frame_data->sub_buffer_rect); |
147 } | 147 } |
148 | 148 |
149 client_->DidSwapBuffers(); | |
150 | |
151 // TODO(oshima): sync with the reflector's SwapBuffersComplete | 149 // TODO(oshima): sync with the reflector's SwapBuffersComplete |
152 // (crbug.com/520567). | 150 // (crbug.com/520567). |
153 // The original implementation had a flickering issue (crbug.com/515332). | 151 // The original implementation had a flickering issue (crbug.com/515332). |
154 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 152 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
155 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); | 153 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
156 gl->ShallowFlushCHROMIUM(); | 154 gl->ShallowFlushCHROMIUM(); |
157 | 155 |
158 gpu::SyncToken sync_token; | 156 gpu::SyncToken sync_token; |
159 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 157 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
160 context_provider_->ContextSupport()->SignalSyncToken( | 158 context_provider_->ContextSupport()->SignalSyncToken( |
161 sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete, | 159 sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete, |
162 weak_ptr_factory_.GetWeakPtr())); | 160 weak_ptr_factory_.GetWeakPtr())); |
163 } | 161 } |
164 | 162 |
165 void OffscreenBrowserCompositorOutputSurface::OnReflectorChanged() { | 163 void OffscreenBrowserCompositorOutputSurface::OnReflectorChanged() { |
166 if (reflector_) | 164 if (reflector_) |
167 EnsureBackbuffer(); | 165 EnsureBackbuffer(); |
168 } | 166 } |
169 | 167 |
170 base::Closure | 168 base::Closure |
171 OffscreenBrowserCompositorOutputSurface::CreateCompositionStartedCallback() { | 169 OffscreenBrowserCompositorOutputSurface::CreateCompositionStartedCallback() { |
172 return base::Closure(); | 170 return base::Closure(); |
173 } | 171 } |
174 | 172 |
175 } // namespace content | 173 } // namespace content |
OLD | NEW |