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

Side by Side Diff: cc/scheduler/scheduler.h

Issue 1765723002: Hoist begin frame sources out of scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler_remove_throttle_flag
Patch Set: Remove multiplexer Created 4 years, 9 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_SCHEDULER_SCHEDULER_H_ 5 #ifndef CC_SCHEDULER_SCHEDULER_H_
6 #define CC_SCHEDULER_SCHEDULER_H_ 6 #define CC_SCHEDULER_SCHEDULER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 virtual ~SchedulerClient() {} 53 virtual ~SchedulerClient() {}
54 }; 54 };
55 55
56 class CC_EXPORT Scheduler : public BeginFrameObserverBase { 56 class CC_EXPORT Scheduler : public BeginFrameObserverBase {
57 public: 57 public:
58 static scoped_ptr<Scheduler> Create( 58 static scoped_ptr<Scheduler> Create(
59 SchedulerClient* client, 59 SchedulerClient* client,
60 const SchedulerSettings& scheduler_settings, 60 const SchedulerSettings& scheduler_settings,
61 int layer_tree_host_id, 61 int layer_tree_host_id,
62 base::SingleThreadTaskRunner* task_runner, 62 base::SingleThreadTaskRunner* task_runner,
63 BeginFrameSource* external_frame_source, 63 BeginFrameSource* begin_frame_source,
64 scoped_ptr<CompositorTimingHistory> compositor_timing_history); 64 scoped_ptr<CompositorTimingHistory> compositor_timing_history);
65 65
66 ~Scheduler() override; 66 ~Scheduler() override;
67 67
68 // BeginFrameObserverBase 68 // BeginFrameObserverBase
69 void OnBeginFrameSourcePausedChanged(bool paused) override; 69 void OnBeginFrameSourcePausedChanged(bool paused) override;
70 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override; 70 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override;
71 71
72 void OnDrawForOutputSurface(bool resourceless_software_draw); 72 void OnDrawForOutputSurface(bool resourceless_software_draw);
73 73
74 const SchedulerSettings& settings() const { return settings_; } 74 const SchedulerSettings& settings() const { return settings_; }
75 75
76 void CommitVSyncParameters(base::TimeTicks timebase,
77 base::TimeDelta interval);
78 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); 76 void SetEstimatedParentDrawTime(base::TimeDelta draw_time);
79 77
80 void SetVisible(bool visible); 78 void SetVisible(bool visible);
81 bool visible() { return state_machine_.visible(); } 79 bool visible() { return state_machine_.visible(); }
82 void SetCanDraw(bool can_draw); 80 void SetCanDraw(bool can_draw);
83 void NotifyReadyToActivate(); 81 void NotifyReadyToActivate();
84 void NotifyReadyToDraw(); 82 void NotifyReadyToDraw();
85 83
86 void SetNeedsBeginMainFrame(); 84 void SetNeedsBeginMainFrame();
87 // Requests a single impl frame (after the current frame if there is one 85 // Requests a single impl frame (after the current frame if there is one
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 base::TimeTicks LastBeginImplFrameTime(); 133 base::TimeTicks LastBeginImplFrameTime();
136 134
137 void SetDeferCommits(bool defer_commits); 135 void SetDeferCommits(bool defer_commits);
138 136
139 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 137 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
140 void AsValueInto(base::trace_event::TracedValue* value) const override; 138 void AsValueInto(base::trace_event::TracedValue* value) const override;
141 139
142 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); 140 void SetChildrenNeedBeginFrames(bool children_need_begin_frames);
143 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); 141 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames);
144 142
145 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval);
146
147 protected: 143 protected:
148 Scheduler(SchedulerClient* client, 144 Scheduler(SchedulerClient* client,
149 const SchedulerSettings& scheduler_settings, 145 const SchedulerSettings& scheduler_settings,
150 int layer_tree_host_id, 146 int layer_tree_host_id,
151 base::SingleThreadTaskRunner* task_runner, 147 base::SingleThreadTaskRunner* task_runner,
152 BeginFrameSource* external_frame_source, 148 BeginFrameSource* begin_frame_source,
153 scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source,
154 scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source,
155 scoped_ptr<CompositorTimingHistory> compositor_timing_history); 149 scoped_ptr<CompositorTimingHistory> compositor_timing_history);
156 150
157 // Virtual for testing. 151 // Virtual for testing.
158 virtual base::TimeTicks Now() const; 152 virtual base::TimeTicks Now() const;
159 153
160 const SchedulerSettings settings_; 154 const SchedulerSettings settings_;
155 // Not owned.
161 SchedulerClient* client_; 156 SchedulerClient* client_;
162 int layer_tree_host_id_; 157 int layer_tree_host_id_;
163 base::SingleThreadTaskRunner* task_runner_; 158 base::SingleThreadTaskRunner* task_runner_;
164 BeginFrameSource* external_frame_source_;
165 scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source_;
166 scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source_;
167 159
168 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; 160 // Not owned.
169 bool observing_frame_source_; 161 BeginFrameSource* begin_frame_source_;
170 162 bool observing_begin_frame_source_;
171 base::TimeDelta authoritative_vsync_interval_;
172 base::TimeTicks last_vsync_timebase_;
173 163
174 scoped_ptr<CompositorTimingHistory> compositor_timing_history_; 164 scoped_ptr<CompositorTimingHistory> compositor_timing_history_;
175 base::TimeDelta estimated_parent_draw_time_; 165 base::TimeDelta estimated_parent_draw_time_;
176 166
177 std::deque<BeginFrameArgs> begin_retro_frame_args_; 167 std::deque<BeginFrameArgs> begin_retro_frame_args_;
178 SchedulerStateMachine::BeginImplFrameDeadlineMode 168 SchedulerStateMachine::BeginImplFrameDeadlineMode
179 begin_impl_frame_deadline_mode_; 169 begin_impl_frame_deadline_mode_;
180 BeginFrameTracker begin_impl_frame_tracker_; 170 BeginFrameTracker begin_impl_frame_tracker_;
181 BeginFrameArgs begin_main_frame_args_; 171 BeginFrameArgs begin_main_frame_args_;
182 172
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 void PollToAdvanceCommitState(); 207 void PollToAdvanceCommitState();
218 208
219 base::TimeDelta EstimatedParentDrawTime() { 209 base::TimeDelta EstimatedParentDrawTime() {
220 return estimated_parent_draw_time_; 210 return estimated_parent_draw_time_;
221 } 211 }
222 212
223 bool IsInsideAction(SchedulerStateMachine::Action action) { 213 bool IsInsideAction(SchedulerStateMachine::Action action) {
224 return inside_action_ == action; 214 return inside_action_ == action;
225 } 215 }
226 216
227 BeginFrameSource* primary_frame_source() {
228 if (settings_.use_external_begin_frame_source) {
229 DCHECK(external_frame_source_);
230 return external_frame_source_;
231 }
232 return synthetic_frame_source_.get();
233 }
234
235 base::WeakPtrFactory<Scheduler> weak_factory_; 217 base::WeakPtrFactory<Scheduler> weak_factory_;
236 218
237 DISALLOW_COPY_AND_ASSIGN(Scheduler); 219 DISALLOW_COPY_AND_ASSIGN(Scheduler);
238 }; 220 };
239 221
240 } // namespace cc 222 } // namespace cc
241 223
242 #endif // CC_SCHEDULER_SCHEDULER_H_ 224 #endif // CC_SCHEDULER_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698