Chromium Code Reviews| Index: cc/scheduler/delay_based_time_source.h |
| diff --git a/cc/scheduler/delay_based_time_source.h b/cc/scheduler/delay_based_time_source.h |
| index 99df6dbafe6d42f49b0ffe4772f7125a5ccd91fb..eba3f9b960b2af9d23b9b5525c4d5226a6196018 100644 |
| --- a/cc/scheduler/delay_based_time_source.h |
| +++ b/cc/scheduler/delay_based_time_source.h |
| @@ -19,13 +19,13 @@ class SingleThreadTaskRunner; |
| } |
| namespace cc { |
| - |
| -class CC_EXPORT TimeSourceClient { |
| +class CC_EXPORT DelayBasedTimeSourceClient { |
| public: |
| + virtual void OnMissedTick() = 0; |
| virtual void OnTimerTick() = 0; |
|
mithro-old
2015/06/30 08:11:52
I feel like these callbacks should just take a tim
|
| protected: |
| - virtual ~TimeSourceClient() {} |
| + virtual ~DelayBasedTimeSourceClient() {} |
| }; |
| // This timer implements a time source that achieves the specified interval |
| @@ -41,23 +41,21 @@ class CC_EXPORT DelayBasedTimeSource { |
| virtual ~DelayBasedTimeSource(); |
| - virtual void SetClient(TimeSourceClient* client); |
| + void SetClient(DelayBasedTimeSourceClient* client); |
| + |
| + void SetTimebaseAndInterval(base::TimeTicks timebase, |
| + base::TimeDelta interval); |
| - // TimeSource implementation |
| - virtual void SetTimebaseAndInterval(base::TimeTicks timebase, |
| - base::TimeDelta interval); |
| - base::TimeDelta Interval() const { return next_parameters_.interval; } |
| + base::TimeDelta Interval() const; |
| - virtual base::TimeTicks SetActive(bool active); |
| - virtual bool Active() const; |
| + void SetActive(bool active); |
| + bool Active() const; |
| // Get the last and next tick times. NextTickTime() returns null when |
| // inactive. |
| - virtual base::TimeTicks LastTickTime() const; |
| - virtual base::TimeTicks NextTickTime() const; |
| - |
| - // Virtual for testing. |
| - virtual base::TimeTicks Now() const; |
| + base::TimeTicks LastTickTime() const; |
| + base::TimeTicks MissedTickTime() const; |
| + base::TimeTicks NextTickTime() const; |
| virtual void AsValueInto(base::trace_event::TracedValue* dict) const; |
| @@ -65,28 +63,26 @@ class CC_EXPORT DelayBasedTimeSource { |
| DelayBasedTimeSource(base::TimeDelta interval, |
| base::SingleThreadTaskRunner* task_runner); |
| + // Virtual for testing. |
| + virtual base::TimeTicks Now() const; |
| virtual std::string TypeString() const; |
| - base::TimeTicks NextTickTarget(base::TimeTicks now); |
| + base::TimeTicks NextTickTarget(base::TimeTicks now) const; |
| + |
| void PostNextTickTask(base::TimeTicks now); |
| - void OnTimerFired(); |
| + void ResetTickTask(base::TimeTicks now); |
| + |
| + void OnMissedTick(); |
| + void OnTimerTick(); |
| - struct Parameters { |
| - Parameters(base::TimeDelta interval, base::TimeTicks tick_target) |
| - : interval(interval), tick_target(tick_target) {} |
| - base::TimeDelta interval; |
| - base::TimeTicks tick_target; |
| - }; |
| + DelayBasedTimeSourceClient* client_; |
| - TimeSourceClient* client_; |
| base::TimeTicks last_tick_time_; |
| + base::TimeTicks missed_tick_time_; |
| + base::TimeTicks next_tick_time_; |
| - // current_parameters_ should only be written by PostNextTickTask. |
| - // next_parameters_ will take effect on the next call to PostNextTickTask. |
| - // Maintaining a pending set of parameters allows NextTickTime() to always |
| - // reflect the actual time we expect OnTimerFired to be called. |
|
mithro-old
2015/06/30 08:11:52
Is this still preserved? I assume there was a test
|
| - Parameters current_parameters_; |
| - Parameters next_parameters_; |
| + base::TimeTicks timebase_; |
| + base::TimeDelta interval_; |
| bool active_; |