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

Side by Side Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2612083002: DirectCompositorFrameSink Uses CompositorFrameSinkSupport (Closed)
Patch Set: DirectCompositorFrameSink implements ExternalBeginFrameSouceClient; Addressed comments Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "cc/surfaces/compositor_frame_sink_support.h" 5 #include "cc/surfaces/compositor_frame_sink_support.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/scheduler/begin_frame_source.h" 8 #include "cc/scheduler/begin_frame_source.h"
9 #include "cc/surfaces/compositor_frame_sink_support_client.h" 9 #include "cc/surfaces/compositor_frame_sink_support_client.h"
10 #include "cc/surfaces/display.h" 10 #include "cc/surfaces/display.h"
11 #include "cc/surfaces/surface.h" 11 #include "cc/surfaces/surface.h"
12 #include "cc/surfaces/surface_manager.h" 12 #include "cc/surfaces/surface_manager.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 CompositorFrameSinkSupport::CompositorFrameSinkSupport( 16 CompositorFrameSinkSupport::CompositorFrameSinkSupport(
17 CompositorFrameSinkSupportClient* client, 17 CompositorFrameSinkSupportClient* client,
18 SurfaceManager* surface_manager, 18 SurfaceManager* surface_manager,
19 const FrameSinkId& frame_sink_id, 19 const FrameSinkId& frame_sink_id,
20 std::unique_ptr<Display> display, 20 Display* display,
21 std::unique_ptr<BeginFrameSource> display_begin_frame_source) 21 std::unique_ptr<BeginFrameSource> display_begin_frame_source)
22 : client_(client), 22 : client_(client),
23 surface_manager_(surface_manager), 23 surface_manager_(surface_manager),
24 frame_sink_id_(frame_sink_id), 24 frame_sink_id_(frame_sink_id),
25 display_begin_frame_source_(std::move(display_begin_frame_source)), 25 display_begin_frame_source_(std::move(display_begin_frame_source)),
26 display_(std::move(display)), 26 display_(std::move(display)),
27 surface_factory_(frame_sink_id_, surface_manager_, this), 27 surface_factory_(frame_sink_id_, surface_manager_, this),
28 weak_factory_(this) { 28 weak_factory_(this) {
29 surface_manager_->RegisterFrameSinkId(frame_sink_id_); 29 surface_manager->RegisterFrameSinkId(frame_sink_id_);
30 surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this); 30 surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this);
31 31
32 if (display_) { 32 if (display_)
33 display_->Initialize(this, surface_manager_); 33 display_->Initialize(this, surface_manager_);
34 display_->SetVisible(true);
35 }
36 } 34 }
37 35
38 CompositorFrameSinkSupport::~CompositorFrameSinkSupport() { 36 CompositorFrameSinkSupport::~CompositorFrameSinkSupport() {
39 for (auto& child_frame_sink_id : child_frame_sinks_) { 37 for (auto& child_frame_sink_id : child_frame_sinks_) {
40 DCHECK(child_frame_sink_id.is_valid()); 38 DCHECK(child_frame_sink_id.is_valid());
41 surface_manager_->UnregisterFrameSinkHierarchy(frame_sink_id_, 39 surface_manager_->UnregisterFrameSinkHierarchy(frame_sink_id_,
42 child_frame_sink_id); 40 child_frame_sink_id);
43 } 41 }
44 // SurfaceFactory's destructor will attempt to return resources which will 42 // SurfaceFactory's destructor will attempt to return resources which will
45 // call back into here and access |client_| so we should destroy 43 // call back into here and access |client_| so we should destroy
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void CompositorFrameSinkSupport::RemoveChildFrameSink( 123 void CompositorFrameSinkSupport::RemoveChildFrameSink(
126 const FrameSinkId& child_frame_sink_id) { 124 const FrameSinkId& child_frame_sink_id) {
127 auto it = child_frame_sinks_.find(child_frame_sink_id); 125 auto it = child_frame_sinks_.find(child_frame_sink_id);
128 DCHECK(it != child_frame_sinks_.end()); 126 DCHECK(it != child_frame_sinks_.end());
129 DCHECK(it->is_valid()); 127 DCHECK(it->is_valid());
130 surface_manager_->UnregisterFrameSinkHierarchy(frame_sink_id_, 128 surface_manager_->UnregisterFrameSinkHierarchy(frame_sink_id_,
131 child_frame_sink_id); 129 child_frame_sink_id);
132 child_frame_sinks_.erase(it); 130 child_frame_sinks_.erase(it);
133 } 131 }
134 132
133 void CompositorFrameSinkSupport::SetNeedsSyncPoints(bool needs_sync_points) {
134 surface_factory_.set_needs_sync_points(needs_sync_points);
135 }
136
137 void CompositorFrameSinkSupport::ForceReclaimResources() {
138 if (local_frame_id_.is_valid())
139 surface_factory_.ClearSurface();
140 }
141
135 void CompositorFrameSinkSupport::DisplayOutputSurfaceLost() {} 142 void CompositorFrameSinkSupport::DisplayOutputSurfaceLost() {}
136 143
137 void CompositorFrameSinkSupport::DisplayWillDrawAndSwap( 144 void CompositorFrameSinkSupport::DisplayWillDrawAndSwap(
138 bool will_draw_and_swap, 145 bool will_draw_and_swap,
139 const RenderPassList& render_passes) {} 146 const RenderPassList& render_passes) {}
140 147
141 void CompositorFrameSinkSupport::DisplayDidDrawAndSwap() {} 148 void CompositorFrameSinkSupport::DisplayDidDrawAndSwap() {}
142 149
143 void CompositorFrameSinkSupport::ReturnResources( 150 void CompositorFrameSinkSupport::ReturnResources(
144 const ReturnedResourceArray& resources) { 151 const ReturnedResourceArray& resources) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return; 200 return;
194 201
195 added_frame_observer_ = needs_begin_frame_; 202 added_frame_observer_ = needs_begin_frame_;
196 if (needs_begin_frame_) 203 if (needs_begin_frame_)
197 begin_frame_source_->AddObserver(this); 204 begin_frame_source_->AddObserver(this);
198 else 205 else
199 begin_frame_source_->RemoveObserver(this); 206 begin_frame_source_->RemoveObserver(this);
200 } 207 }
201 208
202 } // namespace cc 209 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698