Changeset 215574 in webkit


Ignore:
Timestamp:
Apr 20, 2017 1:09:47 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

CachedImage should cancel loading images for unsupported/unknown types
https://bugs.webkit.org/show_bug.cgi?id=170697

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-04-20
Reviewed by Youenn Fablet.

Currently when the image decoder detects an error with the incoming encoded
data of an image, we mark the image to be a broken image. But the network
process keeps feeding the web process with the rest of the data. We should
cancel loading the rest of the data to save network bandwidth and CPU time
loading and processing useless data.

  • loader/cache/CachedImage.cpp:

(WebCore::CachedImage::addIncrementalDataBuffer):
(WebCore::CachedImage::finishLoading):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r215572 r215574  
     12017-04-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        CachedImage should cancel loading images for unsupported/unknown types
     4        https://bugs.webkit.org/show_bug.cgi?id=170697
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Currently when the image decoder detects an error with the incoming encoded
     9        data of an image, we mark the image to be a broken image. But the network
     10        process keeps feeding the web process with the rest of the data. We should
     11        cancel loading the rest of the data to save network bandwidth and CPU time
     12        loading and processing useless data.
     13
     14        * loader/cache/CachedImage.cpp:
     15        (WebCore::CachedImage::addIncrementalDataBuffer):
     16        (WebCore::CachedImage::finishLoading):
     17
    1182017-04-20  Aaron Chu  <aaron_chu@apple.com>
    219
  • trunk/Source/WebCore/loader/cache/CachedImage.cpp

    r215211 r215574  
    407407        // Image decoding failed. Either we need more image data or the image data is malformed.
    408408        error(errorOccurred() ? status() : DecodeError);
     409        if (m_loader && encodedDataStatus == EncodedDataStatus::Error)
     410            m_loader->cancel();
    409411        if (inCache())
    410412            MemoryCache::singleton().remove(*this);
     
    441443        createImage();
    442444
    443     if (m_image)
    444         m_image->setData(data, true);
    445 
    446     if (!m_image || m_image->isNull()) {
     445    EncodedDataStatus encodedDataStatus = m_image ? m_image->setData(data, true) : EncodedDataStatus::Error;
     446
     447    if (encodedDataStatus == EncodedDataStatus::Error || m_image->isNull()) {
    447448        // Image decoding failed; the image data is malformed.
    448449        error(errorOccurred() ? status() : DecodeError);
Note: See TracChangeset for help on using the changeset viewer.