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

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

Issue 2710703005: GpuDisplayCompositorFrameSink => GpuRootCompositorFrameSink (Closed)
Patch Set: Addressed Dana's comments 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 std::unique_ptr<cc::CompositorFrameSinkSupport> support, 13 cc::SurfaceManager* surface_manager,
14 const cc::FrameSinkId& frame_sink_id,
15 cc::mojom::MojoCompositorFrameSinkRequest request,
14 cc::mojom::MojoCompositorFrameSinkPrivateRequest 16 cc::mojom::MojoCompositorFrameSinkPrivateRequest
15 compositor_frame_sink_private_request, 17 compositor_frame_sink_private_request,
16 cc::mojom::MojoCompositorFrameSinkClientPtr client) 18 cc::mojom::MojoCompositorFrameSinkClientPtr client)
17 : delegate_(delegate), 19 : delegate_(delegate),
18 support_(std::move(support)), 20 support_(base::MakeUnique<cc::CompositorFrameSinkSupport>(
21 this,
22 surface_manager,
23 frame_sink_id,
24 false /* is_root */,
25 true /* handles_frame_sink_id_invalidation */,
26 true /* needs_sync_points */)),
19 client_(std::move(client)), 27 client_(std::move(client)),
28 compositor_frame_sink_binding_(this, std::move(request)),
20 compositor_frame_sink_private_binding_( 29 compositor_frame_sink_private_binding_(
21 this, 30 this,
22 std::move(compositor_frame_sink_private_request)) { 31 std::move(compositor_frame_sink_private_request)) {
32 compositor_frame_sink_binding_.set_connection_error_handler(base::Bind(
33 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this)));
23 compositor_frame_sink_private_binding_.set_connection_error_handler( 34 compositor_frame_sink_private_binding_.set_connection_error_handler(
24 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, 35 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost,
25 base::Unretained(this))); 36 base::Unretained(this)));
26 } 37 }
27 38
28 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} 39 GpuCompositorFrameSink::~GpuCompositorFrameSink() {}
29 40
30 void GpuCompositorFrameSink::EvictFrame() { 41 void GpuCompositorFrameSink::EvictFrame() {
31 support_->EvictFrame(); 42 support_->EvictFrame();
32 } 43 }
(...skipping 25 matching lines...) Expand all
58 void GpuCompositorFrameSink::AddChildFrameSink( 69 void GpuCompositorFrameSink::AddChildFrameSink(
59 const cc::FrameSinkId& child_frame_sink_id) { 70 const cc::FrameSinkId& child_frame_sink_id) {
60 support_->AddChildFrameSink(child_frame_sink_id); 71 support_->AddChildFrameSink(child_frame_sink_id);
61 } 72 }
62 73
63 void GpuCompositorFrameSink::RemoveChildFrameSink( 74 void GpuCompositorFrameSink::RemoveChildFrameSink(
64 const cc::FrameSinkId& child_frame_sink_id) { 75 const cc::FrameSinkId& child_frame_sink_id) {
65 support_->RemoveChildFrameSink(child_frame_sink_id); 76 support_->RemoveChildFrameSink(child_frame_sink_id);
66 } 77 }
67 78
79 void GpuCompositorFrameSink::RequestCopyOfSurface(
80 std::unique_ptr<cc::CopyOutputRequest> request) {
81 support_->RequestCopyOfSurface(std::move(request));
82 }
83
68 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { 84 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) {
69 if (client_) 85 if (client_)
70 client_->OnBeginFrame(args); 86 client_->OnBeginFrame(args);
71 } 87 }
72 88
73 void GpuCompositorFrameSink::ReclaimResources( 89 void GpuCompositorFrameSink::ReclaimResources(
74 const cc::ReturnedResourceArray& resources) { 90 const cc::ReturnedResourceArray& resources) {
75 if (client_) 91 if (client_)
76 client_->ReclaimResources(resources); 92 client_->ReclaimResources(resources);
77 } 93 }
(...skipping 12 matching lines...) Expand all
90 private_connection_lost_); 106 private_connection_lost_);
91 } 107 }
92 108
93 void GpuCompositorFrameSink::OnPrivateConnectionLost() { 109 void GpuCompositorFrameSink::OnPrivateConnectionLost() {
94 private_connection_lost_ = true; 110 private_connection_lost_ = true;
95 // Request destruction of |this| only if both connections are lost. 111 // Request destruction of |this| only if both connections are lost.
96 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(), 112 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(),
97 client_connection_lost_); 113 client_connection_lost_);
98 } 114 }
99 115
100 void GpuCompositorFrameSink::RequestCopyOfSurface(
101 std::unique_ptr<cc::CopyOutputRequest> request) {
102 support_->RequestCopyOfSurface(std::move(request));
103 }
104
105 } // namespace display_compositor 116 } // namespace display_compositor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698