OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 virtual void ScheduledActionCommit() = 0; | 39 virtual void ScheduledActionCommit() = 0; |
40 virtual void ScheduledActionUpdateVisibleTiles() = 0; | 40 virtual void ScheduledActionUpdateVisibleTiles() = 0; |
41 virtual void ScheduledActionActivateSyncTree() = 0; | 41 virtual void ScheduledActionActivateSyncTree() = 0; |
42 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 42 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
43 virtual void ScheduledActionManageTiles() = 0; | 43 virtual void ScheduledActionManageTiles() = 0; |
44 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 44 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; |
45 virtual base::TimeDelta DrawDurationEstimate() = 0; | 45 virtual base::TimeDelta DrawDurationEstimate() = 0; |
46 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; | 46 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; |
47 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; | 47 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; |
48 virtual void DidBeginImplFrameDeadline() = 0; | 48 virtual void DidBeginImplFrameDeadline() = 0; |
| 49 virtual void SendBeginFrameToChildren(const BeginFrameArgs& args) = 0; |
49 | 50 |
50 protected: | 51 protected: |
51 virtual ~SchedulerClient() {} | 52 virtual ~SchedulerClient() {} |
52 }; | 53 }; |
53 | 54 |
54 class CC_EXPORT Scheduler { | 55 class CC_EXPORT Scheduler { |
55 public: | 56 public: |
56 static scoped_ptr<Scheduler> Create( | 57 static scoped_ptr<Scheduler> Create( |
57 SchedulerClient* client, | 58 SchedulerClient* client, |
58 const SchedulerSettings& scheduler_settings, | 59 const SchedulerSettings& scheduler_settings, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 base::TimeTicks LastBeginImplFrameTime(); | 127 base::TimeTicks LastBeginImplFrameTime(); |
127 | 128 |
128 void BeginFrame(const BeginFrameArgs& args); | 129 void BeginFrame(const BeginFrameArgs& args); |
129 | 130 |
130 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 131 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
131 | 132 |
132 void SetContinuousPainting(bool continuous_painting) { | 133 void SetContinuousPainting(bool continuous_painting) { |
133 state_machine_.SetContinuousPainting(continuous_painting); | 134 state_machine_.SetContinuousPainting(continuous_painting); |
134 } | 135 } |
135 | 136 |
| 137 // SetChildrenNeedBeginFrames() is only used when this Scheduler is acting |
| 138 // as the publisher. |
| 139 void SetChildrenNeedBeginFrames(bool need_begin_frame); |
| 140 void SetAuthoritativeVSyncInterval(base::TimeDelta interval); |
| 141 |
136 protected: | 142 protected: |
137 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { | 143 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { |
138 public: | 144 public: |
139 SyntheticBeginFrameSource(Scheduler* scheduler, | 145 SyntheticBeginFrameSource(Scheduler* scheduler, |
140 base::SingleThreadTaskRunner* task_runner); | 146 base::SingleThreadTaskRunner* task_runner); |
141 virtual ~SyntheticBeginFrameSource(); | 147 virtual ~SyntheticBeginFrameSource(); |
142 | 148 |
143 // Updates the phase and frequency of the timer. | 149 // Updates the phase and frequency of the timer. |
144 void CommitVSyncParameters(base::TimeTicks timebase, | 150 void CommitVSyncParameters(base::TimeTicks timebase, |
145 base::TimeDelta interval); | 151 base::TimeDelta interval); |
(...skipping 21 matching lines...) Expand all Loading... |
167 const SchedulerSettings& scheduler_settings, | 173 const SchedulerSettings& scheduler_settings, |
168 int layer_tree_host_id, | 174 int layer_tree_host_id, |
169 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 175 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
170 | 176 |
171 const SchedulerSettings settings_; | 177 const SchedulerSettings settings_; |
172 SchedulerClient* client_; | 178 SchedulerClient* client_; |
173 int layer_tree_host_id_; | 179 int layer_tree_host_id_; |
174 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 180 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
175 | 181 |
176 base::TimeDelta vsync_interval_; | 182 base::TimeDelta vsync_interval_; |
| 183 base::TimeDelta authoritative_vsync_interval_; |
| 184 base::TimeTicks last_timebase_; |
| 185 |
177 base::TimeDelta estimated_parent_draw_time_; | 186 base::TimeDelta estimated_parent_draw_time_; |
178 | 187 |
179 bool last_set_needs_begin_frame_; | 188 bool last_set_needs_begin_frame_; |
180 bool begin_unthrottled_frame_posted_; | 189 bool begin_unthrottled_frame_posted_; |
181 bool begin_retro_frame_posted_; | 190 bool begin_retro_frame_posted_; |
182 std::deque<BeginFrameArgs> begin_retro_frame_args_; | 191 std::deque<BeginFrameArgs> begin_retro_frame_args_; |
183 BeginFrameArgs begin_impl_frame_args_; | 192 BeginFrameArgs begin_impl_frame_args_; |
184 | 193 |
185 scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; | 194 scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; |
186 | 195 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 241 } |
233 | 242 |
234 base::WeakPtrFactory<Scheduler> weak_factory_; | 243 base::WeakPtrFactory<Scheduler> weak_factory_; |
235 | 244 |
236 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 245 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
237 }; | 246 }; |
238 | 247 |
239 } // namespace cc | 248 } // namespace cc |
240 | 249 |
241 #endif // CC_SCHEDULER_SCHEDULER_H_ | 250 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |