Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: content/browser/compositor/gpu_browser_compositor_output_surface.cc

Issue 2511273002: Decouple BrowserCompositorOutputSurface from BeginFrameSource. (Closed)
Patch Set: Avoid duplicating code that updates VSync manager. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/common/gpu/client/context_provider_command_buffer.h" 16 #include "content/common/gpu/client/context_provider_command_buffer.h"
17 #include "gpu/command_buffer/client/context_support.h" 17 #include "gpu/command_buffer/client/context_support.h"
18 #include "gpu/command_buffer/client/gles2_interface.h" 18 #include "gpu/command_buffer/client/gles2_interface.h"
19 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 19 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface( 23 GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface(
24 scoped_refptr<ContextProviderCommandBuffer> context, 24 scoped_refptr<ContextProviderCommandBuffer> context,
25 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, 25 const UpdateVSyncParametersCallback& update_vsync_parameters_callback,
26 cc::SyntheticBeginFrameSource* begin_frame_source,
27 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 26 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator>
28 overlay_candidate_validator) 27 overlay_candidate_validator)
29 : BrowserCompositorOutputSurface(std::move(context), 28 : BrowserCompositorOutputSurface(std::move(context),
30 std::move(vsync_manager), 29 update_vsync_parameters_callback,
31 begin_frame_source,
32 std::move(overlay_candidate_validator)), 30 std::move(overlay_candidate_validator)),
33 weak_ptr_factory_(this) { 31 weak_ptr_factory_(this) {
34 if (capabilities_.uses_default_gl_framebuffer) { 32 if (capabilities_.uses_default_gl_framebuffer) {
35 capabilities_.flipped_output_surface = 33 capabilities_.flipped_output_surface =
36 context_provider()->ContextCapabilities().flips_vertically; 34 context_provider()->ContextCapabilities().flips_vertically;
37 } 35 }
38 } 36 }
39 37
40 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() = 38 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() =
41 default; 39 default;
(...skipping 18 matching lines...) Expand all
60 void GpuBrowserCompositorOutputSurface::BindToClient( 58 void GpuBrowserCompositorOutputSurface::BindToClient(
61 cc::OutputSurfaceClient* client) { 59 cc::OutputSurfaceClient* client) {
62 DCHECK(client); 60 DCHECK(client);
63 DCHECK(!client_); 61 DCHECK(!client_);
64 client_ = client; 62 client_ = client;
65 63
66 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( 64 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback(
67 base::Bind(&GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted, 65 base::Bind(&GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted,
68 weak_ptr_factory_.GetWeakPtr())); 66 weak_ptr_factory_.GetWeakPtr()));
69 GetCommandBufferProxy()->SetUpdateVSyncParametersCallback(base::Bind( 67 GetCommandBufferProxy()->SetUpdateVSyncParametersCallback(base::Bind(
70 &GpuBrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu, 68 &GpuBrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu,
danakj 2016/11/30 23:49:05 This is going to the base class just to call anoth
stanisc 2016/12/01 00:16:27 Yep, it looks like OnUpdateVSyncParametersFromGpu
stanisc 2016/12/02 19:50:43 Done.
71 weak_ptr_factory_.GetWeakPtr())); 69 weak_ptr_factory_.GetWeakPtr()));
72 } 70 }
73 71
74 void GpuBrowserCompositorOutputSurface::EnsureBackbuffer() {} 72 void GpuBrowserCompositorOutputSurface::EnsureBackbuffer() {}
75 73
76 void GpuBrowserCompositorOutputSurface::DiscardBackbuffer() { 74 void GpuBrowserCompositorOutputSurface::DiscardBackbuffer() {
77 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); 75 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM();
78 } 76 }
79 77
80 void GpuBrowserCompositorOutputSurface::BindFramebuffer() { 78 void GpuBrowserCompositorOutputSurface::BindFramebuffer() {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 ContextProviderCommandBuffer* provider_command_buffer = 137 ContextProviderCommandBuffer* provider_command_buffer =
140 static_cast<content::ContextProviderCommandBuffer*>( 138 static_cast<content::ContextProviderCommandBuffer*>(
141 context_provider_.get()); 139 context_provider_.get());
142 gpu::CommandBufferProxyImpl* command_buffer_proxy = 140 gpu::CommandBufferProxyImpl* command_buffer_proxy =
143 provider_command_buffer->GetCommandBufferProxy(); 141 provider_command_buffer->GetCommandBufferProxy();
144 DCHECK(command_buffer_proxy); 142 DCHECK(command_buffer_proxy);
145 return command_buffer_proxy; 143 return command_buffer_proxy;
146 } 144 }
147 145
148 } // namespace content 146 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698