Changeset 213715 in webkit


Ignore:
Timestamp:
Mar 10, 2017 10:05:46 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r213618.
https://bugs.webkit.org/show_bug.cgi?id=169475

Suspect this is the cause of a large memory regression
(Requested by jonlee_ on #webkit).

Reverted changeset:

"Enable async image decoding for large images"
https://bugs.webkit.org/show_bug.cgi?id=165039
http://trac.webkit.org/changeset/213618

Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r213712 r213715  
     12017-03-10  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r213618.
     4        https://bugs.webkit.org/show_bug.cgi?id=169475
     5
     6        Suspect this is the cause of a large memory regression
     7        (Requested by jonlee_ on #webkit).
     8
     9        Reverted changeset:
     10
     11        "Enable async image decoding for large images"
     12        https://bugs.webkit.org/show_bug.cgi?id=165039
     13        http://trac.webkit.org/changeset/213618
     14
    1152017-03-10  Antti Koivisto  <antti@apple.com>
    216
  • trunk/Source/WebCore/html/HTMLImageElement.cpp

    r213618 r213715  
    290290    if (!m_imageLoader.image() && !renderImageResource.cachedImage())
    291291        renderImage.setImageSizeForAltText();
    292    
    293     renderImage.registerForAsyncImageDecodingCallback();
    294 }
    295    
    296 void HTMLImageElement::willDetachRenderers()
    297 {
    298     if (!is<RenderImage>(renderer()))
    299         return;
    300 
    301     renderer()->unregisterForAsyncImageDecodingCallback();
    302292}
    303293
  • trunk/Source/WebCore/html/HTMLImageElement.h

    r213618 r213715  
    106106
    107107    void didAttachRenderers() override;
    108     void willDetachRenderers() override;
    109108    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
    110109    void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&);
  • trunk/Source/WebCore/page/FrameView.cpp

    r213712 r213715  
    10591059
    10601060    renderView->compositor().flushPendingLayerChanges(&rootFrameForFlush == m_frame.ptr());
    1061    
    1062     if (TiledBacking* tiledBacking = this->tiledBacking())
    1063         requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes(tiledBacking->tileCoverageRect());
    1064    
    10651061    return true;
    10661062}
     
    25322528    viewportContentsChanged();
    25332529}
    2534    
    2535 void FrameView::applyRecursivelyWithAbsoluteRect(const IntRect& rect, const std::function<void(FrameView&, const IntRect&)>& apply)
    2536 {
    2537     apply(*this, rect);
    2538 
    2539     // Recursive call for subframes. We cache the current FrameView's windowClipRect to avoid recomputing it for every subframe.
    2540     IntRect windowClipRect = contentsToWindow(rect);
    2541     SetForScope<IntRect*> windowClipRectCache(m_cachedWindowClipRect, &windowClipRect);
    2542     for (Frame* childFrame = frame().tree().firstChild(); childFrame; childFrame = childFrame->tree().nextSibling()) {
    2543         if (auto* childView = childFrame->view())
    2544             childView->applyRecursivelyWithAbsoluteRect(rect, apply);
    2545     }
    2546 }
    25472530
    25482531void FrameView::applyRecursivelyWithVisibleRect(const std::function<void (FrameView& frameView, const IntRect& visibleRect)>& apply)
     
    25962579    applyRecursivelyWithVisibleRect([] (FrameView& frameView, const IntRect& visibleRect) {
    25972580        frameView.resumeVisibleImageAnimations(visibleRect);
    2598     });
    2599 }
    2600 
    2601 void FrameView::requestAsyncDecodingForImagesInAbsoluteRect(const IntRect& rect)
    2602 {
    2603     if (!frame().view()) {
    2604         // The frame is being destroyed.
    2605         return;
    2606     }
    2607 
    2608     if (rect.isEmpty())
    2609         return;
    2610 
    2611     if (auto* renderView = frame().contentRenderer())
    2612         renderView->requestAsyncDecodingForImagesInAbsoluteRect(rect);
    2613 }
    2614 
    2615 void FrameView::requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes(const IntRect& rect)
    2616 {
    2617     if (!frame().settings().largeImageAsyncDecodingEnabled())
    2618         return;
    2619 
    2620     applyRecursivelyWithAbsoluteRect(rect, [] (FrameView& frameView, const IntRect& rect) {
    2621         frameView.requestAsyncDecodingForImagesInAbsoluteRect(rect);
    26222581    });
    26232582}
  • trunk/Source/WebCore/page/FrameView.h

    r213618 r213715  
    276276    void viewportContentsChanged();
    277277    WEBCORE_EXPORT void resumeVisibleImageAnimationsIncludingSubframes();
    278     void requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes(const IntRect&);
    279278
    280279    String mediaType() const;
     
    647646    void autoSizeIfEnabled();
    648647
    649     void applyRecursivelyWithAbsoluteRect(const IntRect&, const std::function<void(FrameView& frameView, const IntRect& rect)>&);
    650648    void applyRecursivelyWithVisibleRect(const std::function<void (FrameView& frameView, const IntRect& visibleRect)>&);
    651649    void resumeVisibleImageAnimations(const IntRect& visibleRect);
    652650    void updateScriptedAnimationsAndTimersThrottlingState(const IntRect& visibleRect);
    653     void requestAsyncDecodingForImagesInAbsoluteRect(const IntRect&);
    654651
    655652    void updateLayerFlushThrottling();
  • trunk/Source/WebCore/platform/graphics/BitmapImage.cpp

    r213618 r213715  
    6868    if (!destroyAll)
    6969        m_source.destroyDecodedDataBeforeFrame(m_currentFrame);
    70     else if (m_source.hasAsyncDecodingQueue())
     70    else if (m_source.hasDecodingQueue())
    7171        m_source.destroyAllDecodedDataExcludeFrame(m_currentFrame);
    7272    else
     
    7575    // There's no need to throw away the decoder unless we're explicitly asked
    7676    // to destroy all of the frames.
    77     if (!destroyAll || m_source.hasAsyncDecodingQueue())
     77    if (!destroyAll || m_source.hasDecodingQueue())
    7878        m_source.clearFrameBufferCache(m_currentFrame);
    7979    else
     
    104104{
    105105    if (!frameHasValidNativeImageAtIndex(index, subsamplingLevel, sizeForDrawing)) {
    106         LOG(Images, "BitmapImage::%s - %p - url: %s [subsamplingLevel was %d, resampling]", __FUNCTION__, this, sourceURL().utf8().data(), static_cast<int>(frameSubsamplingLevelAtIndex(index)));
     106        LOG(Images, "BitmapImage::%s - %p - url: %s [subsamplingLevel was %d, resampling]", __FUNCTION__, this, sourceURL().characters8(), static_cast<int>(frameSubsamplingLevelAtIndex(index)));
    107107        invalidatePlatformData();
    108108    }
     
    165165    StartAnimationResult result = internalStartAnimation();
    166166
    167     if (result == StartAnimationResult::DecodingActive && showDebugBackground()) {
    168         fillWithSolidColor(context, destRect, Color::yellow, op);
    169         return;
    170     }
    171 
    172     NativeImagePtr image;
    173     if (frameIsBeingDecodedAtIndex(m_currentFrame, m_sizeForDrawing)) {
    174         ASSERT(!canAnimate() && !m_currentFrame);
    175         m_needsRepaint = true;
    176 
    177         if (!frameHasDecodedNativeImage(m_currentFrame)) {
    178             if (showDebugBackground())
    179                 fillWithSolidColor(context, destRect, Color::yellow, op);
    180             return;
    181         }
    182 
    183         image = frameImageAtIndex(m_currentFrame);
    184     } else {
    185         float scale = subsamplingScale(context, destRect, srcRect);
    186         m_currentSubsamplingLevel = allowSubsampling() ? m_source.subsamplingLevelForScale(scale) : SubsamplingLevel::Default;
    187         LOG(Images, "BitmapImage::%s - %p - url: %s [subsamplingLevel = %d scale = %.4f]", __FUNCTION__, this, sourceURL().utf8().data(), static_cast<int>(m_currentSubsamplingLevel), scale);
    188 
    189         ASSERT_IMPLIES(result == StartAnimationResult::DecodingActive, m_source.frameHasValidNativeImageAtIndex(m_currentFrame, m_currentSubsamplingLevel, m_sizeForDrawing));
    190         image = frameImageAtIndex(m_currentFrame, m_currentSubsamplingLevel, m_sizeForDrawing, &context);
    191     }
    192 
    193     if (!image) // If it's too early we won't have an image yet.
    194         return;
    195 
    196     Color color = singlePixelSolidColor();
     167    Color color;
     168    if (result == StartAnimationResult::DecodingActive && showDebugBackground())
     169        color = Color::yellow;
     170    else
     171        color = singlePixelSolidColor();
     172
    197173    if (color.isValid()) {
    198174        fillWithSolidColor(context, destRect, color, op);
    199175        return;
    200176    }
     177
     178    float scale = subsamplingScale(context, destRect, srcRect);
     179    m_currentSubsamplingLevel = allowSubsampling() ? m_source.subsamplingLevelForScale(scale) : SubsamplingLevel::Default;
     180    LOG(Images, "BitmapImage::%s - %p - url: %s [m_currentFrame = %ld subsamplingLevel = %d scale = %.4f]", __FUNCTION__, this, sourceURL().characters8(), m_currentFrame, static_cast<int>(m_currentSubsamplingLevel), scale);
     181
     182    ASSERT_IMPLIES(result == StartAnimationResult::DecodingActive, m_source.frameHasValidNativeImageAtIndex(m_currentFrame, m_currentSubsamplingLevel, m_sizeForDrawing));
     183    auto image = frameImageAtIndex(m_currentFrame, m_currentSubsamplingLevel, m_sizeForDrawing, &context);
     184    if (!image) // If it's too early we won't have an image yet.
     185        return;
    201186
    202187    ImageOrientation orientation(description.imageOrientation());
     
    283268    if (m_frameTimer)
    284269        return StartAnimationResult::TimerActive;
    285 
     270   
    286271    // Don't start a new animation until we draw the frame that is currently being decoded.
    287272    size_t nextFrame = (m_currentFrame + 1) % frameCount();
    288273    if (frameIsBeingDecodedAtIndex(nextFrame, m_sizeForDrawing)) {
    289         LOG(Images, "BitmapImage::%s - %p - url: %s [nextFrame = %ld is being decoded]", __FUNCTION__, this, sourceURL().utf8().data(), nextFrame);
     274        LOG(Images, "BitmapImage::%s - %p - url: %s [nextFrame = %ld is being decoded]", __FUNCTION__, this, sourceURL().characters8(), nextFrame);
    290275        return StartAnimationResult::DecodingActive;
    291276    }
     
    333318#if !LOG_DISABLED
    334319        if (isAsyncDecode)
    335             LOG(Images, "BitmapImage::%s - %p - url: %s [requesting async decoding for nextFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), nextFrame);
     320            LOG(Images, "BitmapImage::%s - %p - url: %s [requesting async decoding for nextFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), nextFrame);
    336321        else
    337             LOG(Images, "BitmapImage::%s - %p - url: %s [cachedFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), ++m_cachedFrameCount, nextFrame);
     322            LOG(Images, "BitmapImage::%s - %p - url: %s [cachedFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), ++m_cachedFrameCount, nextFrame);
    338323#else
    339324        UNUSED_PARAM(isAsyncDecode);
     
    362347        }
    363348    }
    364 
     349   
    365350    // Don't advance to nextFrame unless its decoding has finished or was not required.
    366351    size_t nextFrame = (m_currentFrame + 1) % frameCount();
     
    371356        if (showDebugBackground())
    372357            imageObserver()->changedInRect(this);
    373         LOG(Images, "BitmapImage::%s - %p - url: %s [lateFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), ++m_lateFrameCount, nextFrame);
     358        LOG(Images, "BitmapImage::%s - %p - url: %s [lateFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), ++m_lateFrameCount, nextFrame);
    374359    }
    375360}
     
    385370        imageObserver()->animationAdvanced(this);
    386371
    387     LOG(Images, "BitmapImage::%s - %p - url: %s [m_currentFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), m_currentFrame);
     372    LOG(Images, "BitmapImage::%s - %p - url: %s [m_currentFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), m_currentFrame);
    388373}
    389374
     
    411396{
    412397    UNUSED_PARAM(index);
    413     if (canAnimate()) {
    414         ASSERT(index == (m_currentFrame + 1) % frameCount());
    415        
    416         // Don't advance to nextFrame unless the timer was fired before its decoding finishes.
    417         if (canAnimate() && !m_frameTimer)
    418             internalAdvanceAnimation();
    419         else
    420             LOG(Images, "BitmapImage::%s - %p - url: %s [earlyFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), ++m_earlyFrameCount, index);
    421     } else {
    422         ASSERT(index == m_currentFrame && !m_currentFrame);
    423        
    424         if (m_needsRepaint) {
    425             imageObserver()->changedInRect(this, nullptr);
    426             m_needsRepaint = false;
    427         }
    428        
    429         // Keep the number of decoding threads under control.
    430         if (m_source.isAsyncDecodingQueueIdle())
    431             m_source.stopAsyncDecodingQueue();
    432     }
    433 }
    434 
    435 void BitmapImage::requestAsyncDecoding(const IntSize& sizeForDrawing)
    436 {
    437     if (!isLargeImageAsyncDecodingRequired())
    438         return;
    439 
    440     ASSERT(!m_currentFrame);
    441     bool isAsyncDecode = m_source.requestFrameAsyncDecodingAtIndex(0, m_currentSubsamplingLevel, sizeForDrawing);
    442 
    443 #if !LOG_DISABLED
    444     if (isAsyncDecode)
    445         LOG(Images, "BitmapImage::%s - %p - url: %s", __FUNCTION__, this, sourceURL().utf8().data());
    446 #else
    447     UNUSED_PARAM(isAsyncDecode);
    448 #endif
     398    ASSERT(index == (m_currentFrame + 1) % frameCount());
     399
     400    // Don't advance to nextFrame unless the timer was fired before its decoding finishes.
     401    if (canAnimate() && !m_frameTimer)
     402        internalAdvanceAnimation();
     403    else
     404        LOG(Images, "BitmapImage::%s - %p - url: %s [earlyFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), ++m_earlyFrameCount, index);
    449405}
    450406
  • trunk/Source/WebCore/platform/graphics/BitmapImage.h

    r213618 r213715  
    174174    void resetAnimation() override;
    175175    void newFrameNativeImageAvailableAtIndex(size_t) override;
    176     void requestAsyncDecoding(const IntSize& sizeForDrawing) override;
    177176
    178177    // Handle platform-specific data
     
    209208    double m_desiredFrameStartTime { 0 }; // The system time at which we hope to see the next call to startAnimation().
    210209    bool m_animationFinished { false };
    211     bool m_needsRepaint { false };
    212210
    213211    float m_frameDecodingDurationForTesting { 0 };
  • trunk/Source/WebCore/platform/graphics/Image.h

    r213618 r213715  
    131131    virtual void resetAnimation() {}
    132132    virtual void newFrameNativeImageAvailableAtIndex(size_t) { }
    133     virtual void requestAsyncDecoding(const IntSize&) { }
    134133   
    135134    // Typically the CachedImage that owns us.
  • trunk/Source/WebCore/platform/graphics/ImageFrameCache.cpp

    r213618 r213715  
    6868ImageFrameCache::~ImageFrameCache()
    6969{
    70     ASSERT(!hasAsyncDecodingQueue());
     70    ASSERT(!hasDecodingQueue());
    7171}
    7272
     
    257257{
    258258    if (!m_decodingQueue)
    259         m_decodingQueue = WorkQueue::create("org.webkit.ImageDecoder", WorkQueue::Type::Serial, WorkQueue::QOS::Default);
     259        m_decodingQueue = WorkQueue::create("org.webkit.ImageDecoder", WorkQueue::Type::Serial, WorkQueue::QOS::UserInteractive);
    260260   
    261261    return *m_decodingQueue;
     
    264264void ImageFrameCache::startAsyncDecodingQueue()
    265265{
    266     if (hasAsyncDecodingQueue() || !isDecoderAvailable())
     266    if (hasDecodingQueue() || !isDecoderAvailable())
    267267        return;
    268268
     
    307307        return false;
    308308
    309     if (!hasAsyncDecodingQueue())
     309    if (!hasDecodingQueue())
    310310        startAsyncDecodingQueue();
    311311   
     
    315315}
    316316
    317 bool ImageFrameCache::isAsyncDecodingQueueIdle() const
    318 {
    319     for (const ImageFrame& frame : m_frames) {
    320         if (frame.isBeingDecoded())
    321             return false;
    322     }
    323     return true;
    324 }
    325    
    326317void ImageFrameCache::stopAsyncDecodingQueue()
    327318{
    328     if (!hasAsyncDecodingQueue())
     319    if (!hasDecodingQueue())
    329320        return;
    330321   
  • trunk/Source/WebCore/platform/graphics/ImageFrameCache.h

    r213618 r213715  
    7272    bool requestFrameAsyncDecodingAtIndex(size_t, SubsamplingLevel, const IntSize&);
    7373    void stopAsyncDecodingQueue();
    74     bool hasAsyncDecodingQueue() const { return m_decodingQueue; }
    75     bool isAsyncDecodingQueueIdle() const;
     74    bool hasDecodingQueue() { return m_decodingQueue; }
    7675
    7776    // Image metadata which is calculated either by the ImageDecoder or directly
  • trunk/Source/WebCore/platform/graphics/ImageSource.h

    r213618 r213715  
    7171    bool isAsyncDecodingRequired();
    7272    bool requestFrameAsyncDecodingAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const IntSize& sizeForDrawing) { return m_frameCache->requestFrameAsyncDecodingAtIndex(index, subsamplingLevel, sizeForDrawing); }
    73     bool hasAsyncDecodingQueue() const { return m_frameCache->hasAsyncDecodingQueue(); }
    74     bool isAsyncDecodingQueueIdle() const  { return m_frameCache->isAsyncDecodingQueueIdle(); }
     73    bool hasDecodingQueue() const { return m_frameCache->hasDecodingQueue(); }
    7574    void stopAsyncDecodingQueue() { m_frameCache->stopAsyncDecodingQueue(); }
    7675
  • trunk/Source/WebCore/platform/graphics/TiledBacking.h

    r213618 r213715  
    146146    virtual IntRect boundsWithoutMargin() const = 0;
    147147
     148    // Exposed for testing
    148149    virtual IntRect tileCoverageRect() const = 0;
     150    virtual IntRect tileGridExtent() const = 0;
    149151    virtual void setScrollingModeIndication(ScrollingModeIndication) = 0;
    150 
    151     // Exposed for testing
    152     virtual IntRect tileGridExtent() const = 0;
    153152
    154153#if USE(CA)
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r213618 r213715  
    155155    if (isRegisteredForVisibleInViewportCallback())
    156156        view().unregisterForVisibleInViewportCallback(*this);
    157     if (isRegisteredForAsyncImageDecodingCallback())
    158         view().unregisterForAsyncImageDecodingCallback(*this);
    159157}
    160158
     
    14371435}
    14381436
    1439 bool RenderElement::intersectsAbsoluteRect(const IntRect& rect) const
    1440 {
    1441     if (style().visibility() != VISIBLE)
     1437static bool shouldRepaintForImageAnimation(const RenderElement& renderer, const IntRect& visibleRect)
     1438{
     1439    const Document& document = renderer.document();
     1440    if (document.activeDOMObjectsAreSuspended())
    14421441        return false;
    1443     if (view().frameView().isOffscreen())
     1442    if (renderer.style().visibility() != VISIBLE)
     1443        return false;
     1444    if (renderer.view().frameView().isOffscreen())
    14441445        return false;
    14451446
     
    14481449    // be propagated to the root. At this point, we unfortunately don't have access to the image anymore so we
    14491450    // can no longer check if it is a background image.
    1450     bool backgroundIsPaintedByRoot = isDocumentElementRenderer();
    1451     if (isBody()) {
    1452         auto& rootRenderer = *parent(); // If <body> has a renderer then <html> does too.
     1451    bool backgroundIsPaintedByRoot = renderer.isDocumentElementRenderer();
     1452    if (renderer.isBody()) {
     1453        auto& rootRenderer = *renderer.parent(); // If <body> has a renderer then <html> does too.
    14531454        ASSERT(rootRenderer.isDocumentElementRenderer());
    14541455        ASSERT(is<HTMLHtmlElement>(rootRenderer.element()));
     
    14571458
    14581459    }
    1459     LayoutRect backgroundPaintingRect = backgroundIsPaintedByRoot ? view().backgroundRect() : absoluteClippedOverflowRect();
    1460     return rect.intersects(enclosingIntRect(backgroundPaintingRect));
     1460    LayoutRect backgroundPaintingRect = backgroundIsPaintedByRoot ? renderer.view().backgroundRect() : renderer.absoluteClippedOverflowRect();
     1461    if (!visibleRect.intersects(enclosingIntRect(backgroundPaintingRect)))
     1462        return false;
     1463
     1464    return true;
    14611465}
    14621466
     
    14931497    auto& frameView = view().frameView();
    14941498    auto visibleRect = frameView.windowToContents(frameView.windowClipRect());
    1495     if (document().activeDOMObjectsAreSuspended() || !intersectsAbsoluteRect(visibleRect)) {
     1499    if (!shouldRepaintForImageAnimation(*this, visibleRect)) {
    14961500        // FIXME: It would be better to pass the image along with the renderer
    14971501        // so that we can be smarter about detecting if the image is inside the
     
    15061510{
    15071511    ASSERT(m_hasPausedImageAnimations);
    1508     if (document().activeDOMObjectsAreSuspended() || !intersectsAbsoluteRect(visibleRect))
     1512    if (!shouldRepaintForImageAnimation(*this, visibleRect))
    15091513        return false;
    15101514
     
    15161520
    15171521    return true;
    1518 }
    1519    
    1520 void RenderElement::registerForAsyncImageDecodingCallback()
    1521 {
    1522     if (isRegisteredForAsyncImageDecodingCallback())
    1523         return;
    1524 
    1525     view().registerForAsyncImageDecodingCallback(*this);
    1526     setIsRegisteredForAsyncImageDecodingCallback(true);
    1527 }
    1528    
    1529 void RenderElement::unregisterForAsyncImageDecodingCallback()
    1530 {
    1531     if (!isRegisteredForAsyncImageDecodingCallback())
    1532         return;
    1533 
    1534     view().unregisterForAsyncImageDecodingCallback(*this);
    1535     setIsRegisteredForAsyncImageDecodingCallback(false);
    15361522}
    15371523
  • trunk/Source/WebCore/rendering/RenderElement.h

    r213618 r213715  
    139139    bool borderImageIsLoadedAndCanBeRendered() const;
    140140    bool mayCauseRepaintInsideViewport(const IntRect* visibleRect = nullptr) const;
    141     bool intersectsAbsoluteRect(const IntRect&) const;
    142141
    143142    // Returns true if this renderer requires a new stacking context.
     
    192191    bool hasPausedImageAnimations() const { return m_hasPausedImageAnimations; }
    193192    void setHasPausedImageAnimations(bool b) { m_hasPausedImageAnimations = b; }
    194    
    195     void registerForAsyncImageDecodingCallback();
    196     void unregisterForAsyncImageDecodingCallback();
    197193
    198194    void setRenderBoxNeedsLazyRepaint(bool b) { m_renderBoxNeedsLazyRepaint = b; }
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r213618 r213715  
    19961996        ensureRareData().setVisibleInViewportState(visible);
    19971997}
    1998    
    1999 void RenderObject::setIsRegisteredForAsyncImageDecodingCallback(bool registered)
    2000 {
    2001     if (registered || hasRareData())
    2002         ensureRareData().setIsRegisteredForAsyncImageDecodingCallback(registered);
    2003 }
    20041998
    20051999RenderObject::RareDataMap& RenderObject::rareDataMap()
  • trunk/Source/WebCore/rendering/RenderObject.h

    r213618 r213715  
    459459    };
    460460    VisibleInViewportState visibleInViewportState() { return m_bitfields.hasRareData() ? rareData().visibleInViewportState() : VisibilityUnknown; }
    461    
    462     bool isRegisteredForAsyncImageDecodingCallback() { return m_bitfields.hasRareData() && rareData().isRegisteredForAsyncImageDecodingCallback(); }
    463461
    464462    bool hasLayer() const { return m_bitfields.hasLayer(); }
     
    572570    void setIsRegisteredForVisibleInViewportCallback(bool);
    573571    void setVisibleInViewportState(VisibleInViewportState);
    574     void setIsRegisteredForAsyncImageDecodingCallback(bool);
    575572
    576573    // Hook so that RenderTextControl can return the line height of its inner renderer.
     
    989986            , m_isRegisteredForVisibleInViewportCallback(false)
    990987            , m_visibleInViewportState(VisibilityUnknown)
    991             , m_isRegisteredForAsyncImageDecodingCallback(false)
    992988        {
    993989        }
     
    1000996        ADD_BOOLEAN_BITFIELD(isRegisteredForVisibleInViewportCallback, IsRegisteredForVisibleInViewportCallback);
    1001997        ADD_ENUM_BITFIELD(visibleInViewportState, VisibleInViewportState, VisibleInViewportState, 2);
    1002         ADD_BOOLEAN_BITFIELD(isRegisteredForAsyncImageDecodingCallback, IsRegisteredForAsyncImageDecodingCallback);
    1003998        std::unique_ptr<RenderStyle> cachedFirstLineStyle;
    1004999    };
  • trunk/Source/WebCore/rendering/RenderReplaced.h

    r213618 r213715  
    3333    LayoutUnit computeReplacedLogicalHeight() const override;
    3434
    35     LayoutSize intrinsicSize() const final { return m_intrinsicSize; }
    3635    LayoutRect replacedContentRect(const LayoutSize& intrinsicSize) const;
    3736
     
    4746    void layout() override;
    4847
     48    LayoutSize intrinsicSize() const final { return m_intrinsicSize; }
    4949    void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const override;
    5050
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r213639 r213715  
    3636#include "HTMLIFrameElement.h"
    3737#include "HitTestResult.h"
    38 #include "Image.h"
    3938#include "ImageQualityController.h"
    4039#include "NodeTraversal.h"
    4140#include "Page.h"
    42 #include "RenderDescendantIterator.h"
    4341#include "RenderGeometryMap.h"
    44 #include "RenderImage.h"
    4542#include "RenderIterator.h"
    4643#include "RenderLayer.h"
     
    14261423}
    14271424
    1428 void RenderView::registerForAsyncImageDecodingCallback(RenderElement& renderer)
    1429 {
    1430     ASSERT(!m_asyncDecodingImageRenderers.contains(&renderer));
    1431     m_asyncDecodingImageRenderers.add(&renderer);
    1432 }
    1433 
    1434 void RenderView::unregisterForAsyncImageDecodingCallback(RenderElement& renderer)
    1435 {
    1436     ASSERT(m_asyncDecodingImageRenderers.contains(&renderer));
    1437     m_asyncDecodingImageRenderers.remove(&renderer);
    1438 }
    1439    
    1440 void RenderView::requestAsyncDecodingForImagesInAbsoluteRect(const IntRect& rect)
    1441 {
    1442     for (auto* renderer : m_asyncDecodingImageRenderers) {
    1443         if (!renderer->intersectsAbsoluteRect(rect))
    1444             continue;
    1445        
    1446         auto& renderImage = downcast<RenderImage>(*renderer);
    1447        
    1448         CachedImage* image = renderImage.cachedImage();
    1449         if (!image || !image->hasImage())
    1450             continue;
    1451 
    1452         // Get the destination rectangle of the image scaled by the all the scaling factors
    1453         // that will eventually be applied to the graphics context.
    1454         LayoutRect replacedContentRect = renderImage.replacedContentRect(renderImage.intrinsicSize());
    1455         FloatRect rect = snapRectToDevicePixels(replacedContentRect, document().deviceScaleFactor());
    1456         rect.scale(frame().page()->pageScaleFactor() * frame().pageZoomFactor() * document().deviceScaleFactor());
    1457 
    1458         image->image()->requestAsyncDecoding(expandedIntSize(rect.size()));
    1459     }
    1460 }
    1461 
    14621425RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator(RenderView* view)
    14631426    : m_rootView(view ? view->document().topDocument().renderView() : nullptr)
  • trunk/Source/WebCore/rendering/RenderView.h

    r213618 r213715  
    232232    void addRendererWithPausedImageAnimations(RenderElement&);
    233233    void removeRendererWithPausedImageAnimations(RenderElement&);
    234     void registerForAsyncImageDecodingCallback(RenderElement&);
    235     void unregisterForAsyncImageDecodingCallback(RenderElement&);
    236     void requestAsyncDecodingForImagesInAbsoluteRect(const IntRect&);
    237234
    238235    class RepaintRegionAccumulator {
     
    392389    HashSet<RenderElement*> m_renderersWithPausedImageAnimation;
    393390    HashSet<RenderElement*> m_visibleInViewportRenderers;
    394     HashSet<RenderElement*> m_asyncDecodingImageRenderers;
    395391    Vector<RefPtr<RenderWidget>> m_protectedRenderWidgets;
    396392
  • trunk/Source/WebKit2/ChangeLog

    r213708 r213715  
     12017-03-10  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r213618.
     4        https://bugs.webkit.org/show_bug.cgi?id=169475
     5
     6        Suspect this is the cause of a large memory regression
     7        (Requested by jonlee_ on #webkit).
     8
     9        Reverted changeset:
     10
     11        "Enable async image decoding for large images"
     12        https://bugs.webkit.org/show_bug.cgi?id=165039
     13        http://trac.webkit.org/changeset/213618
     14
    1152017-03-10  Zan Dobersek  <zdobersek@igalia.com>
    216
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r213676 r213715  
    16921692}
    16931693
    1694 void WKPreferencesSetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef, bool flag)
    1695 {
    1696     toImpl(preferencesRef)->setLargeImageAsyncDecodingEnabled(flag);
    1697 }
    1698 
    1699 bool WKPreferencesGetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef)
    1700 {
    1701     return toImpl(preferencesRef)->largeImageAsyncDecodingEnabled();
    1702 }
    1703 
    1704 void WKPreferencesSetAnimatedImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef, bool flag)
    1705 {
    1706     toImpl(preferencesRef)->setAnimatedImageAsyncDecodingEnabled(flag);
    1707 }
    1708 
    1709 bool WKPreferencesGetAnimatedImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef)
    1710 {
    1711     return toImpl(preferencesRef)->animatedImageAsyncDecodingEnabled();
    1712 }
    1713 
    17141694void WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef preferencesRef, bool flag)
    17151695{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h

    r213676 r213715  
    466466WK_EXPORT bool WKPreferencesGetSubtleCryptoEnabled(WKPreferencesRef);
    467467
    468 // Defaults to true.
    469 WK_EXPORT void WKPreferencesSetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef, bool flag);
    470 WK_EXPORT bool WKPreferencesGetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef);
    471 
    472 // Defaults to true.
    473 WK_EXPORT void WKPreferencesSetAnimatedImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef, bool flag);
    474 WK_EXPORT bool WKPreferencesGetAnimatedImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef);
    475 
    476468// Defaults to false
    477469WK_EXPORT void WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef, bool flag);
  • trunk/Tools/ChangeLog

    r213696 r213715  
     12017-03-10  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r213618.
     4        https://bugs.webkit.org/show_bug.cgi?id=169475
     5
     6        Suspect this is the cause of a large memory regression
     7        (Requested by jonlee_ on #webkit).
     8
     9        Reverted changeset:
     10
     11        "Enable async image decoding for large images"
     12        https://bugs.webkit.org/show_bug.cgi?id=165039
     13        http://trac.webkit.org/changeset/213618
     14
    1152017-03-09  Brian Nicholson  <bnicholson@mozilla.com> and Alex Christensen  <achristensen@webkit.org>
    216
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r213676 r213715  
    957957   
    958958    [preferences setMediaStreamEnabled:YES];
    959    
    960     [preferences setLargeImageAsyncDecodingEnabled:NO];
    961959
    962960    [WebPreferences _clearNetworkLoaderSession];
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r213688 r213715  
    720720
    721721    WKPreferencesSetMockCaptureDevicesEnabled(preferences, true);
    722    
    723     WKPreferencesSetLargeImageAsyncDecodingEnabled(preferences, false);
    724722
    725723    platformResetPreferencesToConsistentValues();
Note: See TracChangeset for help on using the changeset viewer.