Title: [162637] trunk/Source/WebCore
Revision
162637
Author
an...@apple.com
Date
2014-01-23 13:20:00 -0800 (Thu, 23 Jan 2014)

Log Message

Loads started soon after main frame completion should be considered part of the main load
https://bugs.webkit.org/show_bug.cgi?id=127504

Reviewed by Andreas Kling.

ProgressTracker currently decides that main load is complete when the main frame stops loading. 
However it is common that timers and onload events trigger more loads immediately (for example 
by inserting iframes) and loading continues visually. These should be considered as part of the
main load for paint throttling and speculative tiling coverage purposes.

* loader/ProgressTracker.cpp:
(WebCore::ProgressTracker::ProgressTracker):
(WebCore::ProgressTracker::progressStarted):
        
    Track whether this is considered part of the main load or not with a boolean. 
    It is set for subframe loads too if they start loading soon (within 1s) after the main frame load completes.

(WebCore::ProgressTracker::finalProgressComplete):
        
    Get a timestamp.

(WebCore::ProgressTracker::isMainLoadProgressing):

    New definition of "main load".

* loader/ProgressTracker.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (162636 => 162637)


--- trunk/Source/WebCore/ChangeLog	2014-01-23 21:19:31 UTC (rev 162636)
+++ trunk/Source/WebCore/ChangeLog	2014-01-23 21:20:00 UTC (rev 162637)
@@ -1,3 +1,32 @@
+2014-01-23  Antti Koivisto  <an...@apple.com>
+
+        Loads started soon after main frame completion should be considered part of the main load
+        https://bugs.webkit.org/show_bug.cgi?id=127504
+
+        Reviewed by Andreas Kling.
+
+        ProgressTracker currently decides that main load is complete when the main frame stops loading. 
+        However it is common that timers and onload events trigger more loads immediately (for example 
+        by inserting iframes) and loading continues visually. These should be considered as part of the
+        main load for paint throttling and speculative tiling coverage purposes.
+
+        * loader/ProgressTracker.cpp:
+        (WebCore::ProgressTracker::ProgressTracker):
+        (WebCore::ProgressTracker::progressStarted):
+        
+            Track whether this is considered part of the main load or not with a boolean. 
+            It is set for subframe loads too if they start loading soon (within 1s) after the main frame load completes.
+
+        (WebCore::ProgressTracker::finalProgressComplete):
+        
+            Get a timestamp.
+
+        (WebCore::ProgressTracker::isMainLoadProgressing):
+
+            New definition of "main load".
+
+        * loader/ProgressTracker.h:
+
 2014-01-23  pe...@outlook.com  <pe...@outlook.com>
 
         [WinCairo] Compile error.

Modified: trunk/Source/WebCore/loader/ProgressTracker.cpp (162636 => 162637)


--- trunk/Source/WebCore/loader/ProgressTracker.cpp	2014-01-23 21:19:31 UTC (rev 162636)
+++ trunk/Source/WebCore/loader/ProgressTracker.cpp	2014-01-23 21:20:00 UTC (rev 162637)
@@ -33,6 +33,7 @@
 #include "FrameLoaderClient.h"
 #include "InspectorInstrumentation.h"
 #include "Logging.h"
+#include "MainFrame.h"
 #include "ProgressTrackerClient.h"
 #include "ResourceResponse.h"
 #include <wtf/text/CString.h>
@@ -88,6 +89,8 @@
     , m_progressHeartbeatTimer(this, &ProgressTracker::progressHeartbeatTimerFired)
     , m_heartbeatsWithNoProgress(0)
     , m_totalBytesReceivedBeforePreviousHeartbeat(0)
+    , m_mainLoadCompletionTimeStamp(0)
+    , m_isMainLoad(false)
 {
 }
 
@@ -133,6 +136,12 @@
         m_progressHeartbeatTimer.startRepeating(progressHeartbeatInterval);
         m_originatingProgressFrame->loader().loadProgressingStatusChanged();
 
+        bool isMainFrame = !m_originatingProgressFrame->tree().parent();
+        double elapsedTimeSinceMainLoadComplete = monotonicallyIncreasingTime() - m_mainLoadCompletionTimeStamp;
+
+        static const double subframePartOfMainLoadThreshold = 1;
+        m_isMainLoad = isMainFrame || elapsedTimeSinceMainLoadComplete < subframePartOfMainLoadThreshold;
+
         m_client.progressStarted(*m_originatingProgressFrame);
     }
     m_numProgressTrackedFrames++;
@@ -172,6 +181,9 @@
 
     reset();
 
+    if (m_isMainLoad)
+        m_mainLoadCompletionTimeStamp = monotonicallyIncreasingTime();
+
     frame->loader().client().setMainFrameDocumentReady(true);
     m_client.progressFinished(*frame);
     frame->loader().loadProgressingStatusChanged();
@@ -291,9 +303,10 @@
 {
     if (!m_originatingProgressFrame)
         return false;
-    // See if the load originated from a subframe.
-    if (m_originatingProgressFrame->tree().parent())
+
+    if (!m_isMainLoad)
         return false;
+
     return m_progressValue && m_progressValue < finalProgressValue && m_heartbeatsWithNoProgress < loadStalledHeartbeatCount;
 }
 

Modified: trunk/Source/WebCore/loader/ProgressTracker.h (162636 => 162637)


--- trunk/Source/WebCore/loader/ProgressTracker.h	2014-01-23 21:19:31 UTC (rev 162636)
+++ trunk/Source/WebCore/loader/ProgressTracker.h	2014-01-23 21:20:00 UTC (rev 162637)
@@ -87,6 +87,8 @@
     Timer<ProgressTracker> m_progressHeartbeatTimer;
     unsigned m_heartbeatsWithNoProgress;
     long long m_totalBytesReceivedBeforePreviousHeartbeat;
+    double m_mainLoadCompletionTimeStamp;
+    bool m_isMainLoad;
 };
     
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to