Changeset 115503 in webkit


Ignore:
Timestamp:
Apr 27, 2012 3:34:46 PM (12 years ago)
Author:
nduca@chromium.org
Message:

Source/WebCore: Implement high-resolution time via window.performance.webkitNow()
https://bugs.webkit.org/show_bug.cgi?id=66684

This implements the high resolution time spec from
http://www.w3.org/TR/hr-time/, giving javascript access to
sub-millisecond timestamps that increase over time instead of being
subject to skewing, for example when the host machine's clock changes.

Reviewed by Tony Gentilcore.

Test: fast/performance/performance-now-timestamps.html

  • page/Performance.cpp:

(WebCore::Performance::now):
(WebCore):

  • page/Performance.h:

(Performance):

  • page/Performance.idl:

LayoutTests: Implement high-resolution time via window.performance.now()
https://bugs.webkit.org/show_bug.cgi?id=66684

This implements the high resolution time spec from
http://www.w3.org/TR/hr-time/, giving javascript access to
sub-millisecond timestamps that increase over time instead of being
subject to skewing, for example when the host machine's clock changes.

Reviewed by Tony Gentilcore.

  • fast/dom/Window/window-properties-performance-expected.txt:
  • fast/performance/performance-now-timestamps-expected.txt: Added.
  • fast/performance/performance-now-timestamps.html: Added.
  • fast/performance/script-tests/TEMPLATE.html: Added.
  • fast/performance/script-tests/performance-now-timestamps.js: Added.

(busyWait):

  • platform/qt/fast/dom/Window/window-properties-performance-expected.txt:
Location:
trunk
Files:
6 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r115502 r115503  
     12012-04-27  Nat Duca  <nduca@chromium.org>
     2
     3        Implement high-resolution time via window.performance.now()
     4        https://bugs.webkit.org/show_bug.cgi?id=66684
     5
     6        This implements the high resolution time spec from
     7        http://www.w3.org/TR/hr-time/, giving javascript access to
     8        sub-millisecond timestamps that increase over time instead of being
     9        subject to skewing, for example when the host machine's clock changes.
     10
     11        Reviewed by Tony Gentilcore.
     12
     13        * fast/dom/Window/window-properties-performance-expected.txt:
     14        * fast/performance/performance-now-timestamps-expected.txt: Added.
     15        * fast/performance/performance-now-timestamps.html: Added.
     16        * fast/performance/script-tests/TEMPLATE.html: Added.
     17        * fast/performance/script-tests/performance-now-timestamps.js: Added.
     18        (busyWait):
     19        * platform/qt/fast/dom/Window/window-properties-performance-expected.txt:
     20
    1212012-04-27  Tony Chang  <tony@chromium.org>
    222
  • trunk/LayoutTests/fast/dom/Window/window-properties-performance-expected.txt

    r77514 r115503  
    3535window.performance.timing.unloadEventEnd [number]
    3636window.performance.timing.unloadEventStart [number]
     37window.performance.webkitNow [function]
    3738window.performance.timing [printed above as window.performance.timing]
    3839window.performance.navigation [printed above as window.performance.navigation]
  • trunk/LayoutTests/platform/qt/fast/dom/Window/window-properties-performance-expected.txt

    r77505 r115503  
    3535window.performance.timing.unloadEventEnd [number]
    3636window.performance.timing.unloadEventStart [number]
     37window.performance.webkitNow [function]
    3738window.performance.timing [printed above as window.performance.timing]
    3839window.performance.navigation [printed above as window.performance.navigation]
  • trunk/Source/WebCore/ChangeLog

    r115498 r115503  
     12012-04-27  Nat Duca  <nduca@chromium.org>
     2
     3        Implement high-resolution time via window.performance.webkitNow()
     4        https://bugs.webkit.org/show_bug.cgi?id=66684
     5
     6        This implements the high resolution time spec from
     7        http://www.w3.org/TR/hr-time/, giving javascript access to
     8        sub-millisecond timestamps that increase over time instead of being
     9        subject to skewing, for example when the host machine's clock changes.
     10
     11        Reviewed by Tony Gentilcore.
     12
     13        Test: fast/performance/performance-now-timestamps.html
     14
     15        * page/Performance.cpp:
     16        (WebCore::Performance::now):
     17        (WebCore):
     18        * page/Performance.h:
     19        (Performance):
     20        * page/Performance.idl:
     21
    1222012-04-27  Filip Pizlo  <fpizlo@apple.com>
    223
  • trunk/Source/WebCore/loader/DocumentLoadTiming.cpp

    r109300 r115503  
    9797}
    9898
     99double DocumentLoadTiming::convertMonotonicTimeToZeroBasedDocumentTime(double monotonicTime) const
     100{
     101    if (!monotonicTime)
     102        return 0.0;
     103    return monotonicTime - m_referenceMonotonicTime;
     104}
     105
    99106} // namespace WebCore
  • trunk/Source/WebCore/loader/DocumentLoadTiming.h

    r109300 r115503  
    4141    void setNavigationStart(double);
    4242    void addRedirect(const KURL& redirectingUrl, const KURL& redirectedUrl);
    43     double convertMonotonicTimeToDocumentTime(double monotonicTime) const;
     43    double convertMonotonicTimeToDocumentTime(double) const;
     44
     45    // FIXME: Once convertMonotonicTimeToDocumentTime is zero-based, then this
     46    // function and convertMonotonicTimeToDocumentTime can be merged. See
     47    // https://bugs.webkit.org/show_bug.cgi?id=84912 for more details.
     48    double convertMonotonicTimeToZeroBasedDocumentTime(double) const;
    4449
    4550    void markUnloadEventStart() { m_unloadEventStart = monotonicallyIncreasingTime(); }
  • trunk/Source/WebCore/page/Performance.cpp

    r115274 r115503  
    3232#include "Performance.h"
    3333
     34#include "Document.h"
     35#include "DocumentLoader.h"
    3436#include "MemoryInfo.h"
    3537#include "PerformanceNavigation.h"
    3638#include "PerformanceTiming.h"
     39#include <wtf/CurrentTime.h>
    3740
    3841#if ENABLE(WEB_TIMING)
     
    9093#endif // ENABLE(PERFORMANCE_TIMELINE)
    9194
     95double Performance::webkitNow() const
     96{
     97    return 1000.0 * m_frame->document()->loader()->timing()->convertMonotonicTimeToZeroBasedDocumentTime(monotonicallyIncreasingTime());
     98}
     99
    92100} // namespace WebCore
    93101
  • trunk/Source/WebCore/page/Performance.h

    r115274 r115503  
    5353    PerformanceNavigation* navigation() const;
    5454    PerformanceTiming* timing() const;
     55    double webkitNow() const;
    5556
    5657#if ENABLE(PERFORMANCE_TIMELINE)
  • trunk/Source/WebCore/page/Performance.idl

    r115274 r115503  
    4545        PerformanceEntryList webkitGetEntriesByName(in DOMString name, in [Optional=DefaultIsNullString] DOMString entryType);
    4646#endif
     47        // See http://www.w3.org/TR/hr-time/ for details.
     48        double webkitNow();
    4749    };
    4850
Note: See TracChangeset for help on using the changeset viewer.