Title: [187569] trunk/Source/WebCore
Revision
187569
Author
mmaxfi...@apple.com
Date
2015-07-29 17:47:34 -0700 (Wed, 29 Jul 2015)

Log Message

Use rvalue references in FontCascade
https://bugs.webkit.org/show_bug.cgi?id=147427

Reviewed by Simon Fraser.

No new tests because there is no behavior change.

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::resolvesFamilyFor):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::FontCascade):
(WebCore::retrieveOrAddCachedFonts):
(WebCore::FontCascade::update):
* platform/graphics/FontCascade.h:
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::FontCascadeFonts):
* platform/graphics/FontCascadeFonts.h:
(WebCore::FontCascadeFonts::create):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (187568 => 187569)


--- trunk/Source/WebCore/ChangeLog	2015-07-29 23:38:29 UTC (rev 187568)
+++ trunk/Source/WebCore/ChangeLog	2015-07-30 00:47:34 UTC (rev 187569)
@@ -1,5 +1,26 @@
 2015-07-29  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        Use rvalue references in FontCascade
+        https://bugs.webkit.org/show_bug.cgi?id=147427
+
+        Reviewed by Simon Fraser.
+
+        No new tests because there is no behavior change.
+
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::resolvesFamilyFor):
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::FontCascade):
+        (WebCore::retrieveOrAddCachedFonts):
+        (WebCore::FontCascade::update):
+        * platform/graphics/FontCascade.h:
+        * platform/graphics/FontCascadeFonts.cpp:
+        (WebCore::FontCascadeFonts::FontCascadeFonts):
+        * platform/graphics/FontCascadeFonts.h:
+        (WebCore::FontCascadeFonts::create):
+
+2015-07-29  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         Rename FontDescriptionFontDataCacheKey to FontDescriptionKey
         https://bugs.webkit.org/show_bug.cgi?id=147424
 

Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (187568 => 187569)


--- trunk/Source/WebCore/css/CSSFontSelector.cpp	2015-07-29 23:38:29 UTC (rev 187568)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp	2015-07-30 00:47:34 UTC (rev 187569)
@@ -593,10 +593,9 @@
             continue;
         if (m_fontFaces.contains(familyName))
             return true;
-        DEPRECATED_DEFINE_STATIC_LOCAL(String, webkitPrefix, ("-webkit-"));
-        if (familyName.startsWith(webkitPrefix))
+        static NeverDestroyed<String> webkitPrefix("-webkit-");
+        if (familyName.startsWith(webkitPrefix.get()))
             return true;
-            
     }
     return false;
 }

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (187568 => 187569)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-07-29 23:38:29 UTC (rev 187568)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-07-30 00:47:34 UTC (rev 187569)
@@ -41,7 +41,7 @@
 
 namespace WebCore {
 
-static Ref<FontCascadeFonts> retrieveOrAddCachedFonts(const FontDescription&, PassRefPtr<FontSelector>);
+static Ref<FontCascadeFonts> retrieveOrAddCachedFonts(const FontDescription&, RefPtr<FontSelector>&&);
 
 const uint8_t FontCascade::s_roundingHackCharacterTable[256] = {
     0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*\t*/, 1 /*\n*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -136,7 +136,7 @@
 
 // FIXME: We should make this constructor platform-independent.
 #if PLATFORM(IOS)
-FontCascade::FontCascade(const FontPlatformData& fontData, PassRefPtr<FontSelector> fontSelector)
+FontCascade::FontCascade(const FontPlatformData& fontData, RefPtr<FontSelector>&& fontSelector)
     : m_weakPtrFactory(this)
     , m_letterSpacing(0)
     , m_wordSpacing(0)
@@ -147,7 +147,7 @@
     m_fontDescription.setComputedSize(CTFontGetSize(primaryFont));
     m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitItalic);
     m_fontDescription.setWeight((CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal);
-    m_fonts = retrieveOrAddCachedFonts(m_fontDescription, fontSelector.get());
+    m_fonts = retrieveOrAddCachedFonts(m_fontDescription, WTF::move(fontSelector));
 }
 #endif
 
@@ -293,7 +293,7 @@
         entry->fonts->pruneSystemFallbacks();
 }
 
-static Ref<FontCascadeFonts> retrieveOrAddCachedFonts(const FontDescription& fontDescription, PassRefPtr<FontSelector> fontSelector)
+static Ref<FontCascadeFonts> retrieveOrAddCachedFonts(const FontDescription& fontDescription, RefPtr<FontSelector>&& fontSelector)
 {
     auto key = makeFontCascadeCacheKey(fontDescription, fontSelector.get());
 
@@ -303,7 +303,7 @@
         return addResult.iterator->value->fonts.get();
 
     auto& newEntry = addResult.iterator->value;
-    newEntry = std::make_unique<FontCascadeCacheEntry>(WTF::move(key), FontCascadeFonts::create(fontSelector));
+    newEntry = std::make_unique<FontCascadeCacheEntry>(WTF::move(key), FontCascadeFonts::create(WTF::move(fontSelector)));
     Ref<FontCascadeFonts> glyphs = newEntry->fonts.get();
 
     static const unsigned unreferencedPruneInterval = 50;
@@ -318,9 +318,9 @@
     return glyphs;
 }
 
-void FontCascade::update(PassRefPtr<FontSelector> fontSelector) const
+void FontCascade::update(RefPtr<FontSelector>&& fontSelector) const
 {
-    m_fonts = retrieveOrAddCachedFonts(m_fontDescription, fontSelector.get());
+    m_fonts = retrieveOrAddCachedFonts(m_fontDescription, WTF::move(fontSelector));
     m_useBackslashAsYenSymbol = useBackslashAsYenSignForFamily(firstFamily());
     m_typesettingFeatures = computeTypesettingFeatures();
 }

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (187568 => 187569)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2015-07-29 23:38:29 UTC (rev 187568)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2015-07-30 00:47:34 UTC (rev 187569)
@@ -135,7 +135,7 @@
     int pixelSize() const { return fontDescription().computedPixelSize(); }
     float size() const { return fontDescription().computedSize(); }
 
-    void update(PassRefPtr<FontSelector>) const;
+    void update(RefPtr<FontSelector>&&) const;
 
     enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontNotReady };
     WEBCORE_EXPORT float drawText(GraphicsContext*, const TextRun&, const FloatPoint&, int from = 0, int to = -1, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const;

Modified: trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp (187568 => 187569)


--- trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp	2015-07-29 23:38:29 UTC (rev 187568)
+++ trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp	2015-07-30 00:47:34 UTC (rev 187569)
@@ -36,7 +36,7 @@
 namespace WebCore {
 
 
-FontCascadeFonts::FontCascadeFonts(PassRefPtr<FontSelector> fontSelector)
+FontCascadeFonts::FontCascadeFonts(RefPtr<FontSelector>&& fontSelector)
     : m_cachedPrimaryFont(nullptr)
     , m_fontSelector(fontSelector)
     , m_fontSelectorVersion(m_fontSelector ? m_fontSelector->version() : 0)

Modified: trunk/Source/WebCore/platform/graphics/FontCascadeFonts.h (187568 => 187569)


--- trunk/Source/WebCore/platform/graphics/FontCascadeFonts.h	2015-07-29 23:38:29 UTC (rev 187568)
+++ trunk/Source/WebCore/platform/graphics/FontCascadeFonts.h	2015-07-30 00:47:34 UTC (rev 187569)
@@ -44,7 +44,7 @@
 class FontCascadeFonts : public RefCounted<FontCascadeFonts> {
     WTF_MAKE_NONCOPYABLE(FontCascadeFonts);
 public:
-    static Ref<FontCascadeFonts> create(PassRefPtr<FontSelector> fontSelector) { return adoptRef(*new FontCascadeFonts(fontSelector)); }
+    static Ref<FontCascadeFonts> create(RefPtr<FontSelector>&& fontSelector) { return adoptRef(*new FontCascadeFonts(WTF::move(fontSelector))); }
     static Ref<FontCascadeFonts> createForPlatformFont(const FontPlatformData& platformData) { return adoptRef(*new FontCascadeFonts(platformData)); }
 
     WEBCORE_EXPORT ~FontCascadeFonts();
@@ -72,7 +72,7 @@
     void pruneSystemFallbacks();
 
 private:
-    FontCascadeFonts(PassRefPtr<FontSelector>);
+    FontCascadeFonts(RefPtr<FontSelector>&&);
     FontCascadeFonts(const FontPlatformData&);
 
     GlyphData glyphDataForSystemFallback(UChar32, const FontDescription&, FontVariant);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to