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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
16 #include "cc/output/begin_frame_args.h" | 16 #include "cc/output/begin_frame_args.h" |
17 #include "cc/scheduler/delay_based_time_source.h" | 17 #include "cc/scheduler/delay_based_time_source.h" |
18 #include "cc/scheduler/draw_result.h" | 18 #include "cc/scheduler/draw_result.h" |
19 #include "cc/scheduler/scheduler_settings.h" | 19 #include "cc/scheduler/scheduler_settings.h" |
20 #include "cc/scheduler/scheduler_state_machine.h" | 20 #include "cc/scheduler/scheduler_state_machine.h" |
| 21 #include "ui/gfx/frame_time.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
24 } | 25 } |
25 | 26 |
26 namespace cc { | 27 namespace cc { |
27 | 28 |
28 class SchedulerClient { | 29 class SchedulerClient { |
29 public: | 30 public: |
30 virtual void SetNeedsBeginFrame(bool enable) = 0; | 31 virtual void SetNeedsBeginFrame(bool enable) = 0; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 138 |
138 bool IsBeginMainFrameSent() const; | 139 bool IsBeginMainFrameSent() const; |
139 void SetContinuousPainting(bool continuous_painting) { | 140 void SetContinuousPainting(bool continuous_painting) { |
140 state_machine_.SetContinuousPainting(continuous_painting); | 141 state_machine_.SetContinuousPainting(continuous_painting); |
141 } | 142 } |
142 | 143 |
143 protected: | 144 protected: |
144 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { | 145 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { |
145 public: | 146 public: |
146 SyntheticBeginFrameSource(Scheduler* scheduler, | 147 SyntheticBeginFrameSource(Scheduler* scheduler, |
147 base::SingleThreadTaskRunner* task_runner); | 148 scoped_refptr<DelayBasedTimeSource>& time_source); |
148 virtual ~SyntheticBeginFrameSource(); | 149 virtual ~SyntheticBeginFrameSource(); |
149 | 150 |
150 // Updates the phase and frequency of the timer. | 151 // Updates the phase and frequency of the timer. |
151 void CommitVSyncParameters(base::TimeTicks timebase, | 152 void CommitVSyncParameters(base::TimeTicks timebase, |
152 base::TimeDelta interval); | 153 base::TimeDelta interval); |
153 | 154 |
154 // Activates future BeginFrames and, if activating, pushes the most | 155 // Activates future BeginFrames and, if activating, pushes the most |
155 // recently missed BeginFrame to the back of a retroactive queue. | 156 // recently missed BeginFrame to the back of a retroactive queue. |
156 void SetNeedsBeginFrame(bool needs_begin_frame, | 157 void SetNeedsBeginFrame(bool needs_begin_frame, |
157 std::deque<BeginFrameArgs>* begin_retro_frame_args); | 158 std::deque<BeginFrameArgs>* begin_retro_frame_args); |
(...skipping 11 matching lines...) Expand all Loading... |
169 Scheduler* scheduler_; | 170 Scheduler* scheduler_; |
170 scoped_refptr<DelayBasedTimeSource> time_source_; | 171 scoped_refptr<DelayBasedTimeSource> time_source_; |
171 }; | 172 }; |
172 | 173 |
173 Scheduler( | 174 Scheduler( |
174 SchedulerClient* client, | 175 SchedulerClient* client, |
175 const SchedulerSettings& scheduler_settings, | 176 const SchedulerSettings& scheduler_settings, |
176 int layer_tree_host_id, | 177 int layer_tree_host_id, |
177 const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner); | 178 const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner); |
178 | 179 |
| 180 virtual base::TimeTicks Now() const; |
| 181 |
179 const SchedulerSettings settings_; | 182 const SchedulerSettings settings_; |
180 SchedulerClient* client_; | 183 SchedulerClient* client_; |
181 int layer_tree_host_id_; | 184 int layer_tree_host_id_; |
182 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 185 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
183 | 186 |
184 base::TimeDelta vsync_interval_; | 187 base::TimeDelta vsync_interval_; |
185 base::TimeDelta estimated_parent_draw_time_; | 188 base::TimeDelta estimated_parent_draw_time_; |
186 | 189 |
187 bool last_set_needs_begin_frame_; | 190 bool last_set_needs_begin_frame_; |
188 bool begin_unthrottled_frame_posted_; | 191 bool begin_unthrottled_frame_posted_; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 void SetupSyntheticBeginFrames(); | 227 void SetupSyntheticBeginFrames(); |
225 | 228 |
226 base::WeakPtrFactory<Scheduler> weak_factory_; | 229 base::WeakPtrFactory<Scheduler> weak_factory_; |
227 | 230 |
228 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 231 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
229 }; | 232 }; |
230 | 233 |
231 } // namespace cc | 234 } // namespace cc |
232 | 235 |
233 #endif // CC_SCHEDULER_SCHEDULER_H_ | 236 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |