Chromium Code Reviews| Index: media/cast/cast_ntp_tick_clock.h |
| diff --git a/media/cast/cast_ntp_tick_clock.h b/media/cast/cast_ntp_tick_clock.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d13954b0707d832fbd54bd442c140cbd946a2172 |
| --- /dev/null |
| +++ b/media/cast/cast_ntp_tick_clock.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_CAST_CAST_NTP_TICK_CLOCK_H_ |
| +#define MEDIA_CAST_CAST_NTP_TICK_CLOCK_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/time/default_tick_clock.h" |
| +#include "base/time/tick_clock.h" |
| +#include "base/time/time.h" |
| +#include "media/cast/cast_defines.h" |
| + |
| +namespace media { |
| +namespace cast { |
| + |
| +// Class that provide the a TickTime relative to NTP. The base TickTime does not |
| +// reference a specific date. This version is number of ticks relative to 0h UTC |
| +// on 1 January 1900. |
| +// Note: We only synchronize with the system clock at creation time after that |
| +// we only use our relative difference this can result in a drift relative to |
| +// the system clock however this approach guarantees that our NTP time never |
| +// decrease. |
| + |
| +class CastNtpTickClock : public base::TickClock { |
| + public: |
| + CastNtpTickClock(); |
| + virtual ~CastNtpTickClock(); |
| + |
| + virtual base::TimeTicks NowTicks() OVERRIDE; |
| + |
| + protected: |
| + // Provided for testability. |
| + void SetTickClock(base::TickClock* tick_clock); |
| + |
| + private: |
| + base::DefaultTickClock default_tick_clock_; |
| + base::TickClock* tick_clock_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(CastNtpTickClock); |
| +}; |
| + |
| +} // namespace cast |
| +} // namespace media |
| + |
| +#endif // MEDIA_CAST_CAST_NTP_TICK_CLOCK_H_ |
| + |
| + |
|
jar (doing other things)
2013/10/25 01:13:54
nit: no need for trailing lines (ending linefeed i
|