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

Unified Diff: third_party/WebKit/Source/core/dom/IdleDeadline.cpp

Issue 1361803003: Clamp resolution of requestIdleCallback timeRemaining() to 5us. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rIC_histograms
Patch Set: 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 | « no previous file | 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/dom/IdleDeadline.cpp
diff --git a/third_party/WebKit/Source/core/dom/IdleDeadline.cpp b/third_party/WebKit/Source/core/dom/IdleDeadline.cpp
index ed7f04eb2d6dec18533ce8cd777009394d5044a9..13f30bd33dd7d6f910b5b643fa401b0e4e996999 100644
--- a/third_party/WebKit/Source/core/dom/IdleDeadline.cpp
+++ b/third_party/WebKit/Source/core/dom/IdleDeadline.cpp
@@ -21,7 +21,8 @@ double IdleDeadline::timeRemaining() const
if (timeRemaining < 0)
timeRemaining = 0;
- return timeRemaining * 1000;
+ const double resolutionSeconds = 0.000005;
esprehn 2015/09/24 21:33:06 This is just duplicating what performance.now does
rmcilroy 2015/09/24 22:53:18 Good idea, added PerformanceBase::clampTimeResolut
+ return 1000.0 * floor(timeRemaining / resolutionSeconds) * resolutionSeconds;
}
} // namespace blink
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698