Bug 1427870 - Change resolution of .now() to 20us. r=bkelly, a=lizzard DEVEDITION_58_0b14_RELEASE FENNEC_58_0b14_BUILD2 FENNEC_58_0b14_RELEASE FIREFOX_58_0b14_BUILD2 FIREFOX_58_0b14_RELEASE
authorTom Ritter <tom@mozilla.com>
Sat, 30 Dec 2017 13:07:00 -0600
changeset 445522 26b83e9df2019cf9c62b0db6c70edba642de51ac
parent 445521 df3efa640b0f443abe5309d7655275da0017f5e1
child 445523 e9d14df9e8a06acb176ff9f502da8866f479cc90
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly, lizzard
bugs1427870, 1186489, 1278838
milestone58.0
Bug 1427870 - Change resolution of .now() to 20us. r=bkelly, a=lizzard The comment about workers was introduced in Bug 1186489 but became obsolete some time after that (definitely by Bug 1278838)
dom/performance/Performance.cpp
--- a/dom/performance/Performance.cpp
+++ b/dom/performance/Performance.cpp
@@ -238,20 +238,19 @@ Performance::ClearResourceTimings()
 {
   MOZ_ASSERT(NS_IsMainThread());
   mResourceEntries.Clear();
 }
 
 DOMHighResTimeStamp
 Performance::RoundTime(double aTime) const
 {
-  // Round down to the nearest 5us, because if the timer is too accurate people
-  // can do nasty timing attacks with it.  See similar code in the worker
-  // Performance implementation.
-  const double maxResolutionMs = 0.005;
+  // Round down to the nearest 20us, because if the timer is too accurate people
+  // can do nasty timing attacks with it.
+  const double maxResolutionMs = 0.020;
   return nsRFPService::ReduceTimePrecisionAsMSecs(
     floor(aTime / maxResolutionMs) * maxResolutionMs);
 }
 
 
 void
 Performance::Mark(const nsAString& aName, ErrorResult& aRv)
 {