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