Title: [201144] branches/safari-602.1.32-branch/Source/WebCore

Diff

Modified: branches/safari-602.1.32-branch/Source/WebCore/ChangeLog (201143 => 201144)


--- branches/safari-602.1.32-branch/Source/WebCore/ChangeLog	2016-05-19 08:40:32 UTC (rev 201143)
+++ branches/safari-602.1.32-branch/Source/WebCore/ChangeLog	2016-05-19 08:40:36 UTC (rev 201144)
@@ -1,3 +1,27 @@
+2016-05-19  Babak Shafiei  <[email protected]>
+
+        Merge r201043. rdar://problem/25835802
+
+    2016-05-16  Simon Fraser  <[email protected]>
+
+            BitmapImage::destroyDecodedDataIfNecessary() should only count frames with image data
+            https://bugs.webkit.org/show_bug.cgi?id=157779
+
+            Reviewed by Tim Horton.
+
+            BitmapImage::destroyDecodedDataIfNecessary() throws away all frames of an image if the
+            decoded frame size exceeds a threshold. However, it counts all frames, whether or not
+            they have an image (some frames may only have metadata, but m_frameBytes still returns
+            height*width*4).
+
+            Fix by only count m_frameBytes for frames that have an image.
+
+            * platform/graphics/BitmapImage.cpp:
+            (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
+            * platform/graphics/BitmapImage.h:
+            (WebCore::FrameData::FrameData):
+            (WebCore::FrameData::usedFrameBytes):
+
 2016-05-17  Babak Shafiei  <[email protected]>
 
         Merge r200976. rdar://problem/26231897

Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/graphics/BitmapImage.cpp (201143 => 201144)


--- branches/safari-602.1.32-branch/Source/WebCore/platform/graphics/BitmapImage.cpp	2016-05-19 08:40:32 UTC (rev 201143)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/graphics/BitmapImage.cpp	2016-05-19 08:40:36 UTC (rev 201144)
@@ -156,7 +156,7 @@
 
     unsigned allFrameBytes = 0;
     for (size_t i = 0; i < m_frames.size(); ++i)
-        allFrameBytes += m_frames[i].m_frameBytes;
+        allFrameBytes += m_frames[i].usedFrameBytes();
 
     if (allFrameBytes > largeAnimationCutoff)
         destroyDecodedData(destroyAll);

Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/graphics/BitmapImage.h (201143 => 201144)


--- branches/safari-602.1.32-branch/Source/WebCore/platform/graphics/BitmapImage.h	2016-05-19 08:40:32 UTC (rev 201143)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/graphics/BitmapImage.h	2016-05-19 08:40:36 UTC (rev 201144)
@@ -72,13 +72,9 @@
 struct FrameData {
 public:
     FrameData()
-        : m_orientation(DefaultImageOrientation)
-        , m_subsamplingLevel(0)
-        , m_duration(0)
-        , m_haveMetadata(false)
+        : m_haveMetadata(false)
         , m_isComplete(false)
         , m_hasAlpha(true)
-        , m_frameBytes(0)
     {
     }
 
@@ -90,15 +86,17 @@
     // Clear the cached image data on the frame, and (optionally) the metadata.
     // Returns whether there was cached image data to clear.
     bool clear(bool clearMetadata);
+    
+    unsigned usedFrameBytes() const { return m_image ? m_frameBytes : 0; }
 
     NativeImagePtr m_image;
-    ImageOrientation m_orientation;
-    SubsamplingLevel m_subsamplingLevel;
-    float m_duration;
+    ImageOrientation m_orientation { DefaultImageOrientation };
+    SubsamplingLevel m_subsamplingLevel { 0 };
+    float m_duration { 0 };
     bool m_haveMetadata : 1;
     bool m_isComplete : 1;
     bool m_hasAlpha : 1;
-    unsigned m_frameBytes;
+    unsigned m_frameBytes { 0 };
 };
 
 // =================================================
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to