Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 COMPONENTS_SCHEDULER_RENDERER_COARSE_DURATION_TIMER_H_ | |
| 6 #define COMPONENTS_SCHEDULER_RENDERER_COARSE_DURATION_TIMER_H_ | |
| 7 | |
| 8 #include "base/message_loop/message_loop.h" | |
| 9 #include "base/optional.h" | |
| 10 #include "base/time/time.h" | |
| 11 | |
| 12 namespace scheduler { | |
| 13 | |
| 14 // TODO - add locking things. | |
|
tdresser
2016/05/30 19:07:46
^
| |
| 15 class CoarseDurationTimer : public base::MessageLoop::RecentTimeObserver { | |
| 16 public: | |
| 17 // RecentTimeObserver implementation: | |
| 18 void OnUpdateRecentTime(base::TimeTicks time) override; | |
| 19 | |
| 20 void BeginInterval(); | |
| 21 base::TimeDelta EndInterval(); | |
| 22 base::TimeTicks most_recent_time() { return most_recent_time_; } | |
| 23 | |
| 24 private: | |
| 25 enum class State { | |
| 26 OUTSIDE_INTERVAL, | |
| 27 WITHIN_INTERVAL_NEEDS_START, | |
| 28 WITHIN_INTERVAL | |
| 29 }; | |
| 30 | |
| 31 State state_; | |
| 32 base::TimeTicks start_time_; | |
| 33 base::TimeTicks most_recent_time_; | |
| 34 }; | |
| 35 | |
| 36 } // namespace scheduler | |
| 37 | |
| 38 #endif // COMPONENTS_SCHEDULER_RENDERER_COARSE_DURATION_TIMER_H_ | |
| OLD | NEW |