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

Side by Side Diff: components/display_compositor/gpu_compositor_frame_sink.cc

Issue 2683583005: Move display_ From CompositorFrameSinkSupport To GpuDisplayCompositorFrameSink (Closed)
Patch Set: rebase Created 3 years, 10 months 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 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 "components/display_compositor/gpu_compositor_frame_sink.h" 5 #include "components/display_compositor/gpu_compositor_frame_sink.h"
6 6
7 #include "cc/surfaces/surface_reference.h" 7 #include "cc/surfaces/surface_reference.h"
8 8
9 namespace display_compositor { 9 namespace display_compositor {
10 10
11 GpuCompositorFrameSink::GpuCompositorFrameSink( 11 GpuCompositorFrameSink::GpuCompositorFrameSink(
12 GpuCompositorFrameSinkDelegate* delegate, 12 GpuCompositorFrameSinkDelegate* delegate,
13 cc::SurfaceManager* surface_manager, 13 std::unique_ptr<cc::CompositorFrameSinkSupport> support,
14 const cc::FrameSinkId& frame_sink_id,
15 std::unique_ptr<cc::Display> display,
16 std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
17 cc::mojom::MojoCompositorFrameSinkPrivateRequest 14 cc::mojom::MojoCompositorFrameSinkPrivateRequest
18 compositor_frame_sink_private_request, 15 compositor_frame_sink_private_request,
19 cc::mojom::MojoCompositorFrameSinkClientPtr client) 16 cc::mojom::MojoCompositorFrameSinkClientPtr client)
20 : delegate_(delegate), 17 : delegate_(delegate),
21 support_(this, 18 support_(std::move(support)),
22 surface_manager,
23 frame_sink_id,
24 std::move(display),
25 std::move(begin_frame_source)),
26 surface_manager_(surface_manager),
27 client_(std::move(client)), 19 client_(std::move(client)),
28 compositor_frame_sink_private_binding_( 20 compositor_frame_sink_private_binding_(
29 this, 21 this,
30 std::move(compositor_frame_sink_private_request)) { 22 std::move(compositor_frame_sink_private_request)) {
31 compositor_frame_sink_private_binding_.set_connection_error_handler( 23 compositor_frame_sink_private_binding_.set_connection_error_handler(
32 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, 24 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost,
33 base::Unretained(this))); 25 base::Unretained(this)));
34 } 26 }
35 27
36 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} 28 GpuCompositorFrameSink::~GpuCompositorFrameSink() {}
37 29
38 void GpuCompositorFrameSink::EvictFrame() { 30 void GpuCompositorFrameSink::EvictFrame() {
39 support_.EvictFrame(); 31 support_->EvictFrame();
40 } 32 }
41 33
42 void GpuCompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { 34 void GpuCompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) {
43 support_.SetNeedsBeginFrame(needs_begin_frame); 35 support_->SetNeedsBeginFrame(needs_begin_frame);
44 } 36 }
45 37
46 void GpuCompositorFrameSink::SubmitCompositorFrame( 38 void GpuCompositorFrameSink::SubmitCompositorFrame(
47 const cc::LocalSurfaceId& local_surface_id, 39 const cc::LocalSurfaceId& local_surface_id,
48 cc::CompositorFrame frame) { 40 cc::CompositorFrame frame) {
49 support_.SubmitCompositorFrame(local_surface_id, std::move(frame)); 41 support_->SubmitCompositorFrame(local_surface_id, std::move(frame));
50 } 42 }
51 43
52 void GpuCompositorFrameSink::Require(const cc::LocalSurfaceId& local_surface_id, 44 void GpuCompositorFrameSink::Require(const cc::LocalSurfaceId& local_surface_id,
53 const cc::SurfaceSequence& sequence) { 45 const cc::SurfaceSequence& sequence) {
54 support_.Require(local_surface_id, sequence); 46 support_->Require(local_surface_id, sequence);
55 } 47 }
56 48
57 void GpuCompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { 49 void GpuCompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) {
58 support_.Satisfy(sequence); 50 support_->Satisfy(sequence);
59 } 51 }
60 52
61 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() { 53 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() {
62 if (client_) 54 if (client_)
63 client_->DidReceiveCompositorFrameAck(); 55 client_->DidReceiveCompositorFrameAck();
64 } 56 }
65 57
66 void GpuCompositorFrameSink::AddChildFrameSink( 58 void GpuCompositorFrameSink::AddChildFrameSink(
67 const cc::FrameSinkId& child_frame_sink_id) { 59 const cc::FrameSinkId& child_frame_sink_id) {
68 support_.AddChildFrameSink(child_frame_sink_id); 60 support_->AddChildFrameSink(child_frame_sink_id);
69 } 61 }
70 62
71 void GpuCompositorFrameSink::RemoveChildFrameSink( 63 void GpuCompositorFrameSink::RemoveChildFrameSink(
72 const cc::FrameSinkId& child_frame_sink_id) { 64 const cc::FrameSinkId& child_frame_sink_id) {
73 support_.RemoveChildFrameSink(child_frame_sink_id); 65 support_->RemoveChildFrameSink(child_frame_sink_id);
74 } 66 }
75 67
76 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { 68 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) {
77 if (client_) 69 if (client_)
78 client_->OnBeginFrame(args); 70 client_->OnBeginFrame(args);
79 } 71 }
80 72
81 void GpuCompositorFrameSink::ReclaimResources( 73 void GpuCompositorFrameSink::ReclaimResources(
82 const cc::ReturnedResourceArray& resources) { 74 const cc::ReturnedResourceArray& resources) {
83 if (client_) 75 if (client_)
84 client_->ReclaimResources(resources); 76 client_->ReclaimResources(resources);
85 } 77 }
86 78
87 void GpuCompositorFrameSink::WillDrawSurface() { 79 void GpuCompositorFrameSink::WillDrawSurface() {
88 if (client_) 80 if (client_)
89 client_->WillDrawSurface(); 81 client_->WillDrawSurface();
90 } 82 }
91 83
92 void GpuCompositorFrameSink::OnClientConnectionLost() { 84 void GpuCompositorFrameSink::OnClientConnectionLost() {
93 client_connection_lost_ = true; 85 client_connection_lost_ = true;
94 // Request destruction of |this| only if both connections are lost. 86 // Request destruction of |this| only if both connections are lost.
95 delegate_->OnClientConnectionLost(support_.frame_sink_id(), 87 delegate_->OnClientConnectionLost(support_->frame_sink_id(),
96 private_connection_lost_); 88 private_connection_lost_);
97 } 89 }
98 90
99 void GpuCompositorFrameSink::OnPrivateConnectionLost() { 91 void GpuCompositorFrameSink::OnPrivateConnectionLost() {
100 private_connection_lost_ = true; 92 private_connection_lost_ = true;
101 // Request destruction of |this| only if both connections are lost. 93 // Request destruction of |this| only if both connections are lost.
102 delegate_->OnPrivateConnectionLost(support_.frame_sink_id(), 94 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(),
103 client_connection_lost_); 95 client_connection_lost_);
104 } 96 }
105 97
106 } // namespace display_compositor 98 } // namespace display_compositor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698