| 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_browser_compositor_output_surface.h" | 5 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
| 11 #include "cc/output/output_surface_frame.h" | 11 #include "cc/output/output_surface_frame.h" |
| 12 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" | 12 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" |
| 13 #include "content/browser/compositor/reflector_impl.h" | 13 #include "content/browser/compositor/reflector_impl.h" |
| 14 #include "content/browser/compositor/reflector_texture.h" | 14 #include "content/browser/compositor/reflector_texture.h" |
| 15 #include "content/browser/renderer_host/render_widget_host_impl.h" | 15 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 16 #include "gpu/command_buffer/client/context_support.h" | 16 #include "gpu/command_buffer/client/context_support.h" |
| 17 #include "gpu/command_buffer/client/gles2_interface.h" | 17 #include "gpu/command_buffer/client/gles2_interface.h" |
| 18 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 18 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 19 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 19 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface( | 23 GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface( |
| 24 scoped_refptr<ui::ContextProviderCommandBuffer> context, | 24 scoped_refptr<ui::ContextProviderCommandBuffer> context, |
| 25 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, | 25 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, |
| 26 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 26 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 27 overlay_candidate_validator) | 27 overlay_candidate_validator, |
| 28 bool supports_stencil) |
| 28 : BrowserCompositorOutputSurface(std::move(context), | 29 : BrowserCompositorOutputSurface(std::move(context), |
| 29 update_vsync_parameters_callback, | 30 update_vsync_parameters_callback, |
| 30 std::move(overlay_candidate_validator)), | 31 std::move(overlay_candidate_validator)), |
| 31 weak_ptr_factory_(this) { | 32 weak_ptr_factory_(this) { |
| 32 if (capabilities_.uses_default_gl_framebuffer) { | 33 if (capabilities_.uses_default_gl_framebuffer) { |
| 33 capabilities_.flipped_output_surface = | 34 capabilities_.flipped_output_surface = |
| 34 context_provider()->ContextCapabilities().flips_vertically; | 35 context_provider()->ContextCapabilities().flips_vertically; |
| 35 } | 36 } |
| 37 capabilities_.supports_stencil = supports_stencil; |
| 36 } | 38 } |
| 37 | 39 |
| 38 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() { | 40 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() { |
| 39 GetCommandBufferProxy()->SetUpdateVSyncParametersCallback( | 41 GetCommandBufferProxy()->SetUpdateVSyncParametersCallback( |
| 40 UpdateVSyncParametersCallback()); | 42 UpdateVSyncParametersCallback()); |
| 41 } | 43 } |
| 42 | 44 |
| 43 void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 45 void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
| 44 const std::vector<ui::LatencyInfo>& latency_info, | 46 const std::vector<ui::LatencyInfo>& latency_info, |
| 45 gfx::SwapResult result, | 47 gfx::SwapResult result, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 GpuBrowserCompositorOutputSurface::GetCommandBufferProxy() { | 140 GpuBrowserCompositorOutputSurface::GetCommandBufferProxy() { |
| 139 ui::ContextProviderCommandBuffer* provider_command_buffer = | 141 ui::ContextProviderCommandBuffer* provider_command_buffer = |
| 140 static_cast<ui::ContextProviderCommandBuffer*>(context_provider_.get()); | 142 static_cast<ui::ContextProviderCommandBuffer*>(context_provider_.get()); |
| 141 gpu::CommandBufferProxyImpl* command_buffer_proxy = | 143 gpu::CommandBufferProxyImpl* command_buffer_proxy = |
| 142 provider_command_buffer->GetCommandBufferProxy(); | 144 provider_command_buffer->GetCommandBufferProxy(); |
| 143 DCHECK(command_buffer_proxy); | 145 DCHECK(command_buffer_proxy); |
| 144 return command_buffer_proxy; | 146 return command_buffer_proxy; |
| 145 } | 147 } |
| 146 | 148 |
| 147 } // namespace content | 149 } // namespace content |
| OLD | NEW |