Title: [102404] trunk/Source/WebCore
Revision
102404
Author
commit-qu...@webkit.org
Date
2011-12-08 17:31:12 -0800 (Thu, 08 Dec 2011)

Log Message

Use bitfield for bool data members in BitmapImage.
https://bugs.webkit.org/show_bug.cgi?id=74102

Patch by Yongjun Zhang <yongjun_zh...@apple.com> on 2011-12-08
Reviewed by Darin Adler.

Class BitmapImage and FrameData has bool data members, we can use bitfield for those data
members to reduce the BitmapImage's memory footprint.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::BitmapImage):
* platform/graphics/BitmapImage.h:
(WebCore::FrameData::FrameData):
* platform/graphics/cairo/ImageCairo.cpp:
(WebCore::BitmapImage::BitmapImage):
* platform/graphics/cg/ImageCG.cpp:
(WebCore::BitmapImage::BitmapImage):
* platform/graphics/openvg/ImageOpenVG.cpp:
(WebCore::BitmapImage::BitmapImage):
* platform/graphics/qt/ImageQt.cpp:
(WebCore::BitmapImage::BitmapImage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102403 => 102404)


--- trunk/Source/WebCore/ChangeLog	2011-12-09 01:16:22 UTC (rev 102403)
+++ trunk/Source/WebCore/ChangeLog	2011-12-09 01:31:12 UTC (rev 102404)
@@ -1,3 +1,26 @@
+2011-12-08  Yongjun Zhang  <yongjun_zh...@apple.com>
+
+        Use bitfield for bool data members in BitmapImage.
+        https://bugs.webkit.org/show_bug.cgi?id=74102
+
+        Reviewed by Darin Adler.
+
+        Class BitmapImage and FrameData has bool data members, we can use bitfield for those data
+        members to reduce the BitmapImage's memory footprint.
+
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::BitmapImage):
+        * platform/graphics/BitmapImage.h:
+        (WebCore::FrameData::FrameData):
+        * platform/graphics/cairo/ImageCairo.cpp:
+        (WebCore::BitmapImage::BitmapImage):
+        * platform/graphics/cg/ImageCG.cpp:
+        (WebCore::BitmapImage::BitmapImage):
+        * platform/graphics/openvg/ImageOpenVG.cpp:
+        (WebCore::BitmapImage::BitmapImage):
+        * platform/graphics/qt/ImageQt.cpp:
+        (WebCore::BitmapImage::BitmapImage):
+
 2011-12-08  Anders Carlsson  <ander...@apple.com>
 
         Fix a paste-o in ScrollAnimatorMac::updateScrollerStyle

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (102403 => 102404)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2011-12-09 01:16:22 UTC (rev 102403)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2011-12-09 01:31:12 UTC (rev 102404)
@@ -52,6 +52,9 @@
     , m_repetitionCountStatus(Unknown)
     , m_repetitionsComplete(0)
     , m_desiredFrameStartTime(0)
+    , m_decodedSize(0)
+    , m_decodedPropertiesSize(0)
+    , m_frameCount(0)
     , m_isSolidColor(false)
     , m_checkedForSolidColor(false)
     , m_animationFinished(false)
@@ -59,10 +62,7 @@
     , m_haveSize(false)
     , m_sizeAvailable(false)
     , m_hasUniformFrameSize(true)
-    , m_decodedSize(0)
-    , m_decodedPropertiesSize(0)
     , m_haveFrameCount(false)
-    , m_frameCount(0)
 {
     initPlatformData();
 }

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (102403 => 102404)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.h	2011-12-09 01:16:22 UTC (rev 102403)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h	2011-12-09 01:31:12 UTC (rev 102404)
@@ -69,9 +69,9 @@
 public:
     FrameData()
         : m_frame(0)
+        , m_duration(0)
         , m_haveMetadata(false)
         , m_isComplete(false)
-        , m_duration(0)
         , m_hasAlpha(true) 
     {
     }
@@ -86,10 +86,10 @@
     bool clear(bool clearMetadata);
 
     NativeImagePtr m_frame;
-    bool m_haveMetadata;
-    bool m_isComplete;
     float m_duration;
-    bool m_hasAlpha;
+    bool m_haveMetadata : 1;
+    bool m_isComplete : 1;
+    bool m_hasAlpha : 1;
 };
 
 // =================================================
@@ -275,22 +275,21 @@
 #endif
 
     Color m_solidColor;  // If we're a 1x1 solid color, this is the color to use to fill.
-    bool m_isSolidColor;  // Whether or not we are a 1x1 solid image.
-    bool m_checkedForSolidColor; // Whether we've checked the frame for solid color.
 
-    bool m_animationFinished;  // Whether or not we've completed the entire animation.
-
-    bool m_allDataReceived;  // Whether or not we've received all our data.
-
-    mutable bool m_haveSize; // Whether or not our |m_size| member variable has the final overall image size yet.
-    bool m_sizeAvailable; // Whether or not we can obtain the size of the first image frame yet from ImageIO.
-    mutable bool m_hasUniformFrameSize;
-
     unsigned m_decodedSize; // The current size of all decoded frames.
     mutable unsigned m_decodedPropertiesSize; // The size of data decoded by the source to determine image properties (e.g. size, frame count, etc).
-
-    mutable bool m_haveFrameCount;
     size_t m_frameCount;
+
+    bool m_isSolidColor : 1; // Whether or not we are a 1x1 solid image.
+    bool m_checkedForSolidColor : 1; // Whether we've checked the frame for solid color.
+
+    bool m_animationFinished : 1; // Whether or not we've completed the entire animation.
+
+    bool m_allDataReceived : 1; // Whether or not we've received all our data.
+    mutable bool m_haveSize : 1; // Whether or not our |m_size| member variable has the final overall image size yet.
+    bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the first image frame yet from ImageIO.
+    mutable bool m_hasUniformFrameSize : 1;
+    mutable bool m_haveFrameCount : 1;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageCairo.cpp (102403 => 102404)


--- trunk/Source/WebCore/platform/graphics/cairo/ImageCairo.cpp	2011-12-09 01:16:22 UTC (rev 102403)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageCairo.cpp	2011-12-09 01:31:12 UTC (rev 102404)
@@ -66,15 +66,15 @@
     , m_repetitionCount(cAnimationNone)
     , m_repetitionCountStatus(Unknown)
     , m_repetitionsComplete(0)
+    , m_decodedSize(0)
+    , m_frameCount(1)
     , m_isSolidColor(false)
     , m_checkedForSolidColor(false)
     , m_animationFinished(true)
     , m_allDataReceived(true)
     , m_haveSize(true)
     , m_sizeAvailable(true)
-    , m_decodedSize(0)
     , m_haveFrameCount(true)
-    , m_frameCount(1)
 {
     initPlatformData();
 

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageCG.cpp (102403 => 102404)


--- trunk/Source/WebCore/platform/graphics/cg/ImageCG.cpp	2011-12-09 01:16:22 UTC (rev 102403)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageCG.cpp	2011-12-09 01:31:12 UTC (rev 102404)
@@ -74,15 +74,15 @@
     , m_repetitionCount(cAnimationNone)
     , m_repetitionCountStatus(Unknown)
     , m_repetitionsComplete(0)
+    , m_decodedSize(0)
+    , m_frameCount(1)
     , m_isSolidColor(false)
     , m_checkedForSolidColor(false)
     , m_animationFinished(true)
     , m_allDataReceived(true)
     , m_haveSize(true)
     , m_sizeAvailable(true)
-    , m_decodedSize(0)
     , m_haveFrameCount(true)
-    , m_frameCount(1)
 {
     initPlatformData();
     

Modified: trunk/Source/WebCore/platform/graphics/openvg/ImageOpenVG.cpp (102403 => 102404)


--- trunk/Source/WebCore/platform/graphics/openvg/ImageOpenVG.cpp	2011-12-09 01:16:22 UTC (rev 102403)
+++ trunk/Source/WebCore/platform/graphics/openvg/ImageOpenVG.cpp	2011-12-09 01:31:12 UTC (rev 102404)
@@ -60,6 +60,7 @@
     , m_repetitionCountStatus(Unknown)
     , m_repetitionsComplete(0)
     , m_desiredFrameStartTime(0)
+    , m_frameCount(1)
     , m_isSolidColor(false)
     , m_checkedForSolidColor(false)
     , m_animationFinished(false)
@@ -68,7 +69,6 @@
     , m_sizeAvailable(true)
     , m_hasUniformFrameSize(true)
     , m_haveFrameCount(true)
-    , m_frameCount(1)
 {
     initPlatformData();
 

Modified: trunk/Source/WebCore/platform/graphics/qt/ImageQt.cpp (102403 => 102404)


--- trunk/Source/WebCore/platform/graphics/qt/ImageQt.cpp	2011-12-09 01:16:22 UTC (rev 102403)
+++ trunk/Source/WebCore/platform/graphics/qt/ImageQt.cpp	2011-12-09 01:31:12 UTC (rev 102404)
@@ -198,15 +198,15 @@
     , m_repetitionCount(cAnimationNone)
     , m_repetitionCountStatus(Unknown)
     , m_repetitionsComplete(0)
+    , m_decodedSize(0)
+    , m_frameCount(1)
     , m_isSolidColor(false)
     , m_checkedForSolidColor(false)
     , m_animationFinished(true)
     , m_allDataReceived(true)
     , m_haveSize(true)
     , m_sizeAvailable(true)
-    , m_decodedSize(0)
     , m_haveFrameCount(true)
-    , m_frameCount(1)
 {
     initPlatformData();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to