Changeset 138997 in webkit


Ignore:
Timestamp:
Jan 7, 2013, 3:17:36 PM (12 years ago)
Author:
timothy_horton@apple.com
Message:

Tiled-layer TileCaches shouldn't unparent offscreen tiles
https://bugs.webkit.org/show_bug.cgi?id=106258
<rdar://problem/12969116>

Reviewed by Simon Fraser.

Add a setting on TiledBacking (implemented on TileCache) that controls whether or not
the TileCache should unparent offscreen tiles. We can't use this behavior for tiled-layer TileCaches
currently because m_isInWindow is not updated for tiled-layer TileCaches, and because we haven't
decided exactly what their behavior should be. So, revert to the old behavior for them.

  • platform/graphics/TiledBacking.h:
  • platform/graphics/ca/mac/TileCache.h:

(TileCache): Add setUnparentsOffscreenTiles/unparentsOffscreenTiles.

  • platform/graphics/ca/mac/TileCache.mm:

(WebCore::TileCache::TileCache): m_unparentsOffscreenTiles defaults to false.
(WebCore::TileCache::revalidateTiles):
Return to the old behavior of always adding new layers to the layer tree regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
Return to the old behavior of never unparenting tiles regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
(WebCore::TileCache::ensureTilesForRect): Return to the old behavior of always ensuring tiles regardless of m_isInWindow if m_unparentsOffscreen$

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::RenderLayerBacking): Tell primary TileCaches that it's OK to unparent offscreen tiles.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r138994 r138997  
     12013-01-07  Tim Horton  <timothy_horton@apple.com>
     2
     3        Tiled-layer TileCaches shouldn't unparent offscreen tiles
     4        https://bugs.webkit.org/show_bug.cgi?id=106258
     5        <rdar://problem/12969116>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add a setting on TiledBacking (implemented on TileCache) that controls whether or not
     10        the TileCache should unparent offscreen tiles. We can't use this behavior for tiled-layer TileCaches
     11        currently because m_isInWindow is not updated for tiled-layer TileCaches, and because we haven't
     12        decided exactly what their behavior should be. So, revert to the old behavior for them.
     13
     14        * platform/graphics/TiledBacking.h:
     15        * platform/graphics/ca/mac/TileCache.h:
     16        (TileCache): Add setUnparentsOffscreenTiles/unparentsOffscreenTiles.
     17        * platform/graphics/ca/mac/TileCache.mm:
     18        (WebCore::TileCache::TileCache): m_unparentsOffscreenTiles defaults to false.
     19        (WebCore::TileCache::revalidateTiles):
     20        Return to the old behavior of always adding new layers to the layer tree regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
     21        Return to the old behavior of never unparenting tiles regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
     22        (WebCore::TileCache::ensureTilesForRect): Return to the old behavior of always ensuring tiles regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
     23        * rendering/RenderLayerBacking.cpp:
     24        (WebCore::RenderLayerBacking::RenderLayerBacking): Tell primary TileCaches that it's OK to unparent offscreen tiles.
     25
    1262013-01-07  Justin Novosad  <junov@google.com>
    227
  • trunk/Source/WebCore/platform/graphics/TiledBacking.h

    r138858 r138997  
    7373    virtual void setAggressivelyRetainsTiles(bool) = 0;
    7474    virtual bool aggressivelyRetainsTiles() const = 0;
     75   
     76    virtual void setUnparentsOffscreenTiles(bool) = 0;
     77    virtual bool unparentsOffscreenTiles() const = 0;
    7578
    7679    // Exposed for testing
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h

    r138858 r138997  
    118118    virtual void setAggressivelyRetainsTiles(bool flag) OVERRIDE { m_aggressivelyRetainsTiles = flag; }
    119119    virtual bool aggressivelyRetainsTiles() const OVERRIDE { return m_aggressivelyRetainsTiles; }
     120    virtual void setUnparentsOffscreenTiles(bool flag) OVERRIDE { m_unparentsOffscreenTiles = flag; }
     121    virtual bool unparentsOffscreenTiles() const OVERRIDE { return m_unparentsOffscreenTiles; }
    120122    virtual IntRect tileCoverageRect() const OVERRIDE;
    121123    virtual CALayer *tiledScrollingIndicatorLayer() OVERRIDE;
     
    193195    bool m_scrollingPerformanceLoggingEnabled;
    194196    bool m_aggressivelyRetainsTiles;
     197    bool m_unparentsOffscreenTiles;
    195198    bool m_acceleratesDrawing;
    196199    bool m_tilesAreOpaque;
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm

    r138858 r138997  
    107107    , m_scrollingPerformanceLoggingEnabled(false)
    108108    , m_aggressivelyRetainsTiles(false)
     109    , m_unparentsOffscreenTiles(false)
    109110    , m_acceleratesDrawing(false)
    110111    , m_tilesAreOpaque(false)
     
    587588                    tileInfo.cohort = currCohort;
    588589                    ++tilesInCohort;
    589                     [tileInfo.layer.get() removeFromSuperlayer];
     590                   
     591                    if (m_unparentsOffscreenTiles)
     592                        [tileInfo.layer.get() removeFromSuperlayer];
    590593                }
    591594            }
     
    618621            if (!tileInfo.layer) {
    619622                tileInfo.layer = createTileLayer(tileRect);
    620                 if (m_isInWindow)
     623                if (!m_unparentsOffscreenTiles || m_isInWindow)
    621624                    [m_tileContainerLayer.get() addSublayer:tileInfo.layer.get()];
    622625            } else {
    623                 if (m_isInWindow && ![tileInfo.layer.get() superlayer])
     626                if ((!m_unparentsOffscreenTiles || m_isInWindow) && ![tileInfo.layer.get() superlayer])
    624627                    [m_tileContainerLayer.get() addSublayer:tileInfo.layer.get()];
    625628
     
    643646    }
    644647
    645     if (validationPolicy & UnparentAllTiles) {
     648    if (m_unparentsOffscreenTiles && (validationPolicy & UnparentAllTiles)) {
    646649        for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it)
    647650            [it->value.layer.get() removeFromSuperlayer];
     
    711714void TileCache::ensureTilesForRect(const IntRect& rect)
    712715{
    713     if (!m_isInWindow)
     716    if (m_unparentsOffscreenTiles && !m_isInWindow)
    714717        return;
    715718
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r138809 r138997  
    131131            Frame* frame = renderer()->frame();
    132132            tiledBacking->setIsInWindow(page->isOnscreen());
     133
     134            if (m_isMainFrameRenderViewLayer)
     135                tiledBacking->setUnparentsOffscreenTiles(true);
     136
    133137            tiledBacking->setScrollingPerformanceLoggingEnabled(frame->settings() && frame->settings()->scrollingPerformanceLoggingEnabled());
    134138            adjustTileCacheCoverage();
Note: See TracChangeset for help on using the changeset viewer.