Changeset 20184 in webkit


Ignore:
Timestamp:
Mar 14, 2007 2:20:47 AM (17 years ago)
Author:
hyatt
Message:

Fix Radar 5050688.

For large animated GIFs, destroy and recreate the source for every animation frame. This keeps
the memory consumption down while giant images are animating.

Reviewed by andersca

  • platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::BitmapImage): (WebCore::BitmapImage::destroyDecodedData): (WebCore::BitmapImage::dataChanged): (WebCore::BitmapImage::advanceAnimation):
  • platform/graphics/BitmapImage.h:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r20183 r20184  
     12007-03-14  David Hyatt  <hyatt@apple.com>
     2
     3        Fix Radar 5050688. 
     4
     5        For large animated GIFs, destroy and recreate the source for every animation frame.  This keeps
     6        the memory consumption down while giant images are animating.
     7
     8        Reviewed by andersca
     9
     10        * platform/graphics/BitmapImage.cpp:
     11        (WebCore::BitmapImage::BitmapImage):
     12        (WebCore::BitmapImage::destroyDecodedData):
     13        (WebCore::BitmapImage::dataChanged):
     14        (WebCore::BitmapImage::advanceAnimation):
     15        * platform/graphics/BitmapImage.h:
     16
    1172007-03-14  David Hyatt  <hyatt@apple.com>
    218
  • trunk/WebCore/platform/graphics/BitmapImage.cpp

    r20182 r20184  
    5252    , m_animatingImageType(true)
    5353    , m_animationFinished(false)
     54    , m_allDataReceived(false)
    5455    , m_haveSize(false)
    5556    , m_sizeAvailable(false)
     
    9596            // while animating that it seems to never clear.
    9697            m_source.clear();
    97             dataChanged(true);
     98            m_source.setData(m_data.get(), m_allDataReceived);
    9899        }
    99100    }
     
    143144   
    144145    // Feed all the data we've seen so far to the image decoder.
     146    m_allDataReceived = allDataReceived;
    145147    m_source.setData(m_data.get(), allDataReceived);
    146148   
     
    265267    int frameSize = m_size.width() * m_size.height() * 4;
    266268    if (frameCount() * frameSize > cLargeAnimationCutoff) {
    267         // Go ahead and decode the next frame so that it can rely on the previous frame.
     269        // Clear and reset the source.
     270        m_source.clear();
     271        m_source.setData(m_data.get(), m_allDataReceived);
     272       
     273        // Go ahead and decode the next frame.
    268274        frameAtIndex(m_currentFrame);
    269275       
     
    271277        if (m_frames[previousFrame].m_frame) {
    272278            m_frames[previousFrame].clear();
    273             m_source.destroyFrameAtIndex(previousFrame);
    274279            m_decodedSize -= frameSize;
    275280            if (imageObserver())
  • trunk/WebCore/platform/graphics/BitmapImage.h

    r20182 r20184  
    183183    bool m_animationFinished;  // Whether or not we've completed the entire animation.
    184184
     185    bool m_allDataReceived;  // Whether or not we've received all our data.
     186
    185187    mutable bool m_haveSize; // Whether or not our |m_size| member variable has the final overall image size yet.
    186188    bool m_sizeAvailable; // Whether or not we can obtain the size of the first image frame yet from ImageIO.
Note: See TracChangeset for help on using the changeset viewer.