Title: [183795] trunk/Source/WebCore
Revision
183795
Author
[email protected]
Date
2015-05-04 21:49:00 -0700 (Mon, 04 May 2015)

Log 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 [email protected].

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (183794 => 183795)


--- trunk/Source/WebCore/ChangeLog	2015-05-05 04:29:30 UTC (rev 183794)
+++ trunk/Source/WebCore/ChangeLog	2015-05-05 04:49:00 UTC (rev 183795)
@@ -1,3 +1,21 @@
+2015-05-04  Andreas Kling  <[email protected]>
+
+        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 [email protected].
+
+        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:
+
 2015-05-04  Simon Fraser  <[email protected]>
 
         Fix assertions in WK1 tests after r183777.

Modified: trunk/Source/WebCore/loader/DocumentLoadTiming.h (183794 => 183795)


--- trunk/Source/WebCore/loader/DocumentLoadTiming.h	2015-05-05 04:29:30 UTC (rev 183794)
+++ trunk/Source/WebCore/loader/DocumentLoadTiming.h	2015-05-05 04:49:00 UTC (rev 183795)
@@ -67,6 +67,8 @@
     bool hasCrossOriginRedirect() const { return m_hasCrossOriginRedirect; }
     bool hasSameOriginAsPreviousDocument() const { return m_hasSameOriginAsPreviousDocument; }
 
+    double referenceMonotonicTime() const { return m_referenceMonotonicTime; }
+
 private:
     double m_referenceMonotonicTime;
     double m_referenceWallTime;

Modified: trunk/Source/WebCore/page/Performance.cpp (183794 => 183795)


--- trunk/Source/WebCore/page/Performance.cpp	2015-05-05 04:29:30 UTC (rev 183794)
+++ trunk/Source/WebCore/page/Performance.cpp	2015-05-05 04:49:00 UTC (rev 183795)
@@ -60,7 +60,9 @@
 #if ENABLE(USER_TIMING)
     , m_userTiming(0)
 #endif // ENABLE(USER_TIMING)
+    , m_referenceTime(frame->document()->loader()->timing().referenceMonotonicTime())
 {
+    ASSERT(m_referenceTime);
 }
 
 Performance::~Performance()
@@ -228,10 +230,7 @@
 
 double Performance::now() const
 {
-    if (!frame())
-        return 0;
-
-    return 1000.0 * m_frame->document()->loader()->timing().monotonicTimeToZeroBasedDocumentTime(monotonicallyIncreasingTime());
+    return 1000.0 * (WTF::monotonicallyIncreasingTime() - m_referenceTime);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/Performance.h (183794 => 183795)


--- trunk/Source/WebCore/page/Performance.h	2015-05-05 04:29:30 UTC (rev 183794)
+++ trunk/Source/WebCore/page/Performance.h	2015-05-05 04:49:00 UTC (rev 183795)
@@ -103,6 +103,8 @@
     unsigned m_resourceTimingBufferSize;
 #endif
 
+    double m_referenceTime;
+
 #if ENABLE(USER_TIMING)
     RefPtr<UserTiming> m_userTiming;
 #endif // ENABLE(USER_TIMING)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to