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

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

Issue 2612083002: DirectCompositorFrameSink Uses CompositorFrameSinkSupport (Closed)
Patch Set: Addressed 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 "services/ui/surfaces/gpu_compositor_frame_sink.h" 5 #include "services/ui/surfaces/gpu_compositor_frame_sink.h"
6 6
7 #include "cc/surfaces/surface_reference.h" 7 #include "cc/surfaces/surface_reference.h"
8 #include "services/ui/surfaces/display_compositor.h" 8 #include "services/ui/surfaces/display_compositor.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 GpuCompositorFrameSink::GpuCompositorFrameSink( 12 GpuCompositorFrameSink::GpuCompositorFrameSink(
13 DisplayCompositor* display_compositor, 13 DisplayCompositor* display_compositor,
14 const cc::FrameSinkId& frame_sink_id, 14 const cc::FrameSinkId& frame_sink_id,
15 std::unique_ptr<cc::Display> display, 15 std::unique_ptr<cc::Display> display,
16 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, 16 std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
17 cc::mojom::MojoCompositorFrameSinkPrivateRequest 17 cc::mojom::MojoCompositorFrameSinkPrivateRequest
18 compositor_frame_sink_private_request, 18 compositor_frame_sink_private_request,
19 cc::mojom::MojoCompositorFrameSinkClientPtr client) 19 cc::mojom::MojoCompositorFrameSinkClientPtr client)
20 : display_compositor_(display_compositor), 20 : display_compositor_(display_compositor),
21 support_(this, 21 support_(this,
22 display_compositor->manager(), 22 display_compositor->manager(),
23 frame_sink_id, 23 frame_sink_id,
24 std::move(display), 24 display.get()),
25 std::move(begin_frame_source)), 25 display_(std::move(display)),
26 display_begin_frame_source_(std::move(begin_frame_source)),
26 surface_tracker_(frame_sink_id), 27 surface_tracker_(frame_sink_id),
27 client_(std::move(client)), 28 client_(std::move(client)),
28 compositor_frame_sink_private_binding_( 29 compositor_frame_sink_private_binding_(
29 this, 30 this,
30 std::move(compositor_frame_sink_private_request)) { 31 std::move(compositor_frame_sink_private_request)) {
31 compositor_frame_sink_private_binding_.set_connection_error_handler( 32 compositor_frame_sink_private_binding_.set_connection_error_handler(
32 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, 33 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost,
33 base::Unretained(this))); 34 base::Unretained(this)));
35
36 if (display_.get())
37 display_->SetVisible(true);
34 } 38 }
35 39
36 GpuCompositorFrameSink::~GpuCompositorFrameSink() { 40 GpuCompositorFrameSink::~GpuCompositorFrameSink() {
37 // For display root surfaces, remove the reference from top level root to 41 // For display root surfaces, remove the reference from top level root to
38 // indicate the display root surface is no longer visible. 42 // indicate the display root surface is no longer visible.
39 if (support_.display() && surface_tracker_.current_surface_id().is_valid()) { 43 if (support_.display() && surface_tracker_.current_surface_id().is_valid()) {
40 const cc::SurfaceId top_level_root_surface_id = 44 const cc::SurfaceId top_level_root_surface_id =
41 display_compositor_->manager()->GetRootSurfaceId(); 45 display_compositor_->manager()->GetRootSurfaceId();
42 std::vector<cc::SurfaceReference> references_to_remove{cc::SurfaceReference( 46 std::vector<cc::SurfaceReference> references_to_remove{cc::SurfaceReference(
43 top_level_root_surface_id, surface_tracker_.current_surface_id())}; 47 top_level_root_surface_id, surface_tracker_.current_surface_id())};
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 145 }
142 146
143 void GpuCompositorFrameSink::OnPrivateConnectionLost() { 147 void GpuCompositorFrameSink::OnPrivateConnectionLost() {
144 private_connection_lost_ = true; 148 private_connection_lost_ = true;
145 // Request destruction of |this| only if both connections are lost. 149 // Request destruction of |this| only if both connections are lost.
146 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( 150 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost(
147 support_.frame_sink_id(), client_connection_lost_); 151 support_.frame_sink_id(), client_connection_lost_);
148 } 152 }
149 153
150 } // namespace ui 154 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698