Title: [165641] trunk/Source/WebCore
Revision
165641
Author
fred.w...@free.fr
Date
2014-03-14 13:33:44 -0700 (Fri, 14 Mar 2014)

Log Message

FontCache: Replace DEPRECATED_DEFINE_STATIC_LOCAL with static NeverDestroyed<T>.
https://bugs.webkit.org/show_bug.cgi?id=130233

Reviewed by Andreas Kling.

No new tests.

* platform/graphics/FontCache.cpp:
(WebCore::fontCache):
(WebCore::FontVerticalDataCacheKeyTraits::emptyValue):
(WebCore::fontVerticalDataCacheInstance):
(WebCore::FontDataCacheKeyTraits::emptyValue):
* platform/graphics/FontCache.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (165640 => 165641)


--- trunk/Source/WebCore/ChangeLog	2014-03-14 20:11:26 UTC (rev 165640)
+++ trunk/Source/WebCore/ChangeLog	2014-03-14 20:33:44 UTC (rev 165641)
@@ -1,3 +1,19 @@
+2014-03-14  Frédéric Wang  <fred.w...@free.fr>
+
+        FontCache: Replace DEPRECATED_DEFINE_STATIC_LOCAL with static NeverDestroyed<T>.
+        https://bugs.webkit.org/show_bug.cgi?id=130233
+
+        Reviewed by Andreas Kling.
+
+        No new tests.
+
+        * platform/graphics/FontCache.cpp:
+        (WebCore::fontCache):
+        (WebCore::FontVerticalDataCacheKeyTraits::emptyValue):
+        (WebCore::fontVerticalDataCacheInstance):
+        (WebCore::FontDataCacheKeyTraits::emptyValue):
+        * platform/graphics/FontCache.h:
+
 2014-03-11  Oliver Hunt  <oli...@apple.com>
 
         Improve dom error messages

Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (165640 => 165641)


--- trunk/Source/WebCore/platform/graphics/FontCache.cpp	2014-03-14 20:11:26 UTC (rev 165640)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp	2014-03-14 20:33:44 UTC (rev 165641)
@@ -37,6 +37,7 @@
 #include "WebKitFontFamilyNames.h"
 #include <wtf/HashMap.h>
 #include <wtf/ListHashSet.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/AtomicStringHash.h>
 #include <wtf/text/StringHash.h>
@@ -87,8 +88,8 @@
 // FIXME: We should return a reference instead of a pointer since we never return a nullptr.
 FontCache* fontCache()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ());
-    return &globalFontCache;
+    static NeverDestroyed<FontCache> globalFontCache;
+    return &globalFontCache.get();
 }
 
 FontCache::FontCache()
@@ -285,7 +286,7 @@
     static const bool needsDestruction = true;
     static const FontCache::FontFileKey& emptyValue()
     {
-        DEPRECATED_DEFINE_STATIC_LOCAL(FontCache::FontFileKey, key, (nullAtom));
+        static NeverDestroyed<FontCache::FontFileKey> key = nullAtom;
         return key;
     }
     static void constructDeletedValue(FontCache::FontFileKey& slot)
@@ -302,7 +303,7 @@
 
 FontVerticalDataCache& fontVerticalDataCacheInstance()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(FontVerticalDataCache, fontVerticalDataCache, ());
+    static NeverDestroyed<FontVerticalDataCache> fontVerticalDataCache;
     return fontVerticalDataCache;
 }
 
@@ -340,7 +341,7 @@
     static const bool needsDestruction = true;
     static const FontPlatformData& emptyValue()
     {
-        DEPRECATED_DEFINE_STATIC_LOCAL(FontPlatformData, key, (0.f, false, false));
+        static NeverDestroyed<FontPlatformData> key(0.f, false, false);
         return key;
     }
     static void constructDeletedValue(FontPlatformData& slot)

Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (165640 => 165641)


--- trunk/Source/WebCore/platform/graphics/FontCache.h	2014-03-14 20:11:26 UTC (rev 165640)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h	2014-03-14 20:33:44 UTC (rev 165641)
@@ -104,6 +104,7 @@
 
 class FontCache {
     friend class FontCachePurgePreventer;
+    friend class WTF::NeverDestroyed<FontCache>;
 
     WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED;
 public:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to