https://bugs.webkit.org/show_bug.cgi?id=146531
rdar://problem/
20116796
Reviewed by Simon Fraser.
Source/WebCore:
Test: http/tests/misc/webtiming-resolution.html
* page/Performance.cpp:
(WebCore::Performance::now):
Floor the time returned by performance.now to the nearest 5 microseconds.
LayoutTests:
* http/tests/misc/webtiming-resolution-expected.txt: Added.
* http/tests/misc/webtiming-resolution.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186208
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-07-01 Alex Christensen <achristensen@webkit.org>
+
+ Reduce resolution of performance.now.
+ https://bugs.webkit.org/show_bug.cgi?id=146531
+ rdar://problem/20116796
+
+ Reviewed by Simon Fraser.
+
+ * http/tests/misc/webtiming-resolution-expected.txt: Added.
+ * http/tests/misc/webtiming-resolution.html: Added.
+
2015-07-01 Myles C. Maxfield <mmaxfield@apple.com>
[iOS] Support bold and thin italicized system fonts
--- /dev/null
+Verifies the minimum resolution is 5 microseconds.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS ((t1 - t0) / 0.005) % 1 < 1e-10 is true
+
--- /dev/null
+<html>
+<head>
+<script src="../../js-test-resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Verifies the minimum resolution is 5 microseconds.");
+
+var t0 = performance.now();
+var t1 = performance.now();
+while (t0 == t1) {
+ t1 = performance.now();
+}
+shouldBe("((t1 - t0) / 0.005) % 1 < 1e-10", "true");
+
+</script>
+</body>
+</html>
+2015-07-01 Alex Christensen <achristensen@webkit.org>
+
+ Reduce resolution of performance.now.
+ https://bugs.webkit.org/show_bug.cgi?id=146531
+ rdar://problem/20116796
+
+ Reviewed by Simon Fraser.
+
+ Test: http/tests/misc/webtiming-resolution.html
+
+ * page/Performance.cpp:
+ (WebCore::Performance::now):
+ Floor the time returned by performance.now to the nearest 5 microseconds.
+
2015-07-01 Eric Carlson <eric.carlson@apple.com>
[iOS] Build fix
double Performance::now() const
{
- return 1000.0 * (WTF::monotonicallyIncreasingTime() - m_referenceTime);
+ double nowSeconds = WTF::monotonicallyIncreasingTime() - m_referenceTime;
+ const double resolutionSeconds = 0.000005;
+ return 1000.0 * floor(nowSeconds / resolutionSeconds) * resolutionSeconds;
}
} // namespace WebCore