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

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

Issue 2443003004: cc: Make OutputSurface::BindToClient pure virtual and not return bool (Closed)
Patch Set: bindtoclient-pure-virtual: rebsae Created 4 years, 1 month 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"
(...skipping 12 matching lines...) Expand all
23 GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface( 23 GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface(
24 scoped_refptr<ContextProviderCommandBuffer> context, 24 scoped_refptr<ContextProviderCommandBuffer> context,
25 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, 25 scoped_refptr<ui::CompositorVSyncManager> vsync_manager,
26 cc::SyntheticBeginFrameSource* begin_frame_source, 26 cc::SyntheticBeginFrameSource* begin_frame_source,
27 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 27 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator>
28 overlay_candidate_validator) 28 overlay_candidate_validator)
29 : BrowserCompositorOutputSurface(std::move(context), 29 : BrowserCompositorOutputSurface(std::move(context),
30 std::move(vsync_manager), 30 std::move(vsync_manager),
31 begin_frame_source, 31 begin_frame_source,
32 std::move(overlay_candidate_validator)), 32 std::move(overlay_candidate_validator)),
33 weak_ptr_factory_(this) {} 33 weak_ptr_factory_(this) {
34 if (capabilities_.uses_default_gl_framebuffer) {
35 capabilities_.flipped_output_surface =
36 context_provider()->ContextCapabilities().flips_vertically;
boliu 2016/10/25 00:07:35 is accessing the context safe here? or is the assu
danakj 2016/10/25 00:11:01 Yes OutputSurface is now single-threaded. Display
danakj 2016/10/25 00:11:44 Here's where for GPTF: https://cs.chromium.org/chr
37 }
38 }
34 39
35 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() = 40 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() =
36 default; 41 default;
37 42
38 void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( 43 void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(
39 const std::vector<ui::LatencyInfo>& latency_info, 44 const std::vector<ui::LatencyInfo>& latency_info,
40 gfx::SwapResult result, 45 gfx::SwapResult result,
41 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { 46 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
42 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); 47 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
43 client_->DidReceiveSwapBuffersAck(); 48 client_->DidReceiveSwapBuffersAck();
44 } 49 }
45 50
46 void GpuBrowserCompositorOutputSurface::OnReflectorChanged() { 51 void GpuBrowserCompositorOutputSurface::OnReflectorChanged() {
47 if (!reflector_) { 52 if (!reflector_) {
48 reflector_texture_.reset(); 53 reflector_texture_.reset();
49 } else { 54 } else {
50 reflector_texture_.reset(new ReflectorTexture(context_provider())); 55 reflector_texture_.reset(new ReflectorTexture(context_provider()));
51 reflector_->OnSourceTextureMailboxUpdated(reflector_texture_->mailbox()); 56 reflector_->OnSourceTextureMailboxUpdated(reflector_texture_->mailbox());
52 } 57 }
53 } 58 }
54 59
55 bool GpuBrowserCompositorOutputSurface::BindToClient( 60 void GpuBrowserCompositorOutputSurface::BindToClient(
56 cc::OutputSurfaceClient* client) { 61 cc::OutputSurfaceClient* client) {
57 if (!BrowserCompositorOutputSurface::BindToClient(client)) 62 DCHECK(client);
58 return false; 63 DCHECK(!client_);
59 64 client_ = client;
60 if (capabilities_.uses_default_gl_framebuffer) {
61 capabilities_.flipped_output_surface =
62 context_provider()->ContextCapabilities().flips_vertically;
63 }
64 65
65 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( 66 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback(
66 base::Bind(&GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted, 67 base::Bind(&GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted,
67 weak_ptr_factory_.GetWeakPtr())); 68 weak_ptr_factory_.GetWeakPtr()));
68 GetCommandBufferProxy()->SetUpdateVSyncParametersCallback(base::Bind( 69 GetCommandBufferProxy()->SetUpdateVSyncParametersCallback(base::Bind(
69 &GpuBrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu, 70 &GpuBrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu,
70 weak_ptr_factory_.GetWeakPtr())); 71 weak_ptr_factory_.GetWeakPtr()));
71 return true;
72 } 72 }
73 73
74 void GpuBrowserCompositorOutputSurface::EnsureBackbuffer() {} 74 void GpuBrowserCompositorOutputSurface::EnsureBackbuffer() {}
75 75
76 void GpuBrowserCompositorOutputSurface::DiscardBackbuffer() { 76 void GpuBrowserCompositorOutputSurface::DiscardBackbuffer() {
77 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); 77 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM();
78 } 78 }
79 79
80 void GpuBrowserCompositorOutputSurface::BindFramebuffer() { 80 void GpuBrowserCompositorOutputSurface::BindFramebuffer() {
81 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); 81 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 ContextProviderCommandBuffer* provider_command_buffer = 139 ContextProviderCommandBuffer* provider_command_buffer =
140 static_cast<content::ContextProviderCommandBuffer*>( 140 static_cast<content::ContextProviderCommandBuffer*>(
141 context_provider_.get()); 141 context_provider_.get());
142 gpu::CommandBufferProxyImpl* command_buffer_proxy = 142 gpu::CommandBufferProxyImpl* command_buffer_proxy =
143 provider_command_buffer->GetCommandBufferProxy(); 143 provider_command_buffer->GetCommandBufferProxy();
144 DCHECK(command_buffer_proxy); 144 DCHECK(command_buffer_proxy);
145 return command_buffer_proxy; 145 return command_buffer_proxy;
146 } 146 }
147 147
148 } // namespace content 148 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698