Chromium Code Reviews| 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" | |
|
Sami
2014/08/19 18:45:04
Not sure why you needed to add this include here?
mithro-old
2014/08/21 17:39:18
Removed.
| |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 namespace debug { | 24 namespace debug { |
| 24 class ConvertableToTraceFormat; | 25 class ConvertableToTraceFormat; |
| 25 } | 26 } |
| 26 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace cc { | 30 namespace cc { |
| 30 | 31 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 | 148 |
| 148 bool IsBeginMainFrameSent() const; | 149 bool IsBeginMainFrameSent() const; |
| 149 void SetContinuousPainting(bool continuous_painting) { | 150 void SetContinuousPainting(bool continuous_painting) { |
| 150 state_machine_.SetContinuousPainting(continuous_painting); | 151 state_machine_.SetContinuousPainting(continuous_painting); |
| 151 } | 152 } |
| 152 | 153 |
| 153 protected: | 154 protected: |
| 154 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { | 155 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { |
| 155 public: | 156 public: |
| 156 SyntheticBeginFrameSource(Scheduler* scheduler, | 157 SyntheticBeginFrameSource(Scheduler* scheduler, |
| 157 base::SingleThreadTaskRunner* task_runner); | 158 scoped_refptr<DelayBasedTimeSource> time_source); |
| 158 virtual ~SyntheticBeginFrameSource(); | 159 virtual ~SyntheticBeginFrameSource(); |
| 159 | 160 |
| 160 // Updates the phase and frequency of the timer. | 161 // Updates the phase and frequency of the timer. |
| 161 void CommitVSyncParameters(base::TimeTicks timebase, | 162 void CommitVSyncParameters(base::TimeTicks timebase, |
| 162 base::TimeDelta interval); | 163 base::TimeDelta interval); |
| 163 | 164 |
| 164 // Activates future BeginFrames and, if activating, pushes the most | 165 // Activates future BeginFrames and, if activating, pushes the most |
| 165 // recently missed BeginFrame to the back of a retroactive queue. | 166 // recently missed BeginFrame to the back of a retroactive queue. |
| 166 void SetNeedsBeginFrame(bool needs_begin_frame, | 167 void SetNeedsBeginFrame(bool needs_begin_frame, |
| 167 std::deque<BeginFrameArgs>* begin_retro_frame_args); | 168 std::deque<BeginFrameArgs>* begin_retro_frame_args); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 179 Scheduler* scheduler_; | 180 Scheduler* scheduler_; |
| 180 scoped_refptr<DelayBasedTimeSource> time_source_; | 181 scoped_refptr<DelayBasedTimeSource> time_source_; |
| 181 }; | 182 }; |
| 182 | 183 |
| 183 Scheduler( | 184 Scheduler( |
| 184 SchedulerClient* client, | 185 SchedulerClient* client, |
| 185 const SchedulerSettings& scheduler_settings, | 186 const SchedulerSettings& scheduler_settings, |
| 186 int layer_tree_host_id, | 187 int layer_tree_host_id, |
| 187 const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner); | 188 const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner); |
| 188 | 189 |
| 190 virtual base::TimeTicks Now() const; | |
|
Sami
2014/08/19 18:45:04
bikeshed: I'd prefer a more descriptive name like
mithro-old
2014/08/21 17:39:18
I'm worried it will be to easy to confuse CurrentF
| |
| 191 | |
| 189 const SchedulerSettings settings_; | 192 const SchedulerSettings settings_; |
| 190 SchedulerClient* client_; | 193 SchedulerClient* client_; |
| 191 int layer_tree_host_id_; | 194 int layer_tree_host_id_; |
| 192 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 195 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
| 193 | 196 |
| 194 base::TimeDelta vsync_interval_; | 197 base::TimeDelta vsync_interval_; |
| 195 base::TimeDelta estimated_parent_draw_time_; | 198 base::TimeDelta estimated_parent_draw_time_; |
| 196 | 199 |
| 197 bool last_set_needs_begin_frame_; | 200 bool last_set_needs_begin_frame_; |
| 198 bool begin_unthrottled_frame_posted_; | 201 bool begin_unthrottled_frame_posted_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 void SetupSyntheticBeginFrames(); | 237 void SetupSyntheticBeginFrames(); |
| 235 | 238 |
| 236 base::WeakPtrFactory<Scheduler> weak_factory_; | 239 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 237 | 240 |
| 238 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 241 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 239 }; | 242 }; |
| 240 | 243 |
| 241 } // namespace cc | 244 } // namespace cc |
| 242 | 245 |
| 243 #endif // CC_SCHEDULER_SCHEDULER_H_ | 246 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |