+2014-01-23 Antti Koivisto <antti@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 peavo@outlook.com <peavo@outlook.com>
[WinCairo] Compile error.
#include "FrameLoaderClient.h"
#include "InspectorInstrumentation.h"
#include "Logging.h"
+#include "MainFrame.h"
#include "ProgressTrackerClient.h"
#include "ResourceResponse.h"
#include <wtf/text/CString.h>
, m_progressHeartbeatTimer(this, &ProgressTracker::progressHeartbeatTimerFired)
, m_heartbeatsWithNoProgress(0)
, m_totalBytesReceivedBeforePreviousHeartbeat(0)
+ , m_mainLoadCompletionTimeStamp(0)
+ , m_isMainLoad(false)
{
}
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++;
reset();
+ if (m_isMainLoad)
+ m_mainLoadCompletionTimeStamp = monotonicallyIncreasingTime();
+
frame->loader().client().setMainFrameDocumentReady(true);
m_client.progressFinished(*frame);
frame->loader().loadProgressingStatusChanged();
{
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;
}