Replace DEPRECATED_DEFINE_STATIC_LOCAL by static NeverDestroyed<T> in css
authorsvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Mar 2014 08:35:29 +0000 (08:35 +0000)
committersvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Mar 2014 08:35:29 +0000 (08:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130409

Reviewed by Darin Adler.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::logUnimplementedPropertyID):
* css/CSSDefaultStyleSheets.cpp:
(WebCore::screenEval):
(WebCore::printEval):
* css/CSSParser.cpp:
(WebCore::strictCSSParserContext):
* css/CSSPrimitiveValue.cpp:
(WebCore::cssTextCache):
* css/CSSProperty.cpp:
(WebCore::borderDirections):
* css/CSSStyleRule.cpp:
(WebCore::selectorTextCache):
* css/CSSValuePool.cpp:
(WebCore::cssValuePool):
* css/CSSValuePool.h:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyPageSize::getPageSizeFromName):
(WebCore::DeprecatedStyleBuilder::sharedStyleBuilder):
* css/DeprecatedStyleBuilder.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166486 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSDefaultStyleSheets.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSStyleRule.cpp
Source/WebCore/css/CSSValuePool.cpp
Source/WebCore/css/CSSValuePool.h
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/css/DeprecatedStyleBuilder.h

index 9a63a89..36f5fc3 100644 (file)
@@ -1,3 +1,31 @@
+2014-03-28  Sergio Villar Senin  <svillar@igalia.com>
+
+        Replace DEPRECATED_DEFINE_STATIC_LOCAL by static NeverDestroyed<T> in css
+        https://bugs.webkit.org/show_bug.cgi?id=130409
+
+        Reviewed by Darin Adler.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::logUnimplementedPropertyID):
+        * css/CSSDefaultStyleSheets.cpp:
+        (WebCore::screenEval):
+        (WebCore::printEval):
+        * css/CSSParser.cpp:
+        (WebCore::strictCSSParserContext):
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::cssTextCache):
+        * css/CSSProperty.cpp:
+        (WebCore::borderDirections):
+        * css/CSSStyleRule.cpp:
+        (WebCore::selectorTextCache):
+        * css/CSSValuePool.cpp:
+        (WebCore::cssValuePool):
+        * css/CSSValuePool.h:
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::ApplyPropertyPageSize::getPageSizeFromName):
+        (WebCore::DeprecatedStyleBuilder::sharedStyleBuilder):
+        * css/DeprecatedStyleBuilder.h:
+
 2014-03-30  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [GTK] [TextureMapper] Weird brightness with some videos with acceletared compositing
index ff84995..f0deb95 100644 (file)
@@ -65,6 +65,7 @@
 #include "StyleResolver.h"
 #include "WebKitCSSTransformValue.h"
 #include "WebKitFontFamilyNames.h"
+#include <wtf/NeverDestroyed.h>
 #include <wtf/text/StringBuilder.h>
 
 #if ENABLE(CSS_GRID_LAYOUT)
@@ -1435,8 +1436,8 @@ static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, CSSPrope
 
 static void logUnimplementedPropertyID(CSSPropertyID propertyID)
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
-    if (!propertyIDSet.add(propertyID).isNewEntry)
+    static NeverDestroyed<HashSet<CSSPropertyID>> propertyIDSet;
+    if (!propertyIDSet.get().add(propertyID).isNewEntry)
         return;
 
     LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(propertyID));
index 7ced04d..8a164d5 100644 (file)
@@ -39,6 +39,7 @@
 #include "RuleSet.h"
 #include "StyleSheetContents.h"
 #include "UserAgentStyleSheets.h"
+#include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 
@@ -68,13 +69,13 @@ static inline bool elementCanUseSimpleDefaultStyle(Element* e)
 
 static const MediaQueryEvaluator& screenEval()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticScreenEval, ("screen"));
+    static NeverDestroyed<const MediaQueryEvaluator> staticScreenEval("screen");
     return staticScreenEval;
 }
 
 static const MediaQueryEvaluator& printEval()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticPrintEval, ("print"));
+    static NeverDestroyed<const MediaQueryEvaluator> staticPrintEval("print");
     return staticPrintEval;
 }
 
index dfba9d8..ba44140 100644 (file)
@@ -86,6 +86,7 @@
 #include <bitset>
 #include <limits.h>
 #include <wtf/HexNumber.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/dtoa.h>
 #include <wtf/text/StringBuffer.h>
@@ -241,7 +242,7 @@ private:
 
 const CSSParserContext& strictCSSParserContext()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(CSSParserContext, strictContext, (CSSStrictMode));
+    static NeverDestroyed<CSSParserContext> strictContext(CSSStrictMode);
     return strictContext;
 }
 
index 882b1f8..864ec63 100644 (file)
@@ -41,6 +41,7 @@
 #include "StyleSheetContents.h"
 #include <wtf/ASCIICType.h>
 #include <wtf/DecimalNumber.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/StringBuffer.h>
 #include <wtf/text/StringBuilder.h>
@@ -176,7 +177,7 @@ CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitCategory(CSSPrimitiveValu
 typedef HashMap<const CSSPrimitiveValue*, String> CSSTextCache;
 static CSSTextCache& cssTextCache()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(CSSTextCache, cache, ());
+    static NeverDestroyed<CSSTextCache> cache;
     return cache;
 }
 
index 5648fd7..e6ec202 100644 (file)
@@ -25,6 +25,7 @@
 #include "RenderStyleConstants.h"
 #include "StylePropertyShorthand.h"
 
+#include <wtf/NeverDestroyed.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -173,7 +174,7 @@ static CSSPropertyID resolveToPhysicalProperty(WritingMode writingMode, LogicalE
 static const StylePropertyShorthand& borderDirections()
 {
     static const CSSPropertyID properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
-    DEPRECATED_DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderDirections, (CSSPropertyBorder, properties, WTF_ARRAY_LENGTH(properties)));
+    static NeverDestroyed<StylePropertyShorthand> borderDirections(CSSPropertyBorder, properties, WTF_ARRAY_LENGTH(properties));
     return borderDirections;
 }
 
index 4567363..800c63b 100644 (file)
@@ -30,6 +30,7 @@
 #include "RuleSet.h"
 #include "StyleProperties.h"
 #include "StyleRule.h"
+#include <wtf/NeverDestroyed.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -37,7 +38,7 @@ namespace WebCore {
 typedef HashMap<const CSSStyleRule*, String> SelectorTextCache;
 static SelectorTextCache& selectorTextCache()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(SelectorTextCache, cache, ());
+    static NeverDestroyed<SelectorTextCache> cache;
     return cache;
 }
 
index e0e16da..dda8f2a 100644 (file)
@@ -35,7 +35,7 @@ namespace WebCore {
 
 CSSValuePool& cssValuePool()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(CSSValuePool, pool, ());
+    static NeverDestroyed<CSSValuePool> pool;
     return pool;
 }
 
index 44b00a9..4990e22 100644 (file)
@@ -32,6 +32,7 @@
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include <wtf/HashMap.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/AtomicStringHash.h>
 
@@ -85,7 +86,7 @@ private:
     typedef HashMap<String, RefPtr<CSSPrimitiveValue>> FontFamilyValueCache;
     FontFamilyValueCache m_fontFamilyValueCache;
 
-    friend CSSValuePool& cssValuePool();
+    friend class WTF::NeverDestroyed<CSSValuePool>;
 };
 
 CSSValuePool& cssValuePool() PURE_FUNCTION;
index 14dca9a..497071f 100644 (file)
@@ -1583,22 +1583,22 @@ private:
     }
     static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
     {
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, a5Height, (mmLength(210)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, a4Width, (mmLength(210)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, a4Height, (mmLength(297)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, a3Width, (mmLength(297)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, a3Height, (mmLength(420)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, b5Width, (mmLength(176)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, b5Height, (mmLength(250)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, b4Width, (mmLength(250)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, b4Height, (mmLength(353)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11)));
-        DEPRECATED_DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17)));
+        static NeverDestroyed<Length> a5Width(mmLength(148));
+        static NeverDestroyed<Length> a5Height(mmLength(210));
+        static NeverDestroyed<Length> a4Width(mmLength(210));
+        static NeverDestroyed<Length> a4Height(mmLength(297));
+        static NeverDestroyed<Length> a3Width(mmLength(297));
+        static NeverDestroyed<Length> a3Height(mmLength(420));
+        static NeverDestroyed<Length> b5Width(mmLength(176));
+        static NeverDestroyed<Length> b5Height(mmLength(250));
+        static NeverDestroyed<Length> b4Width(mmLength(250));
+        static NeverDestroyed<Length> b4Height(mmLength(353));
+        static NeverDestroyed<Length> letterWidth(inchLength(8.5));
+        static NeverDestroyed<Length> letterHeight(inchLength(11));
+        static NeverDestroyed<Length> legalWidth(inchLength(8.5));
+        static NeverDestroyed<Length> legalHeight(inchLength(14));
+        static NeverDestroyed<Length> ledgerWidth(inchLength(11));
+        static NeverDestroyed<Length> ledgerHeight(inchLength(17));
 
         if (!pageSizeName)
             return false;
@@ -2339,7 +2339,7 @@ public:
 
 const DeprecatedStyleBuilder& DeprecatedStyleBuilder::sharedStyleBuilder()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(DeprecatedStyleBuilder, styleBuilderInstance, ());
+    static NeverDestroyed<DeprecatedStyleBuilder> styleBuilderInstance;
     return styleBuilderInstance;
 }
 
index 258b471..15bf82e 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "CSSPropertyNames.h"
 #include "StylePropertyShorthand.h"
+#include <wtf/NeverDestroyed.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
@@ -98,6 +99,8 @@ private:
     }
 
     PropertyHandler m_propertyMap[numCSSProperties];
+
+    friend class WTF::NeverDestroyed<DeprecatedStyleBuilder>;
 };
 
 }