| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 if (need_to_bind) { | 129 if (need_to_bind) { |
| 130 GLES2Interface* gl = context_provider_->ContextGL(); | 130 GLES2Interface* gl = context_provider_->ContextGL(); |
| 131 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); | 131 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 void OffscreenBrowserCompositorOutputSurface::SwapBuffers( | 135 void OffscreenBrowserCompositorOutputSurface::SwapBuffers( |
| 136 cc::OutputSurfaceFrame frame) { | 136 cc::OutputSurfaceFrame frame) { |
| 137 gfx::Size surface_size = frame.size; | 137 gfx::Size surface_size = frame.size; |
| 138 DCHECK(surface_size == reshape_size_); | 138 DCHECK(surface_size == reshape_size_); |
| 139 gfx::Rect swap_rect = frame.sub_buffer_rect; | |
| 140 | 139 |
| 141 if (reflector_) { | 140 if (reflector_) { |
| 142 if (swap_rect == gfx::Rect(surface_size)) | 141 if (frame.sub_buffer_rect) |
| 142 reflector_->OnSourcePostSubBuffer(*frame.sub_buffer_rect, surface_size); |
| 143 else |
| 143 reflector_->OnSourceSwapBuffers(surface_size); | 144 reflector_->OnSourceSwapBuffers(surface_size); |
| 144 else | |
| 145 reflector_->OnSourcePostSubBuffer(swap_rect, surface_size); | |
| 146 } | 145 } |
| 147 | 146 |
| 148 // TODO(oshima): sync with the reflector's SwapBuffersComplete | 147 // TODO(oshima): sync with the reflector's SwapBuffersComplete |
| 149 // (crbug.com/520567). | 148 // (crbug.com/520567). |
| 150 // The original implementation had a flickering issue (crbug.com/515332). | 149 // The original implementation had a flickering issue (crbug.com/515332). |
| 151 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 150 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
| 152 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); | 151 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 153 gl->ShallowFlushCHROMIUM(); | 152 gl->ShallowFlushCHROMIUM(); |
| 154 | 153 |
| 155 gpu::SyncToken sync_token; | 154 gpu::SyncToken sync_token; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 186 } |
| 188 } | 187 } |
| 189 | 188 |
| 190 void OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete( | 189 void OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete( |
| 191 const std::vector<ui::LatencyInfo>& latency_info) { | 190 const std::vector<ui::LatencyInfo>& latency_info) { |
| 192 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 191 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
| 193 client_->DidReceiveSwapBuffersAck(); | 192 client_->DidReceiveSwapBuffersAck(); |
| 194 } | 193 } |
| 195 | 194 |
| 196 } // namespace content | 195 } // namespace content |
| OLD | NEW |