Changeset 162640 in webkit


Ignore:
Timestamp:
Jan 23, 2014, 2:03:27 PM (11 years ago)
Author:
Antti Koivisto
Message:

Don't enable speculative tiles immediately after main load stops progressing
https://bugs.webkit.org/show_bug.cgi?id=127507

Reviewed by Andreas Kling.

It is common for timers and events to trigger more loading after the initial main frame loading
has completed. We should delay a bit before enabling speculative tiles and keep them disabled
if loading still continues.

  • page/FrameView.cpp:

(WebCore::FrameView::FrameView):
(WebCore::FrameView::adjustTiledBackingCoverage):
(WebCore::shouldEnableSpeculativeTilingDuringLoading):
(WebCore::FrameView::enableSpeculativeTilingIfNeeded):

When load progression stops wait 0.5s before enabling speculative tiles.

(WebCore::FrameView::speculativeTilingEnableTimerFired):

Don't enable speculative tiles if the progression has started again. Instead restart the timer.

  • page/FrameView.h:
  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::RenderLayerBacking):
(WebCore::computeTileCoverage):

Move the FrameView level code to FrameView (so we don't need to add a timer to every RenderLayerBacking).

  • rendering/RenderLayerBacking.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r162637 r162640  
     12014-01-23  Antti Koivisto  <antti@apple.com>
     2
     3        Don't enable speculative tiles immediately after main load stops progressing
     4        https://bugs.webkit.org/show_bug.cgi?id=127507
     5
     6        Reviewed by Andreas Kling.
     7
     8        It is common for timers and events to trigger more loading after the initial main frame loading
     9        has completed. We should delay a bit before enabling speculative tiles and keep them disabled
     10        if loading still continues.
     11
     12        * page/FrameView.cpp:
     13        (WebCore::FrameView::FrameView):
     14        (WebCore::FrameView::adjustTiledBackingCoverage):
     15        (WebCore::shouldEnableSpeculativeTilingDuringLoading):
     16        (WebCore::FrameView::enableSpeculativeTilingIfNeeded):
     17       
     18            When load progression stops wait 0.5s before enabling speculative tiles.
     19
     20        (WebCore::FrameView::speculativeTilingEnableTimerFired):
     21       
     22            Don't enable speculative tiles if the progression has started again. Instead restart the timer.
     23
     24        * page/FrameView.h:
     25        * rendering/RenderLayerBacking.cpp:
     26        (WebCore::RenderLayerBacking::RenderLayerBacking):
     27        (WebCore::computeTileCoverage):
     28       
     29            Move the FrameView level code to FrameView (so we don't need to add a timer to every RenderLayerBacking).
     30
     31        * rendering/RenderLayerBacking.h:
     32
    1332014-01-23  Antti Koivisto  <antti@apple.com>
    234
  • trunk/Source/WebCore/page/FrameView.cpp

    r162597 r162640  
    205205    , m_deferSetNeedsLayouts(0)
    206206    , m_setNeedsLayoutWasDeferred(false)
     207    , m_speculativeTilingEnabled(false)
     208    , m_speculativeTilingEnableTimer(this, &FrameView::speculativeTilingEnableTimerFired)
    207209#if PLATFORM(IOS)
    208210    , m_useCustomFixedPositionLayoutRect(false)
     
    24272429void FrameView::adjustTiledBackingCoverage()
    24282430{
     2431    if (!m_speculativeTilingEnabled)
     2432        enableSpeculativeTilingIfNeeded();
     2433
    24292434#if USE(ACCELERATED_COMPOSITING)
    24302435    RenderView* renderView = this->renderView();
     
    24342439#if PLATFORM(IOS)
    24352440    if (TileCache* tileCache = this->tileCache())
    2436         tileCache->setSpeculativeTileCreationEnabled(!m_frame->page()->progress().isMainLoadProgressing());
    2437 #endif
     2441        tileCache->setSpeculativeTileCreationEnabled(m_speculativeTilingEnabled);
     2442#endif
     2443}
     2444
     2445static bool shouldEnableSpeculativeTilingDuringLoading(const FrameView& view)
     2446{
     2447    return view.isVisuallyNonEmpty() && !view.frame().page()->progress().isMainLoadProgressing();
     2448}
     2449
     2450void FrameView::enableSpeculativeTilingIfNeeded()
     2451{
     2452    ASSERT(!m_speculativeTilingEnabled);
     2453    if (m_wasScrolledByUser) {
     2454        m_speculativeTilingEnabled = true;
     2455        return;
     2456    }
     2457    if (!shouldEnableSpeculativeTilingDuringLoading(*this))
     2458        return;
     2459    if (m_speculativeTilingEnableTimer.isActive())
     2460        return;
     2461    // Delay enabling a bit as load completion may trigger further loading from scripts.
     2462    static const double speculativeTilingEnableDelay = 0.5;
     2463    m_speculativeTilingEnableTimer.startOneShot(speculativeTilingEnableDelay);
     2464}
     2465
     2466void FrameView::speculativeTilingEnableTimerFired(Timer<FrameView>&)
     2467{
     2468    if (m_speculativeTilingEnabled)
     2469        return;
     2470    m_speculativeTilingEnabled = shouldEnableSpeculativeTilingDuringLoading(*this);
     2471    adjustTiledBackingCoverage();
    24382472}
    24392473
  • trunk/Source/WebCore/page/FrameView.h

    r162597 r162640  
    270270    void updateLayerFlushThrottlingInAllFrames();
    271271    void adjustTiledBackingCoverage();
     272    bool speculativeTilingEnabled() const { return m_speculativeTilingEnabled; }
    272273
    273274#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION)
     
    558559    double adjustedDeferredRepaintDelay() const;
    559560
     561    void enableSpeculativeTilingIfNeeded();
     562    void speculativeTilingEnableTimerFired(Timer<FrameView>&);
     563
    560564    bool updateEmbeddedObjects();
    561565    void updateEmbeddedObject(RenderEmbeddedObject&);
     
    664668    // Renderer to hold our custom scroll corner.
    665669    RenderPtr<RenderScrollbarPart> m_scrollCorner;
     670
     671    bool m_speculativeTilingEnabled;
     672    Timer<FrameView> m_speculativeTilingEnableTimer;
    666673
    667674#if PLATFORM(IOS)
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r162605 r162640  
    124124#endif
    125125    , m_backgroundLayerPaintsFixedRootBackground(false)
    126     , m_didSwitchToFullTileCoverageDuringLoading(false)
    127126{
    128127    Page* page = renderer().frame().page();
     
    221220    TiledBacking::TileCoverage tileCoverage = TiledBacking::CoverageForVisibleArea;
    222221    bool useMinimalTilesDuringLiveResize = frameView.inLiveResize();
    223     bool useMinimalTilesDuringLoading = false;
    224     // Avoid churn.
    225     if (!backing->didSwitchToFullTileCoverageDuringLoading()) {
    226         useMinimalTilesDuringLoading = !frameView.isVisuallyNonEmpty() || (frameView.frame().page()->progress().isMainLoadProgressing() && !frameView.wasScrolledByUser());
    227         if (!useMinimalTilesDuringLoading)
    228             backing->setDidSwitchToFullTileCoverageDuringLoading();
    229     }
    230     if (!(useMinimalTilesDuringLoading || useMinimalTilesDuringLiveResize)) {
     222    if (frameView.speculativeTilingEnabled() && !useMinimalTilesDuringLiveResize) {
    231223        bool clipsToExposedRect = !frameView.exposedRect().isInfinite();
    232224        if (frameView.horizontalScrollbarMode() != ScrollbarAlwaysOff || clipsToExposedRect)
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r162230 r162640  
    203203    double backingStoreMemoryEstimate() const;
    204204
    205     bool didSwitchToFullTileCoverageDuringLoading() const { return m_didSwitchToFullTileCoverageDuringLoading; }
    206     void setDidSwitchToFullTileCoverageDuringLoading() { m_didSwitchToFullTileCoverageDuringLoading = true; }
    207 
    208205#if ENABLE(CSS_COMPOSITING)
    209206    void setBlendMode(BlendMode);
     
    325322#endif
    326323    bool m_backgroundLayerPaintsFixedRootBackground;
    327     bool m_didSwitchToFullTileCoverageDuringLoading;
    328324
    329325    static bool m_creatingPrimaryGraphicsLayer;
Note: See TracChangeset for help on using the changeset viewer.