Changeset 156681 in webkit


Ignore:
Timestamp:
Sep 30, 2013 2:54:17 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Don't attempt to destroy decoded frame if a BitmapImage doesn't have encoded raw data.
https://bugs.webkit.org/show_bug.cgi?id=122115

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2013-09-30
Reviewed by Daniel Bates.

With BitmapImage::create(PassNativeImagePtr, ImageObserver*), a BitmapImage could be created by
passing a native image. If this image is added to memory cache, we shouldn't attempt to destroy
its decoded frames since there is no encoded raw data and we won't be able to reconstruct the image again.

No new tests for now. Currently there isn't a code path to add to the memory cache a BitmapImage
that was created by adopting a native image. We'll add such a code path in a subsequent patch.

  • platform/graphics/BitmapImage.cpp:

(WebCore::BitmapImage::destroyDecodedDataIfNecessary):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r156676 r156681  
     12013-09-30  Yongjun Zhang  <yongjun_zhang@apple.com>
     2
     3        Don't attempt to destroy decoded frame if a BitmapImage doesn't have encoded raw data.
     4        https://bugs.webkit.org/show_bug.cgi?id=122115
     5
     6        Reviewed by Daniel Bates.
     7
     8        With BitmapImage::create(PassNativeImagePtr, ImageObserver*), a BitmapImage could be created by
     9        passing a native image.  If this image is added to memory cache, we shouldn't attempt to destroy
     10        its decoded frames since there is no encoded raw data and we won't be able to reconstruct the image again.
     11
     12        No new tests for now. Currently there isn't a code path to add to the memory cache a BitmapImage
     13        that was created by adopting a native image. We'll add such a code path in a subsequent patch.
     14
     15        * platform/graphics/BitmapImage.cpp:
     16        (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
     17
    1182013-09-30  Brady Eidson  <beidson@apple.com>
    219
  • trunk/Source/WebCore/platform/graphics/BitmapImage.cpp

    r156465 r156681  
    9999    // to one frame at a time.
    100100    static const unsigned cLargeAnimationCutoff = 5242880;
     101
     102    // If we have decoded frames but there is no encoded data, we shouldn't destroy
     103    // the decoded image since we won't be able to reconstruct it later.
     104    if (!data() && m_frames.size())
     105        return;
     106
    101107    unsigned allFrameBytes = 0;
    102108    for (size_t i = 0; i < m_frames.size(); ++i)
Note: See TracChangeset for help on using the changeset viewer.