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

Side by Side Diff: services/ui/surfaces/gpu_compositor_frame_sink.cc

Issue 2579693004: GpuCompositorFrameSink implements cc::mojom::DisplayPrivate (Closed)
Patch Set: Addressed comments 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 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 "services/ui/surfaces/gpu_compositor_frame_sink.h" 5 #include "services/ui/surfaces/gpu_compositor_frame_sink.h"
6 6
7 #include "services/ui/surfaces/display_compositor.h" 7 #include "services/ui/surfaces/display_compositor.h"
8 8
9 namespace ui { 9 namespace ui {
10 10
11 GpuCompositorFrameSink::GpuCompositorFrameSink( 11 GpuCompositorFrameSink::GpuCompositorFrameSink(
12 DisplayCompositor* display_compositor, 12 DisplayCompositor* display_compositor,
13 const cc::FrameSinkId& frame_sink_id, 13 const cc::FrameSinkId& frame_sink_id,
14 std::unique_ptr<cc::Display> display, 14 std::unique_ptr<cc::Display> display,
15 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, 15 std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
16 cc::mojom::MojoCompositorFrameSinkRequest request, 16 cc::mojom::MojoCompositorFrameSinkRequest request,
17 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, 17 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request,
Fady Samuel 2016/12/16 17:18:18 compositor_frame_sink_private_request
Alex Z. 2016/12/19 19:27:47 Done.
18 cc::mojom::MojoCompositorFrameSinkClientPtr client) 18 cc::mojom::MojoCompositorFrameSinkClientPtr client,
19 cc::mojom::DisplayPrivateRequest display_request)
Fady Samuel 2016/12/16 17:18:18 display_private_request
Alex Z. 2016/12/19 19:27:47 Done.
19 : display_compositor_(display_compositor), 20 : display_compositor_(display_compositor),
20 support_(this, 21 support_(this,
21 display_compositor->manager(), 22 display_compositor->manager(),
22 frame_sink_id, 23 frame_sink_id,
23 std::move(display), 24 std::move(display),
24 std::move(begin_frame_source)), 25 std::move(begin_frame_source)),
25 client_(std::move(client)), 26 client_(std::move(client)),
26 binding_(this, std::move(request)), 27 binding_(this, std::move(request)),
27 private_binding_(this, std::move(private_request)) { 28 private_binding_(this, std::move(private_request)),
Fady Samuel 2016/12/16 17:18:18 compositor_frame_sink_private_binding_
Alex Z. 2016/12/19 19:27:47 Done.
29 display_binding_(this, std::move(display_request)) {
Fady Samuel 2016/12/16 17:18:19 display_private_binding_
Alex Z. 2016/12/19 19:27:47 Done.
28 binding_.set_connection_error_handler(base::Bind( 30 binding_.set_connection_error_handler(base::Bind(
29 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this))); 31 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this)));
30 32
31 private_binding_.set_connection_error_handler( 33 private_binding_.set_connection_error_handler(
32 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, 34 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost,
33 base::Unretained(this))); 35 base::Unretained(this)));
34 } 36 }
35 37
36 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} 38 GpuCompositorFrameSink::~GpuCompositorFrameSink() {}
37 39
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void GpuCompositorFrameSink::AddChildFrameSink( 78 void GpuCompositorFrameSink::AddChildFrameSink(
77 const cc::FrameSinkId& child_frame_sink_id) { 79 const cc::FrameSinkId& child_frame_sink_id) {
78 support_.AddChildFrameSink(child_frame_sink_id); 80 support_.AddChildFrameSink(child_frame_sink_id);
79 } 81 }
80 82
81 void GpuCompositorFrameSink::RemoveChildFrameSink( 83 void GpuCompositorFrameSink::RemoveChildFrameSink(
82 const cc::FrameSinkId& child_frame_sink_id) { 84 const cc::FrameSinkId& child_frame_sink_id) {
83 support_.RemoveChildFrameSink(child_frame_sink_id); 85 support_.RemoveChildFrameSink(child_frame_sink_id);
84 } 86 }
85 87
88 void GpuCompositorFrameSink::SetDisplayVisible(bool visible) {
89 if (support_.GetDisplay())
90 support_.GetDisplay()->SetVisible(visible);
91 }
92
93 void GpuCompositorFrameSink::ResizeDisplay(const gfx::Size& size) {
94 if (support_.GetDisplay())
95 support_.GetDisplay()->Resize(size);
96 }
97
98 void GpuCompositorFrameSink::SetDisplayColorSpace(
99 const gfx::ColorSpace& color_space) {
100 if (support_.GetDisplay())
101 support_.GetDisplay()->SetColorSpace(color_space);
102 }
103
104 void GpuCompositorFrameSink::SetOutputIsSecure(bool secure) {
105 if (support_.GetDisplay())
106 support_.GetDisplay()->SetOutputIsSecure(secure);
107 }
108
86 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { 109 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) {
87 if (client_) 110 if (client_)
88 client_->OnBeginFrame(args); 111 client_->OnBeginFrame(args);
89 } 112 }
90 113
91 void GpuCompositorFrameSink::ReclaimResources( 114 void GpuCompositorFrameSink::ReclaimResources(
92 const cc::ReturnedResourceArray& resources) { 115 const cc::ReturnedResourceArray& resources) {
93 if (client_) 116 if (client_)
94 client_->ReclaimResources(resources); 117 client_->ReclaimResources(resources);
95 } 118 }
(...skipping 11 matching lines...) Expand all
107 } 130 }
108 131
109 void GpuCompositorFrameSink::OnPrivateConnectionLost() { 132 void GpuCompositorFrameSink::OnPrivateConnectionLost() {
110 private_connection_lost_ = true; 133 private_connection_lost_ = true;
111 // Request destruction of |this| only if both connections are lost. 134 // Request destruction of |this| only if both connections are lost.
112 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( 135 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost(
113 support_.frame_sink_id(), client_connection_lost_); 136 support_.frame_sink_id(), client_connection_lost_);
114 } 137 }
115 138
116 } // namespace ui 139 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698