[Webkit-unassigned] [Bug 172325] New: [REGRESSION](r216901): Delete ImageDecoder if BitmapImage::destroyDecodedData() was called to destroy all the decoded frames

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 18 17:42:26 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=172325

            Bug ID: 172325
           Summary: [REGRESSION](r216901): Delete ImageDecoder if
                    BitmapImage::destroyDecodedData() was called to
                    destroy all the decoded frames
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Images
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: sabouhallawa at apple.com

In the change <http://trac.webkit.org/changeset/216901>, the function BitmapImage::destroyDecodedData() was changed such that if destroyAll was true but BitmapImage::destroyDecodedData() returns false, destroyAll was set to false which would lead to not calling ImageSource::clear(). ImageSource::clear() deletes the current ImageDecoder and creates a new one if the Image::data() is not null. Not calling ImageSource::clear() from BitmapImage::destroyDecodedData() when the passed destroyAll is true can cause the following problems:

1) CachedImage::didReplaceSharedBufferContents() calls m_image->destroyDecodedData(true) when the data SharedBuffer is switched and it assumes the current ImageDecoder will be deleted and a new one will be created with the new ShareBuffer.
2) For large images, the ImageDecoder may keep large buffers for raster data. Under memory pressure, the MemoryCache will request all the images to release their decoded frames. Because of https://bugs.webkit.org/show_bug.cgi?id=170640, we can't delete the current decoded frame. But deleting the ImageDecoder itself will release the raster data which will not be needed as long the current decoded frame is still cached.

However for animated images, it is okay not to call ImageSource::clear(). Animating an image happens after receiving all its data. So problem (1) is not a concern here. But deleting the ImageDecoder while animating an image will cause the animation to jitter because the new ImageDecoder has to decode all the frames from 0..currentFrame to be able to decode the nextFrame if it's equal to (currentFrame + 1).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170519/62e031e7/attachment.html>


More information about the webkit-unassigned mailing list