Changeset 201043 in webkit
- Timestamp:
- May 17, 2016 2:28:57 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r201040 r201043 1 2016-05-16 Simon Fraser <simon.fraser@apple.com> 2 3 BitmapImage::destroyDecodedDataIfNecessary() should only count frames with image data 4 https://bugs.webkit.org/show_bug.cgi?id=157779 5 6 Reviewed by Tim Horton. 7 8 BitmapImage::destroyDecodedDataIfNecessary() throws away all frames of an image if the 9 decoded frame size exceeds a threshold. However, it counts all frames, whether or not 10 they have an image (some frames may only have metadata, but m_frameBytes still returns 11 height*width*4). 12 13 Fix by only count m_frameBytes for frames that have an image. 14 15 * platform/graphics/BitmapImage.cpp: 16 (WebCore::BitmapImage::destroyDecodedDataIfNecessary): 17 * platform/graphics/BitmapImage.h: 18 (WebCore::FrameData::FrameData): 19 (WebCore::FrameData::usedFrameBytes): 20 1 21 2016-05-17 Dave Hyatt <hyatt@apple.com> 2 22 -
trunk/Source/WebCore/platform/graphics/BitmapImage.cpp
r200967 r201043 158 158 unsigned allFrameBytes = 0; 159 159 for (size_t i = 0; i < m_frames.size(); ++i) 160 allFrameBytes += m_frames[i]. m_frameBytes;160 allFrameBytes += m_frames[i].usedFrameBytes(); 161 161 162 162 if (allFrameBytes > largeAnimationCutoff) { 163 LOG(Images, "BitmapImage %p destroyDecodedDataIfNecessary destr yingData: allFrameBytes=%u cutoff=%u", this, allFrameBytes, largeAnimationCutoff);163 LOG(Images, "BitmapImage %p destroyDecodedDataIfNecessary destroyingData: allFrameBytes=%u cutoff=%u", this, allFrameBytes, largeAnimationCutoff); 164 164 destroyDecodedData(destroyAll); 165 165 } -
trunk/Source/WebCore/platform/graphics/BitmapImage.h
r200939 r201043 73 73 public: 74 74 FrameData() 75 : m_orientation(DefaultImageOrientation) 76 , m_subsamplingLevel(0) 77 , m_duration(0) 78 , m_haveMetadata(false) 75 : m_haveMetadata(false) 79 76 , m_isComplete(false) 80 77 , m_hasAlpha(true) 81 , m_frameBytes(0)82 78 { 83 79 } … … 91 87 // Returns whether there was cached image data to clear. 92 88 bool clear(bool clearMetadata); 89 90 unsigned usedFrameBytes() const { return m_image ? m_frameBytes : 0; } 93 91 94 92 NativeImagePtr m_image; 95 ImageOrientation m_orientation ;96 SubsamplingLevel m_subsamplingLevel ;97 float m_duration ;93 ImageOrientation m_orientation { DefaultImageOrientation }; 94 SubsamplingLevel m_subsamplingLevel { 0 }; 95 float m_duration { 0 }; 98 96 bool m_haveMetadata : 1; 99 97 bool m_isComplete : 1; 100 98 bool m_hasAlpha : 1; 101 unsigned m_frameBytes ;99 unsigned m_frameBytes { 0 }; 102 100 }; 103 101
Note: See TracChangeset
for help on using the changeset viewer.