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

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

Issue 817603002: cc: Make scheduling be driven by vsync for android webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase compile errors. Created 5 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
« no previous file with comments | « cc/output/output_surface_client.h ('k') | 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 <string> 9 #include <string>
10 10
(...skipping 23 matching lines...) Expand all
34 public: 34 public:
35 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; 35 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0;
36 virtual void ScheduledActionSendBeginMainFrame() = 0; 36 virtual void ScheduledActionSendBeginMainFrame() = 0;
37 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; 37 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0;
38 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; 38 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0;
39 virtual void ScheduledActionAnimate() = 0; 39 virtual void ScheduledActionAnimate() = 0;
40 virtual void ScheduledActionCommit() = 0; 40 virtual void ScheduledActionCommit() = 0;
41 virtual void ScheduledActionActivateSyncTree() = 0; 41 virtual void ScheduledActionActivateSyncTree() = 0;
42 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; 42 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0;
43 virtual void ScheduledActionPrepareTiles() = 0; 43 virtual void ScheduledActionPrepareTiles() = 0;
44 virtual void ScheduledActionInvalidateOutputSurface() = 0;
44 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; 45 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0;
45 virtual base::TimeDelta DrawDurationEstimate() = 0; 46 virtual base::TimeDelta DrawDurationEstimate() = 0;
46 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; 47 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0;
47 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; 48 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0;
49 // TODO(sunnyps): Rename DidBeginImplFrameDeadline to DidFinishImplFrame.
48 virtual void DidBeginImplFrameDeadline() = 0; 50 virtual void DidBeginImplFrameDeadline() = 0;
49 virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) = 0; 51 virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) = 0;
50 virtual void SendBeginMainFrameNotExpectedSoon() = 0; 52 virtual void SendBeginMainFrameNotExpectedSoon() = 0;
51 53
52 protected: 54 protected:
53 virtual ~SchedulerClient() {} 55 virtual ~SchedulerClient() {}
54 }; 56 };
55 57
56 class Scheduler; 58 class Scheduler;
57 // This class exists to allow tests to override the frame source construction. 59 // This class exists to allow tests to override the frame source construction.
(...skipping 30 matching lines...) Expand all
88 task_runner, 90 task_runner,
89 external_begin_frame_source.Pass(), 91 external_begin_frame_source.Pass(),
90 &frame_sources_constructor)); 92 &frame_sources_constructor));
91 } 93 }
92 94
93 ~Scheduler() override; 95 ~Scheduler() override;
94 96
95 // BeginFrameObserverMixin 97 // BeginFrameObserverMixin
96 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; 98 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override;
97 99
100 void OnDrawForOutputSurface();
101
98 const SchedulerSettings& settings() const { return settings_; } 102 const SchedulerSettings& settings() const { return settings_; }
99 103
100 void CommitVSyncParameters(base::TimeTicks timebase, 104 void CommitVSyncParameters(base::TimeTicks timebase,
101 base::TimeDelta interval); 105 base::TimeDelta interval);
102 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); 106 void SetEstimatedParentDrawTime(base::TimeDelta draw_time);
103 107
104 void SetCanStart(); 108 void SetCanStart();
105 109
106 void SetVisible(bool visible); 110 void SetVisible(bool visible);
107 void SetCanDraw(bool can_draw); 111 void SetCanDraw(bool can_draw);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 209
206 base::TimeDelta estimated_parent_draw_time_; 210 base::TimeDelta estimated_parent_draw_time_;
207 211
208 std::deque<BeginFrameArgs> begin_retro_frame_args_; 212 std::deque<BeginFrameArgs> begin_retro_frame_args_;
209 BeginFrameArgs begin_impl_frame_args_; 213 BeginFrameArgs begin_impl_frame_args_;
210 SchedulerStateMachine::BeginImplFrameDeadlineMode 214 SchedulerStateMachine::BeginImplFrameDeadlineMode
211 begin_impl_frame_deadline_mode_; 215 begin_impl_frame_deadline_mode_;
212 216
213 base::Closure begin_retro_frame_closure_; 217 base::Closure begin_retro_frame_closure_;
214 base::Closure begin_impl_frame_deadline_closure_; 218 base::Closure begin_impl_frame_deadline_closure_;
215 base::Closure poll_for_draw_triggers_closure_;
216 base::Closure advance_commit_state_closure_; 219 base::Closure advance_commit_state_closure_;
217 base::CancelableClosure begin_retro_frame_task_; 220 base::CancelableClosure begin_retro_frame_task_;
218 base::CancelableClosure begin_impl_frame_deadline_task_; 221 base::CancelableClosure begin_impl_frame_deadline_task_;
219 base::CancelableClosure poll_for_draw_triggers_task_;
220 base::CancelableClosure advance_commit_state_task_; 222 base::CancelableClosure advance_commit_state_task_;
221 223
222 SchedulerStateMachine state_machine_; 224 SchedulerStateMachine state_machine_;
223 bool inside_process_scheduled_actions_; 225 bool inside_process_scheduled_actions_;
224 SchedulerStateMachine::Action inside_action_; 226 SchedulerStateMachine::Action inside_action_;
225 227
226 private: 228 private:
227 void ScheduleBeginImplFrameDeadline(); 229 void ScheduleBeginImplFrameDeadline();
228 void RescheduleBeginImplFrameDeadlineIfNeeded(); 230 void ScheduleBeginImplFrameDeadlineIfNeeded();
229 void SetupNextBeginFrameIfNeeded(); 231 void SetupNextBeginFrameIfNeeded();
230 void PostBeginRetroFrameIfNeeded(); 232 void PostBeginRetroFrameIfNeeded();
231 void SetupPollingMechanisms(); 233 void SetupPollingMechanisms();
232 void DrawAndSwapIfPossible(); 234 void DrawAndSwapIfPossible();
233 void ProcessScheduledActions(); 235 void ProcessScheduledActions();
234 bool CanCommitAndActivateBeforeDeadline() const; 236 bool CanCommitAndActivateBeforeDeadline() const;
235 void AdvanceCommitStateIfPossible(); 237 void AdvanceCommitStateIfPossible();
236 bool IsBeginMainFrameSentOrStarted() const; 238 bool IsBeginMainFrameSentOrStarted() const;
237 void BeginRetroFrame(); 239 void BeginRetroFrame();
240 void BeginImplFrameWithDeadline(const BeginFrameArgs& args);
241 void BeginImplFrameSynchronous(const BeginFrameArgs& args);
238 void BeginImplFrame(const BeginFrameArgs& args); 242 void BeginImplFrame(const BeginFrameArgs& args);
243 void FinishImplFrame();
239 void OnBeginImplFrameDeadline(); 244 void OnBeginImplFrameDeadline();
240 void PollForAnticipatedDrawTriggers();
241 void PollToAdvanceCommitState(); 245 void PollToAdvanceCommitState();
242 void UpdateActiveFrameSource(); 246 void UpdateActiveFrameSource();
243 247
244 base::TimeDelta EstimatedParentDrawTime() { 248 base::TimeDelta EstimatedParentDrawTime() {
245 return estimated_parent_draw_time_; 249 return estimated_parent_draw_time_;
246 } 250 }
247 251
248 bool IsInsideAction(SchedulerStateMachine::Action action) { 252 bool IsInsideAction(SchedulerStateMachine::Action action) {
249 return inside_action_ == action; 253 return inside_action_ == action;
250 } 254 }
251 255
252 base::WeakPtrFactory<Scheduler> weak_factory_; 256 base::WeakPtrFactory<Scheduler> weak_factory_;
253 257
254 friend class SchedulerFrameSourcesConstructor; 258 friend class SchedulerFrameSourcesConstructor;
255 friend class TestSchedulerFrameSourcesConstructor; 259 friend class TestSchedulerFrameSourcesConstructor;
256 260
257 DISALLOW_COPY_AND_ASSIGN(Scheduler); 261 DISALLOW_COPY_AND_ASSIGN(Scheduler);
258 }; 262 };
259 263
260 } // namespace cc 264 } // namespace cc
261 265
262 #endif // CC_SCHEDULER_SCHEDULER_H_ 266 #endif // CC_SCHEDULER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « cc/output/output_surface_client.h ('k') | cc/scheduler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698