Changeset 183795 in webkit


Ignore:
Timestamp:
May 4, 2015 9:49:00 PM (9 years ago)
Author:
akling@apple.com
Message:

Record the reference time when Performance is constructed.
<https://webkit.org/b/144616>

Reviewed by Geoffrey Garen.

This is a merge of Blink's r156613 by simonjam@chromium.org.

Cache a copy of the DocumentLoader's reference timestamp when constructing
the Performance object. That way we don't have to jump through a bunch of scary
hoops to access it when now() is called later on.

  • page/Performance.cpp:

(WebCore::Performance::Performance):
(WebCore::Performance::now): Deleted.

  • page/Performance.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r183794 r183795  
     12015-05-04  Andreas Kling  <akling@apple.com>
     2
     3        Record the reference time when Performance is constructed.
     4        <https://webkit.org/b/144616>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        This is a merge of Blink's r156613 by simonjam@chromium.org.
     9
     10        Cache a copy of the DocumentLoader's reference timestamp when constructing
     11        the Performance object. That way we don't have to jump through a bunch of scary
     12        hoops to access it when now() is called later on.
     13
     14        * page/Performance.cpp:
     15        (WebCore::Performance::Performance):
     16        (WebCore::Performance::now): Deleted.
     17        * page/Performance.h:
     18
    1192015-05-04  Simon Fraser  <simon.fraser@apple.com>
    220
  • trunk/Source/WebCore/loader/DocumentLoadTiming.h

    r168647 r183795  
    6868    bool hasSameOriginAsPreviousDocument() const { return m_hasSameOriginAsPreviousDocument; }
    6969
     70    double referenceMonotonicTime() const { return m_referenceMonotonicTime; }
     71
    7072private:
    7173    double m_referenceMonotonicTime;
  • trunk/Source/WebCore/page/Performance.cpp

    r179937 r183795  
    6161    , m_userTiming(0)
    6262#endif // ENABLE(USER_TIMING)
    63 {
     63    , m_referenceTime(frame->document()->loader()->timing().referenceMonotonicTime())
     64{
     65    ASSERT(m_referenceTime);
    6466}
    6567
     
    229231double Performance::now() const
    230232{
    231     if (!frame())
    232         return 0;
    233 
    234     return 1000.0 * m_frame->document()->loader()->timing().monotonicTimeToZeroBasedDocumentTime(monotonicallyIncreasingTime());
     233    return 1000.0 * (WTF::monotonicallyIncreasingTime() - m_referenceTime);
    235234}
    236235
  • trunk/Source/WebCore/page/Performance.h

    r181169 r183795  
    104104#endif
    105105
     106    double m_referenceTime;
     107
    106108#if ENABLE(USER_TIMING)
    107109    RefPtr<UserTiming> m_userTiming;
Note: See TracChangeset for help on using the changeset viewer.