diff options
author | Alex Christensen <achristensen@webkit.org> | 2015-07-02 00:29:55 +0000 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2018-01-15 09:38:07 +0000 |
commit | 8aed7c65423e2303432e355fa485ef91e830c9d2 (patch) | |
tree | 21223d7ad2715a309997b0a01e02d2ae9ec6c3dd | |
parent | 9e2101e069807e049b1b8ace10e0b2866ef04f8f (diff) |
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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@186208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change-Id: I24763f8f5d01e4b9c7c92041f981d53d88a0654d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | Source/WebCore/page/Performance.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/WebCore/page/Performance.cpp b/Source/WebCore/page/Performance.cpp index edc4f9153..72b73b16d 100644 --- a/Source/WebCore/page/Performance.cpp +++ b/Source/WebCore/page/Performance.cpp @@ -245,7 +245,9 @@ void Performance::webkitClearMeasures(const String& measureName) 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 |