| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SKY_SCHEDULER_SCHEDULER_H_ | |
| 6 #define SKY_SCHEDULER_SCHEDULER_H_ | |
| 7 | |
| 8 #include "base/single_thread_task_runner.h" | |
| 9 #include "base/time/time.h" | |
| 10 #include "sky/scheduler/timer.h" | |
| 11 | |
| 12 namespace sky { | |
| 13 | |
| 14 class Scheduler : public Timer::Client { | |
| 15 public: | |
| 16 class Client { | |
| 17 public: | |
| 18 virtual void BeginFrame(base::TimeTicks frame_time, | |
| 19 base::TimeTicks deadline) = 0; | |
| 20 | |
| 21 protected: | |
| 22 virtual ~Client(); | |
| 23 }; | |
| 24 | |
| 25 Scheduler(Client* client, | |
| 26 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | |
| 27 ~Scheduler(); | |
| 28 | |
| 29 void UpdateFrameDuration(base::TimeDelta estimate); | |
| 30 void UpdateVSync(const TimeInterval& vsync); | |
| 31 | |
| 32 void SetNeedsFrame(); | |
| 33 | |
| 34 private: | |
| 35 void UpdateTimerInterval(); | |
| 36 void OnTimerTick(base::TimeTicks now) override; | |
| 37 | |
| 38 Client* client_; | |
| 39 Timer timer_; | |
| 40 TimeInterval vsync_; | |
| 41 base::TimeDelta frame_duration_; | |
| 42 }; | |
| 43 } | |
| 44 | |
| 45 #endif // SKY_SCHEDULER_SCHEDULER_H_ | |
| OLD | NEW |