Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: third_party/WebKit/Source/core/timing/PerformanceBase.cpp

Issue 1361803003: Clamp resolution of requestIdleCallback timeRemaining() to 5us. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rIC_histograms
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/timing/PerformanceBase.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/timing/PerformanceBase.cpp
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
index ac075b2a4934013fe6f5e10af681b23e3ec6b359..ad653c600a557a110a2ed88b301a6fd6c0e36149 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -415,11 +415,17 @@ void PerformanceBase::deliverObservationsTimerFired(Timer<PerformanceBase>*)
}
}
+// static
+double PerformanceBase::clampTimeResolution(double timeSeconds)
+{
+ const double resolutionSeconds = 0.000005;
+ return floor(timeSeconds / resolutionSeconds) * resolutionSeconds;
+}
+
double PerformanceBase::now() const
{
double nowSeconds = monotonicallyIncreasingTime() - m_timeOrigin;
- const double resolutionSeconds = 0.000005;
- return 1000.0 * floor(nowSeconds / resolutionSeconds) * resolutionSeconds;
+ return 1000.0 * clampTimeResolution(nowSeconds);
}
DEFINE_TRACE(PerformanceBase)
« no previous file with comments | « third_party/WebKit/Source/core/timing/PerformanceBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698