Bug 1207412 - Make SystemTimeConverter use TimeStamp::Now() when converting times; r=karlt
authorBrian Birtles <birtles@gmail.com>
Mon, 26 Oct 2015 09:29:54 +0900
changeset 304610 c9af4f7acba9c7cb9c486c4343b3bad26e367925
parent 304609 076f95c512c459f9bd668222fc65b75f442ae4e0
child 304611 87b6b058c8ca3348c0d8335456dec95ce2160cd4
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1207412
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1207412 - Make SystemTimeConverter use TimeStamp::Now() when converting times; r=karlt
widget/SystemTimeConverter.h
--- a/widget/SystemTimeConverter.h
+++ b/widget/SystemTimeConverter.h
@@ -19,18 +19,17 @@ namespace mozilla {
 // This class handles wrapping of integer values and skew between the time
 // source and mozilla::TimeStamp values.
 //
 // It does this by using an historical reference time recorded in both time
 // scales (i.e. both as a numerical time value and as a TimeStamp).
 //
 // For performance reasons, this class is careful to minimize calls to the
 // native "current time" function (e.g. gdk_x11_server_get_time) since this can
-// be slow. Furthermore, it uses TimeStamp::NowLowRes instead of TimeStamp::Now
-// except when establishing the reference time.
+// be slow.
 template <typename Time>
 class SystemTimeConverter {
 public:
   SystemTimeConverter()
     : mReferenceTime(Time(0))
     , mReferenceTimeStamp() // Initializes to the null timestamp
     , mLastBackwardsSkewCheck(Time(0))
     , kTimeRange(std::numeric_limits<Time>::max())
@@ -44,25 +43,25 @@ public:
   mozilla::TimeStamp
   GetTimeStampFromSystemTime(Time aTime,
                              CurrentTimeGetter& aCurrentTimeGetter) {
     // If the reference time is not set, use the current time value to fill
     // it in.
     if (mReferenceTimeStamp.IsNull()) {
       UpdateReferenceTime(aTime, aCurrentTimeGetter);
     }
-    TimeStamp roughlyNow = TimeStamp::NowLoRes();
+    TimeStamp roughlyNow = TimeStamp::Now();
 
     // Check for skew between the source of Time values and TimeStamp values.
     // We do this by comparing two durations (both in ms):
     //
     // i.  The duration from the reference time to the passed-in time.
     //     (timeDelta in the diagram below)
     // ii. The duration from the reference timestamp to the current time
-    //     based on TimeStamp::NowLoRes.
+    //     based on TimeStamp::Now.
     //     (timeStampDelta in the diagram below)
     //
     // Normally, we'd expect (ii) to be slightly larger than (i) to account
     // for the time taken between generating the event and processing it.
     //
     // If (ii) - (i) is negative then the source of Time values is getting
     // "ahead" of TimeStamp. We call this "forwards" skew below.
     //
@@ -84,18 +83,17 @@ public:
     //                          |------timeStampDelta-------|
     //
     //                                                  |---|
     //                                               deltaFromNow
     //
     Time deltaFromNow;
     bool newer = IsTimeNewerThanTimestamp(aTime, roughlyNow, &deltaFromNow);
 
-    // TimeStamp::NowLoRes should be accurate to within 15.6ms so we need to
-    // be at least that generous when detecting clock skew.
+    // Tolerance when detecting clock skew.
     static const Time kTolerance = 30;
 
     // Check for forwards skew
     if (newer) {
       // Make aTime correspond to roughlyNow
       UpdateReferenceTime(aTime, roughlyNow);
 
       // We didn't have backwards skew so don't bother checking for