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

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

Issue 2392113003: Reland of cc: Remove frame queuing from the scheduler. (Closed)
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « no previous file | cc/scheduler/scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 class CC_EXPORT Scheduler : public BeginFrameObserverBase { 55 class CC_EXPORT Scheduler : public BeginFrameObserverBase {
56 public: 56 public:
57 Scheduler(SchedulerClient* client, 57 Scheduler(SchedulerClient* client,
58 const SchedulerSettings& scheduler_settings, 58 const SchedulerSettings& scheduler_settings,
59 int layer_tree_host_id, 59 int layer_tree_host_id,
60 base::SingleThreadTaskRunner* task_runner, 60 base::SingleThreadTaskRunner* task_runner,
61 std::unique_ptr<CompositorTimingHistory> compositor_timing_history); 61 std::unique_ptr<CompositorTimingHistory> compositor_timing_history);
62 ~Scheduler() override; 62 ~Scheduler() override;
63 63
64 // This is needed so that the scheduler doesn't perform spurious actions while
65 // the compositor is being torn down.
66 void Stop();
67
64 // BeginFrameObserverBase 68 // BeginFrameObserverBase
65 void OnBeginFrameSourcePausedChanged(bool paused) override; 69 void OnBeginFrameSourcePausedChanged(bool paused) override;
66 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override; 70 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override;
67 71
68 void OnDrawForCompositorFrameSink(bool resourceless_software_draw); 72 void OnDrawForCompositorFrameSink(bool resourceless_software_draw);
69 73
70 const SchedulerSettings& settings() const { return settings_; } 74 const SchedulerSettings& settings() const { return settings_; }
71 75
72 void SetVisible(bool visible); 76 void SetVisible(bool visible);
73 bool visible() { return state_machine_.visible(); } 77 bool visible() { return state_machine_.visible(); }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 SchedulerClient* client_; 147 SchedulerClient* client_;
144 int layer_tree_host_id_; 148 int layer_tree_host_id_;
145 base::SingleThreadTaskRunner* task_runner_; 149 base::SingleThreadTaskRunner* task_runner_;
146 150
147 // Not owned. May be null. 151 // Not owned. May be null.
148 BeginFrameSource* begin_frame_source_; 152 BeginFrameSource* begin_frame_source_;
149 bool observing_begin_frame_source_; 153 bool observing_begin_frame_source_;
150 154
151 std::unique_ptr<CompositorTimingHistory> compositor_timing_history_; 155 std::unique_ptr<CompositorTimingHistory> compositor_timing_history_;
152 156
153 std::deque<BeginFrameArgs> begin_retro_frame_args_;
154 SchedulerStateMachine::BeginImplFrameDeadlineMode 157 SchedulerStateMachine::BeginImplFrameDeadlineMode
155 begin_impl_frame_deadline_mode_; 158 begin_impl_frame_deadline_mode_;
156 BeginFrameTracker begin_impl_frame_tracker_; 159 BeginFrameTracker begin_impl_frame_tracker_;
157 BeginFrameArgs begin_main_frame_args_; 160 BeginFrameArgs begin_main_frame_args_;
158 161
159 base::Closure begin_retro_frame_closure_;
160 base::Closure begin_impl_frame_deadline_closure_; 162 base::Closure begin_impl_frame_deadline_closure_;
161 base::CancelableClosure begin_retro_frame_task_;
162 base::CancelableClosure begin_impl_frame_deadline_task_; 163 base::CancelableClosure begin_impl_frame_deadline_task_;
164 base::CancelableClosure missed_begin_frame_task_;
163 165
164 SchedulerStateMachine state_machine_; 166 SchedulerStateMachine state_machine_;
165 bool inside_process_scheduled_actions_; 167 bool inside_process_scheduled_actions_;
166 SchedulerStateMachine::Action inside_action_; 168 SchedulerStateMachine::Action inside_action_;
167 169
170 bool stopped_;
171
168 private: 172 private:
169 void ScheduleBeginImplFrameDeadline(); 173 void ScheduleBeginImplFrameDeadline();
170 void ScheduleBeginImplFrameDeadlineIfNeeded(); 174 void ScheduleBeginImplFrameDeadlineIfNeeded();
171 void BeginImplFrameNotExpectedSoon(); 175 void BeginImplFrameNotExpectedSoon();
172 void SetupNextBeginFrameIfNeeded(); 176 void SetupNextBeginFrameIfNeeded();
173 void PostBeginRetroFrameIfNeeded();
174 void DrawAndSwapIfPossible(); 177 void DrawAndSwapIfPossible();
175 void DrawAndSwapForced(); 178 void DrawAndSwapForced();
176 void ProcessScheduledActions(); 179 void ProcessScheduledActions();
177 void UpdateCompositorTimingHistoryRecordingEnabled(); 180 void UpdateCompositorTimingHistoryRecordingEnabled();
178 bool ShouldRecoverMainLatency(const BeginFrameArgs& args, 181 bool ShouldRecoverMainLatency(const BeginFrameArgs& args,
179 bool can_activate_before_deadline) const; 182 bool can_activate_before_deadline) const;
180 bool ShouldRecoverImplLatency(const BeginFrameArgs& args, 183 bool ShouldRecoverImplLatency(const BeginFrameArgs& args,
181 bool can_activate_before_deadline) const; 184 bool can_activate_before_deadline) const;
182 bool CanBeginMainFrameAndActivateBeforeDeadline( 185 bool CanBeginMainFrameAndActivateBeforeDeadline(
183 const BeginFrameArgs& args, 186 const BeginFrameArgs& args,
184 base::TimeDelta bmf_to_activate_estimate) const; 187 base::TimeDelta bmf_to_activate_estimate) const;
185 void AdvanceCommitStateIfPossible(); 188 void AdvanceCommitStateIfPossible();
186 bool IsBeginMainFrameSentOrStarted() const; 189 bool IsBeginMainFrameSentOrStarted() const;
187 void BeginRetroFrame();
188 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); 190 void BeginImplFrameWithDeadline(const BeginFrameArgs& args);
189 void BeginImplFrameSynchronous(const BeginFrameArgs& args); 191 void BeginImplFrameSynchronous(const BeginFrameArgs& args);
190 void BeginImplFrame(const BeginFrameArgs& args); 192 void BeginImplFrame(const BeginFrameArgs& args);
191 void FinishImplFrame(); 193 void FinishImplFrame();
192 void OnBeginImplFrameDeadline(); 194 void OnBeginImplFrameDeadline();
193 void PollToAdvanceCommitState(); 195 void PollToAdvanceCommitState();
194 196
195 bool IsInsideAction(SchedulerStateMachine::Action action) { 197 bool IsInsideAction(SchedulerStateMachine::Action action) {
196 return inside_action_ == action; 198 return inside_action_ == action;
197 } 199 }
198 200
199 base::WeakPtrFactory<Scheduler> weak_factory_; 201 base::WeakPtrFactory<Scheduler> weak_factory_;
200 202
201 DISALLOW_COPY_AND_ASSIGN(Scheduler); 203 DISALLOW_COPY_AND_ASSIGN(Scheduler);
202 }; 204 };
203 205
204 } // namespace cc 206 } // namespace cc
205 207
206 #endif // CC_SCHEDULER_SCHEDULER_H_ 208 #endif // CC_SCHEDULER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/scheduler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698