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

Side by Side Diff: components/viz/frame_sinks/gpu_root_compositor_frame_sink.cc

Issue 2807653003: Move Work From CompositorFrameSinkSupport() To Init() (Closed)
Patch Set: Set needs_sync_points Created 3 years, 8 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/viz/frame_sinks/gpu_root_compositor_frame_sink.h" 5 #include "components/viz/frame_sinks/gpu_root_compositor_frame_sink.h"
6 6
7 #include "cc/surfaces/compositor_frame_sink_support.h" 7 #include "cc/surfaces/compositor_frame_sink_support.h"
8 #include "cc/surfaces/display.h" 8 #include "cc/surfaces/display.h"
9 9
10 namespace viz { 10 namespace viz {
11 11
12 GpuRootCompositorFrameSink::GpuRootCompositorFrameSink( 12 GpuRootCompositorFrameSink::GpuRootCompositorFrameSink(
13 GpuCompositorFrameSinkDelegate* delegate, 13 GpuCompositorFrameSinkDelegate* delegate,
14 cc::SurfaceManager* surface_manager, 14 cc::SurfaceManager* surface_manager,
15 const cc::FrameSinkId& frame_sink_id, 15 const cc::FrameSinkId& frame_sink_id,
16 std::unique_ptr<cc::Display> display, 16 std::unique_ptr<cc::Display> display,
17 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, 17 std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
18 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request, 18 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request,
19 cc::mojom::MojoCompositorFrameSinkPrivateRequest 19 cc::mojom::MojoCompositorFrameSinkPrivateRequest
20 compositor_frame_sink_private_request, 20 compositor_frame_sink_private_request,
21 cc::mojom::MojoCompositorFrameSinkClientPtr client, 21 cc::mojom::MojoCompositorFrameSinkClientPtr client,
22 cc::mojom::DisplayPrivateAssociatedRequest display_private_request) 22 cc::mojom::DisplayPrivateAssociatedRequest display_private_request)
23 : delegate_(delegate), 23 : delegate_(delegate),
24 support_(base::MakeUnique<cc::CompositorFrameSinkSupport>( 24 support_(base::MakeUnique<cc::CompositorFrameSinkSupport>(
25 this, 25 this,
26 surface_manager,
27 frame_sink_id, 26 frame_sink_id,
28 true /* is_root */, 27 true /* is_root */,
29 true /* handles_frame_sink_id_invalidation */, 28 true /* handles_frame_sink_id_invalidation */)),
30 true /* needs_sync_points */)),
31 display_begin_frame_source_(std::move(begin_frame_source)), 29 display_begin_frame_source_(std::move(begin_frame_source)),
32 display_(std::move(display)), 30 display_(std::move(display)),
33 client_(std::move(client)), 31 client_(std::move(client)),
34 compositor_frame_sink_binding_(this, std::move(request)), 32 compositor_frame_sink_binding_(this, std::move(request)),
35 compositor_frame_sink_private_binding_( 33 compositor_frame_sink_private_binding_(
36 this, 34 this,
37 std::move(compositor_frame_sink_private_request)), 35 std::move(compositor_frame_sink_private_request)),
38 display_private_binding_(this, std::move(display_private_request)) { 36 display_private_binding_(this, std::move(display_private_request)) {
37 constexpr bool needs_sync_points = true;
38 support_->Init(surface_manager, needs_sync_points);
39 compositor_frame_sink_binding_.set_connection_error_handler( 39 compositor_frame_sink_binding_.set_connection_error_handler(
40 base::Bind(&GpuRootCompositorFrameSink::OnClientConnectionLost, 40 base::Bind(&GpuRootCompositorFrameSink::OnClientConnectionLost,
41 base::Unretained(this))); 41 base::Unretained(this)));
42 compositor_frame_sink_private_binding_.set_connection_error_handler( 42 compositor_frame_sink_private_binding_.set_connection_error_handler(
43 base::Bind(&GpuRootCompositorFrameSink::OnPrivateConnectionLost, 43 base::Bind(&GpuRootCompositorFrameSink::OnPrivateConnectionLost,
44 base::Unretained(this))); 44 base::Unretained(this)));
45 display_->Initialize(this, surface_manager); 45 display_->Initialize(this, surface_manager);
46 display_->SetVisible(true); 46 display_->SetVisible(true);
47 } 47 }
48 48
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 144
145 void GpuRootCompositorFrameSink::OnPrivateConnectionLost() { 145 void GpuRootCompositorFrameSink::OnPrivateConnectionLost() {
146 private_connection_lost_ = true; 146 private_connection_lost_ = true;
147 // Request destruction of |this| only if both connections are lost. 147 // Request destruction of |this| only if both connections are lost.
148 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(), 148 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(),
149 client_connection_lost_); 149 client_connection_lost_);
150 } 150 }
151 151
152 } // namespace viz 152 } // namespace viz
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698