Ignore:
Timestamp:
Jan 25, 2016, 4:35:17 PM (9 years ago)
Author:
[email protected]
Message:

Remove broken cache from CSSFontFaceSource
https://bugs.webkit.org/show_bug.cgi?id=153440

Reviewed by Simon Fraser.

This cache has been broken since 2013 (r158085). Given we didn't notice a perf
hit when it broke, and the fact it's been broken for years, it clearly isn't
necessary.

https://bugs.webkit.org/show_bug.cgi?id=153414 consists of a fairly invasive
change to CSSFontFaceSource; this patch includes a working version of this
cache, along with an easy way to enable/disable it (to measure possible perf
changes).

This patch is a short-term cleanup patch in the mean time until the above
invasive change gets landed.

No new tests because there is no behavior (or performance!) change.

  • css/CSSFontFaceSource.cpp:

(WebCore::CSSFontFaceSource::font):
(WebCore::CSSFontFaceSource::~CSSFontFaceSource): Deleted.
(WebCore::CSSFontFaceSource::pruneTable): Deleted.
(WebCore::CSSFontFaceSource::fontLoaded): Deleted.

  • css/CSSFontFaceSource.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSFontFaceSource.cpp

    r195523 r195567  
    6767    if (m_font)
    6868        m_font->removeClient(this);
    69     pruneTable();
    70 }
    71 
    72 void CSSFontFaceSource::pruneTable()
    73 {
    74     if (m_fontTable.isEmpty())
    75         return;
    76 
    77     m_fontTable.clear();
    7869}
    7970
     
    8778void CSSFontFaceSource::fontLoaded(CachedFont*)
    8879{
    89     pruneTable();
    9080    if (m_face)
    9181        m_face->fontLoaded(this);
     
    10898    }
    10999
    110     unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3
    111                        | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);
    112 
    113     RefPtr<Font> font = m_fontTable.add(hashKey, nullptr).iterator->value;
    114     if (font)
    115         return font.release();
    116 
    117100    if (!m_font || m_font->isLoaded()) {
    118101        if (m_font) {
     
    120103                return nullptr;
    121104
    122             font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings);
     105            return m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings);
    123106        } else {
    124107#if ENABLE(SVG_FONTS)
     
    138121                if (!customPlatformData)
    139122                    return nullptr;
    140                 font = Font::create(customPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false);
     123                return Font::create(customPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false);
    141124#else
    142                 font = Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
     125                return Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
    143126#endif
    144127            }
    145128#endif
     129            return nullptr;
    146130        }
    147131    } else {
     
    150134        fontSelector->beginLoadingFontSoon(m_font.get());
    151135
    152         Ref<Font> placeholderFont = FontCache::singleton().lastResortFallbackFont(fontDescription);
    153         Ref<Font> placeholderFontCopyInLoadingState = Font::create(placeholderFont->platformData(), true, true);
    154         return WTFMove(placeholderFontCopyInLoadingState);
     136        return Font::create(FontCache::singleton().lastResortFallbackFont(fontDescription)->platformData(), true, true);
    155137    }
    156 
    157     return font.release();
    158138}
    159139
Note: See TracChangeset for help on using the changeset viewer.