Changeset 162637 in webkit


Ignore:
Timestamp:
Jan 23, 2014 1:20:00 PM (10 years ago)
Author:
Antti Koivisto
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:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r162636 r162637  
     12014-01-23  Antti Koivisto  <antti@apple.com>
     2
     3        Loads started soon after main frame completion should be considered part of the main load
     4        https://bugs.webkit.org/show_bug.cgi?id=127504
     5
     6        Reviewed by Andreas Kling.
     7
     8        ProgressTracker currently decides that main load is complete when the main frame stops loading.
     9        However it is common that timers and onload events trigger more loads immediately (for example
     10        by inserting iframes) and loading continues visually. These should be considered as part of the
     11        main load for paint throttling and speculative tiling coverage purposes.
     12
     13        * loader/ProgressTracker.cpp:
     14        (WebCore::ProgressTracker::ProgressTracker):
     15        (WebCore::ProgressTracker::progressStarted):
     16       
     17            Track whether this is considered part of the main load or not with a boolean.
     18            It is set for subframe loads too if they start loading soon (within 1s) after the main frame load completes.
     19
     20        (WebCore::ProgressTracker::finalProgressComplete):
     21       
     22            Get a timestamp.
     23
     24        (WebCore::ProgressTracker::isMainLoadProgressing):
     25
     26            New definition of "main load".
     27
     28        * loader/ProgressTracker.h:
     29
    1302014-01-23  peavo@outlook.com  <peavo@outlook.com>
    231
  • trunk/Source/WebCore/loader/ProgressTracker.cpp

    r162034 r162637  
    3434#include "InspectorInstrumentation.h"
    3535#include "Logging.h"
     36#include "MainFrame.h"
    3637#include "ProgressTrackerClient.h"
    3738#include "ResourceResponse.h"
     
    8990    , m_heartbeatsWithNoProgress(0)
    9091    , m_totalBytesReceivedBeforePreviousHeartbeat(0)
     92    , m_mainLoadCompletionTimeStamp(0)
     93    , m_isMainLoad(false)
    9194{
    9295}
     
    134137        m_originatingProgressFrame->loader().loadProgressingStatusChanged();
    135138
     139        bool isMainFrame = !m_originatingProgressFrame->tree().parent();
     140        double elapsedTimeSinceMainLoadComplete = monotonicallyIncreasingTime() - m_mainLoadCompletionTimeStamp;
     141
     142        static const double subframePartOfMainLoadThreshold = 1;
     143        m_isMainLoad = isMainFrame || elapsedTimeSinceMainLoadComplete < subframePartOfMainLoadThreshold;
     144
    136145        m_client.progressStarted(*m_originatingProgressFrame);
    137146    }
     
    172181
    173182    reset();
     183
     184    if (m_isMainLoad)
     185        m_mainLoadCompletionTimeStamp = monotonicallyIncreasingTime();
    174186
    175187    frame->loader().client().setMainFrameDocumentReady(true);
     
    292304    if (!m_originatingProgressFrame)
    293305        return false;
    294     // See if the load originated from a subframe.
    295     if (m_originatingProgressFrame->tree().parent())
     306
     307    if (!m_isMainLoad)
    296308        return false;
     309
    297310    return m_progressValue && m_progressValue < finalProgressValue && m_heartbeatsWithNoProgress < loadStalledHeartbeatCount;
    298311}
  • trunk/Source/WebCore/loader/ProgressTracker.h

    r161768 r162637  
    8888    unsigned m_heartbeatsWithNoProgress;
    8989    long long m_totalBytesReceivedBeforePreviousHeartbeat;
     90    double m_mainLoadCompletionTimeStamp;
     91    bool m_isMainLoad;
    9092};
    9193   
Note: See TracChangeset for help on using the changeset viewer.