| 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" |
| 11 #include "cc/output/output_surface_client.h" | 11 #include "cc/output/output_surface_client.h" |
| 12 #include "cc/output/output_surface_frame.h" | 12 #include "cc/output/output_surface_frame.h" |
| 13 #include "cc/resources/resource_provider.h" | 13 #include "cc/resources/resource_provider.h" |
| 14 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" | 14 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" |
| 15 #include "content/browser/compositor/reflector_impl.h" | 15 #include "content/browser/compositor/reflector_impl.h" |
| 16 #include "content/browser/compositor/reflector_texture.h" | 16 #include "content/browser/compositor/reflector_texture.h" |
| 17 #include "content/browser/renderer_host/render_widget_host_impl.h" | |
| 18 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 19 #include "gpu/command_buffer/client/context_support.h" | 18 #include "gpu/command_buffer/client/context_support.h" |
| 20 #include "gpu/command_buffer/client/gles2_interface.h" | 19 #include "gpu/command_buffer/client/gles2_interface.h" |
| 21 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 20 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
| 22 #include "third_party/khronos/GLES2/gl2.h" | 21 #include "third_party/khronos/GLES2/gl2.h" |
| 23 #include "third_party/khronos/GLES2/gl2ext.h" | 22 #include "third_party/khronos/GLES2/gl2ext.h" |
| 24 | 23 |
| 25 using gpu::gles2::GLES2Interface; | 24 using gpu::gles2::GLES2Interface; |
| 26 | 25 |
| 27 namespace content { | 26 namespace content { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 149 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
| 151 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); | 150 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 152 gl->ShallowFlushCHROMIUM(); | 151 gl->ShallowFlushCHROMIUM(); |
| 153 | 152 |
| 154 gpu::SyncToken sync_token; | 153 gpu::SyncToken sync_token; |
| 155 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 154 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 156 context_provider_->ContextSupport()->SignalSyncToken( | 155 context_provider_->ContextSupport()->SignalSyncToken( |
| 157 sync_token, | 156 sync_token, |
| 158 base::Bind( | 157 base::Bind( |
| 159 &OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete, | 158 &OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete, |
| 160 weak_ptr_factory_.GetWeakPtr(), frame.latency_info)); | 159 weak_ptr_factory_.GetWeakPtr())); |
| 161 } | 160 } |
| 162 | 161 |
| 163 bool OffscreenBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() | 162 bool OffscreenBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() |
| 164 const { | 163 const { |
| 165 return false; | 164 return false; |
| 166 } | 165 } |
| 167 | 166 |
| 168 unsigned OffscreenBrowserCompositorOutputSurface::GetOverlayTextureId() const { | 167 unsigned OffscreenBrowserCompositorOutputSurface::GetOverlayTextureId() const { |
| 169 return 0; | 168 return 0; |
| 170 } | 169 } |
| 171 | 170 |
| 172 bool OffscreenBrowserCompositorOutputSurface::SurfaceIsSuspendForRecycle() | 171 bool OffscreenBrowserCompositorOutputSurface::SurfaceIsSuspendForRecycle() |
| 173 const { | 172 const { |
| 174 return false; | 173 return false; |
| 175 } | 174 } |
| 176 | 175 |
| 177 GLenum | 176 GLenum |
| 178 OffscreenBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() { | 177 OffscreenBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() { |
| 179 return GLCopyTextureInternalFormat(kFboTextureFormat); | 178 return GLCopyTextureInternalFormat(kFboTextureFormat); |
| 180 } | 179 } |
| 181 | 180 |
| 182 void OffscreenBrowserCompositorOutputSurface::OnReflectorChanged() { | 181 void OffscreenBrowserCompositorOutputSurface::OnReflectorChanged() { |
| 183 if (reflector_) { | 182 if (reflector_) { |
| 184 reflector_changed_ = true; | 183 reflector_changed_ = true; |
| 185 EnsureBackbuffer(); | 184 EnsureBackbuffer(); |
| 186 } | 185 } |
| 187 } | 186 } |
| 188 | 187 |
| 189 void OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete( | 188 void OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete() { |
| 190 const std::vector<ui::LatencyInfo>& latency_info) { | |
| 191 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | |
| 192 client_->DidReceiveSwapBuffersAck(); | 189 client_->DidReceiveSwapBuffersAck(); |
| 193 } | 190 } |
| 194 | 191 |
| 195 } // namespace content | 192 } // namespace content |
| OLD | NEW |