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

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

Issue 2785103003: [cc] CompositorFrameSinkSupport: Defer BeginFrameAck of pending frames. (Closed)
Patch Set: 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;
81 83
82 // BeginFrameObserver implementation. 84 // BeginFrameObserver implementation.
83 void OnBeginFrame(const BeginFrameArgs& args) override; 85 void OnBeginFrame(const BeginFrameArgs& args) override;
84 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; 86 const BeginFrameArgs& LastUsedBeginFrameArgs() const override;
85 void OnBeginFrameSourcePausedChanged(bool paused) override; 87 void OnBeginFrameSourcePausedChanged(bool paused) override;
86 88
87 void UpdateNeedsBeginFramesInternal(); 89 void UpdateNeedsBeginFramesInternal();
90 void AcknowledgeBeginFrame(const BeginFrameAck& ack);
91 void AcknowledgeLastBeginFrameWithoutUpdates();
88 92
89 CompositorFrameSinkSupportClient* const client_; 93 CompositorFrameSinkSupportClient* const client_;
90 94
91 SurfaceManager* const surface_manager_; 95 SurfaceManager* const surface_manager_;
92 96
93 const FrameSinkId frame_sink_id_; 97 const FrameSinkId frame_sink_id_;
94 98
95 SurfaceFactory surface_factory_; 99 SurfaceFactory surface_factory_;
96 // Counts the number of CompositorFrames that have been submitted and have not 100 // Counts the number of CompositorFrames that have been submitted and have not
97 // yet received an ACK. 101 // yet received an ACK.
98 int ack_pending_count_ = 0; 102 int ack_pending_count_ = 0;
99 ReturnedResourceArray surface_returned_resources_; 103 ReturnedResourceArray surface_returned_resources_;
100 104
105 // Whether a CompositorFrame is currently pending to be activated.
106 bool has_pending_frame_ = false;
107
101 // The begin frame source being observered. Null if none. 108 // The begin frame source being observered. Null if none.
102 BeginFrameSource* begin_frame_source_ = nullptr; 109 BeginFrameSource* begin_frame_source_ = nullptr;
103 110
104 // The last begin frame args generated by the begin frame source. 111 // The last begin frame args generated by the begin frame source.
105 BeginFrameArgs last_begin_frame_args_; 112 BeginFrameArgs last_begin_frame_args_;
106 113
114 // The BeginFrameAck that will be issued when the last submitted
115 // CompositorFrame is activated.
116 BeginFrameAck begin_frame_ack_for_pending_frame_;
117
118 // Whether the last BeginFrame was forwarded to the client.
119 bool last_begin_frame_sent_to_client_ = true;
120
121 uint32_t latest_confirmed_begin_frame_source_id_ = 0;
122 uint64_t latest_confirmed_begin_frame_sequence_number_ =
123 BeginFrameArgs::kInvalidFrameNumber;
124
107 // Whether a request for begin frames has been issued. 125 // Whether a request for begin frames has been issued.
108 bool needs_begin_frame_ = false; 126 bool client_needs_begin_frame_ = false;
109 127
110 // Whether or not a frame observer has been added. 128 // Whether or not a frame observer has been added.
111 bool added_frame_observer_ = false; 129 bool added_frame_observer_ = false;
112 130
113 // Track the surface references for the surface corresponding to this 131 // Track the surface references for the surface corresponding to this
114 // compositor frame sink. 132 // compositor frame sink.
115 ReferencedSurfaceTracker reference_tracker_; 133 ReferencedSurfaceTracker reference_tracker_;
116 134
117 const bool is_root_; 135 const bool is_root_;
118 136
(...skipping 10 matching lines...) Expand all
129 const bool handles_frame_sink_id_invalidation_; 147 const bool handles_frame_sink_id_invalidation_;
130 148
131 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; 149 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_;
132 150
133 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); 151 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport);
134 }; 152 };
135 153
136 } // namespace cc 154 } // namespace cc
137 155
138 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 156 #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