Title: [110144] trunk/Source/WebCore
Revision
110144
Author
mikelawt...@chromium.org
Date
2012-03-07 20:49:11 -0800 (Wed, 07 Mar 2012)

Log Message

use DEFINE_STATIC_LOCAL on Lengths to avoid exit time destructors
https://bugs.webkit.org/show_bug.cgi?id=80561

Reviewed by Eric Seidel.

This is in preparation for http://wkb.ug/79621 where a destructor is added to Length.

No new tests as this is not a behaviour change.

* css/CSSStyleApplyProperty.cpp:
(WebCore::ApplyPropertyPageSize::getPageSizeFromName):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110143 => 110144)


--- trunk/Source/WebCore/ChangeLog	2012-03-08 04:37:30 UTC (rev 110143)
+++ trunk/Source/WebCore/ChangeLog	2012-03-08 04:49:11 UTC (rev 110144)
@@ -1,3 +1,17 @@
+2012-03-07  Mike Lawther  <mikelawt...@chromium.org>
+
+        use DEFINE_STATIC_LOCAL on Lengths to avoid exit time destructors
+        https://bugs.webkit.org/show_bug.cgi?id=80561
+
+        Reviewed by Eric Seidel.
+
+        This is in preparation for http://wkb.ug/79621 where a destructor is added to Length.
+
+        No new tests as this is not a behaviour change.
+
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::ApplyPropertyPageSize::getPageSizeFromName):
+
 2012-03-07  Adam Barth  <aba...@webkit.org>
 
         ContainerNode::willRemove uses a weak iteration pattern

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (110143 => 110144)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2012-03-08 04:37:30 UTC (rev 110143)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2012-03-08 04:49:11 UTC (rev 110144)
@@ -1216,14 +1216,22 @@
     static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
     static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
     {
-        static const Length a5Width = mmLength(148), a5Height = mmLength(210);
-        static const Length a4Width = mmLength(210), a4Height = mmLength(297);
-        static const Length a3Width = mmLength(297), a3Height = mmLength(420);
-        static const Length b5Width = mmLength(176), b5Height = mmLength(250);
-        static const Length b4Width = mmLength(250), b4Height = mmLength(353);
-        static const Length letterWidth = inchLength(8.5), letterHeight = inchLength(11);
-        static const Length legalWidth = inchLength(8.5), legalHeight = inchLength(14);
-        static const Length ledgerWidth = inchLength(11), ledgerHeight = inchLength(17);
+        DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
+        DEFINE_STATIC_LOCAL(Length, a5Height, (mmLength(210)));
+        DEFINE_STATIC_LOCAL(Length, a4Width, (mmLength(210)));
+        DEFINE_STATIC_LOCAL(Length, a4Height, (mmLength(297)));
+        DEFINE_STATIC_LOCAL(Length, a3Width, (mmLength(297)));
+        DEFINE_STATIC_LOCAL(Length, a3Height, (mmLength(420)));
+        DEFINE_STATIC_LOCAL(Length, b5Width, (mmLength(176)));
+        DEFINE_STATIC_LOCAL(Length, b5Height, (mmLength(250)));
+        DEFINE_STATIC_LOCAL(Length, b4Width, (mmLength(250)));
+        DEFINE_STATIC_LOCAL(Length, b4Height, (mmLength(353)));
+        DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5)));
+        DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11)));
+        DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5)));
+        DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14)));
+        DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11)));
+        DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17)));
 
         if (!pageSizeName)
             return false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to