Title: [186208] trunk
Revision
186208
Author
[email protected]
Date
2015-07-01 17:29:55 -0700 (Wed, 01 Jul 2015)

Log Message

Reduce resolution of performance.now.
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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (186207 => 186208)


--- trunk/LayoutTests/ChangeLog	2015-07-02 00:07:50 UTC (rev 186207)
+++ trunk/LayoutTests/ChangeLog	2015-07-02 00:29:55 UTC (rev 186208)
@@ -1,3 +1,14 @@
+2015-07-01  Alex Christensen  <[email protected]>
+
+        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  <[email protected]>
 
         [iOS] Support bold and thin italicized system fonts

Added: trunk/LayoutTests/http/tests/misc/webtiming-resolution-expected.txt (0 => 186208)


--- trunk/LayoutTests/http/tests/misc/webtiming-resolution-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/webtiming-resolution-expected.txt	2015-07-02 00:29:55 UTC (rev 186208)
@@ -0,0 +1,7 @@
+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
+

Added: trunk/LayoutTests/http/tests/misc/webtiming-resolution.html (0 => 186208)


--- trunk/LayoutTests/http/tests/misc/webtiming-resolution.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/webtiming-resolution.html	2015-07-02 00:29:55 UTC (rev 186208)
@@ -0,0 +1,20 @@
+<html>
+<head>
+<script src=""
+</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>

Modified: trunk/Source/WebCore/ChangeLog (186207 => 186208)


--- trunk/Source/WebCore/ChangeLog	2015-07-02 00:07:50 UTC (rev 186207)
+++ trunk/Source/WebCore/ChangeLog	2015-07-02 00:29:55 UTC (rev 186208)
@@ -1,3 +1,17 @@
+2015-07-01  Alex Christensen  <[email protected]>
+
+        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  <[email protected]>
 
         [iOS] Build fix

Modified: trunk/Source/WebCore/page/Performance.cpp (186207 => 186208)


--- trunk/Source/WebCore/page/Performance.cpp	2015-07-02 00:07:50 UTC (rev 186207)
+++ trunk/Source/WebCore/page/Performance.cpp	2015-07-02 00:29:55 UTC (rev 186208)
@@ -231,7 +231,9 @@
 
 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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to