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

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

Issue 2785103003: [cc] CompositorFrameSinkSupport: Defer BeginFrameAck of pending frames. (Closed)
Patch Set: add some comments, plumb SurfaceDiscarded. 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 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 #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 5 #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <unordered_set> 9 #include <unordered_set>
10 #include <vector> 10 #include <vector>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // that has |local_surface_id|. UpdateReferences() must be called on 61 // that has |local_surface_id|. UpdateReferences() must be called on
62 // |reference_tracker_| before calling this. Will add and remove top-level 62 // |reference_tracker_| before calling this. Will add and remove top-level
63 // root references if |display_| is not null. 63 // root references if |display_| is not null.
64 void UpdateSurfaceReferences(const SurfaceId& last_surface_id, 64 void UpdateSurfaceReferences(const SurfaceId& last_surface_id,
65 const LocalSurfaceId& local_surface_id); 65 const LocalSurfaceId& local_surface_id);
66 66
67 void AddTopLevelRootReference(const SurfaceId& surface_id); 67 void AddTopLevelRootReference(const SurfaceId& surface_id);
68 void RemoveTopLevelRootReference(const SurfaceId& surface_id); 68 void RemoveTopLevelRootReference(const SurfaceId& surface_id);
69 69
70 void DidReceiveCompositorFrameAck(); 70 void DidReceiveCompositorFrameAck();
71 void PendingFrameDiscarded();
71 72
72 // SurfaceFactoryClient implementation. 73 // SurfaceFactoryClient implementation.
73 void ReferencedSurfacesChanged( 74 void ReferencedSurfacesChanged(
74 const LocalSurfaceId& local_surface_id, 75 const LocalSurfaceId& local_surface_id,
75 const std::vector<SurfaceId>* active_referenced_surfaces, 76 const std::vector<SurfaceId>* active_referenced_surfaces,
76 const std::vector<SurfaceId>* pending_referenced_surfaces) override; 77 const std::vector<SurfaceId>* pending_referenced_surfaces) override;
77 void ReturnResources(const ReturnedResourceArray& resources) override; 78 void ReturnResources(const ReturnedResourceArray& resources) override;
78 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; 79 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override;
79 void WillDrawSurface(const LocalSurfaceId& local_surface_id, 80 void WillDrawSurface(const LocalSurfaceId& local_surface_id,
80 const gfx::Rect& damage_rect) override; 81 const gfx::Rect& damage_rect) override;
82 void PendingFrameActivated(const LocalSurfaceId& local_surface_id) override;
83 void SurfaceDiscarded(const LocalSurfaceId& local_surface_id) override;
81 84
82 // BeginFrameObserver implementation. 85 // BeginFrameObserver implementation.
83 void OnBeginFrame(const BeginFrameArgs& args) override; 86 void OnBeginFrame(const BeginFrameArgs& args) override;
84 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; 87 const BeginFrameArgs& LastUsedBeginFrameArgs() const override;
85 void OnBeginFrameSourcePausedChanged(bool paused) override; 88 void OnBeginFrameSourcePausedChanged(bool paused) override;
86 89
87 void UpdateNeedsBeginFramesInternal(); 90 void UpdateNeedsBeginFramesInternal();
91 void AcknowledgeBeginFrame(const BeginFrameAck& ack);
Fady Samuel 2017/03/31 00:09:02 nit: comment.
Eric Seckler 2017/03/31 15:24:03 Done.
92 void AcknowledgeLastBeginFrameWithoutUpdates();
Fady Samuel 2017/03/31 00:09:02 nit: comment.
Eric Seckler 2017/03/31 15:24:03 Done.
88 93
89 CompositorFrameSinkSupportClient* const client_; 94 CompositorFrameSinkSupportClient* const client_;
90 95
91 SurfaceManager* const surface_manager_; 96 SurfaceManager* const surface_manager_;
92 97
93 const FrameSinkId frame_sink_id_; 98 const FrameSinkId frame_sink_id_;
94 99
95 SurfaceFactory surface_factory_; 100 SurfaceFactory surface_factory_;
96 // Counts the number of CompositorFrames that have been submitted and have not 101 // Counts the number of CompositorFrames that have been submitted and have not
97 // yet received an ACK. 102 // yet received an ACK.
98 int ack_pending_count_ = 0; 103 int ack_pending_count_ = 0;
99 ReturnedResourceArray surface_returned_resources_; 104 ReturnedResourceArray surface_returned_resources_;
100 105
106 // Whether a CompositorFrame is currently pending to be activated.
107 bool has_pending_frame_ = false;
Fady Samuel 2017/03/31 00:09:02 Surface already knows this.
Eric Seckler 2017/03/31 15:24:03 not quite: CFSSupport only acknowledges when a Com
108 LocalSurfaceId surface_id_for_pending_frame_;
Fady Samuel 2017/03/31 00:09:02 Do we need this?
Eric Seckler 2017/03/31 15:24:03 yeah, see comment in SurfaceDiscarded: If we submi
109
101 // The begin frame source being observered. Null if none. 110 // The begin frame source being observered. Null if none.
102 BeginFrameSource* begin_frame_source_ = nullptr; 111 BeginFrameSource* begin_frame_source_ = nullptr;
103 112
104 // The last begin frame args generated by the begin frame source. 113 // The last begin frame args generated by the begin frame source.
105 BeginFrameArgs last_begin_frame_args_; 114 BeginFrameArgs last_begin_frame_args_;
106 115
116 // The BeginFrameAck that will be issued when the last submitted
117 // CompositorFrame is activated.
118 BeginFrameAck begin_frame_ack_for_pending_frame_;
Fady Samuel 2017/03/31 00:09:02 Maybe either make this base::Optional<BeginFrameAc
Eric Seckler 2017/03/31 15:24:03 base::Optional it is! modify-in-place might be an
119
120 // Whether the last BeginFrame was forwarded to the client.
121 bool last_begin_frame_sent_to_client_ = true;
122
123 uint32_t latest_confirmed_begin_frame_source_id_ = 0;
124 uint64_t latest_confirmed_begin_frame_sequence_number_ =
125 BeginFrameArgs::kInvalidFrameNumber;
126
107 // Whether a request for begin frames has been issued. 127 // Whether a request for begin frames has been issued.
108 bool needs_begin_frame_ = false; 128 bool client_needs_begin_frame_ = false;
109 129
110 // Whether or not a frame observer has been added. 130 // Whether or not a frame observer has been added.
111 bool added_frame_observer_ = false; 131 bool added_frame_observer_ = false;
112 132
113 // Track the surface references for the surface corresponding to this 133 // Track the surface references for the surface corresponding to this
114 // compositor frame sink. 134 // compositor frame sink.
115 ReferencedSurfaceTracker reference_tracker_; 135 ReferencedSurfaceTracker reference_tracker_;
116 136
117 const bool is_root_; 137 const bool is_root_;
118 138
(...skipping 10 matching lines...) Expand all
129 const bool handles_frame_sink_id_invalidation_; 149 const bool handles_frame_sink_id_invalidation_;
130 150
131 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; 151 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_;
132 152
133 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); 153 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport);
134 }; 154 };
135 155
136 } // namespace cc 156 } // namespace cc
137 157
138 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 158 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/compositor_frame_sink_support.cc » ('j') | cc/surfaces/compositor_frame_sink_support.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698