Changeset 195567 in webkit


Ignore:
Timestamp:
Jan 25, 2016 4:35:17 PM (8 years ago)
Author:
mmaxfield@apple.com
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:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r195565 r195567  
     12016-01-25  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Remove broken cache from CSSFontFaceSource
     4        https://bugs.webkit.org/show_bug.cgi?id=153440
     5
     6        Reviewed by Simon Fraser.
     7
     8        This cache has been broken since 2013 (r158085). Given we didn't notice a perf
     9        hit when it broke, and the fact it's been broken for years, it clearly isn't
     10        necessary.
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=153414 consists of a fairly invasive
     13        change to CSSFontFaceSource; this patch includes a working version of this
     14        cache, along with an easy way to enable/disable it (to measure possible perf
     15        changes).
     16
     17        This patch is a short-term cleanup patch in the mean time until the above
     18        invasive change gets landed.
     19
     20        No new tests because there is no behavior (or performance!) change.
     21
     22        * css/CSSFontFaceSource.cpp:
     23        (WebCore::CSSFontFaceSource::font):
     24        (WebCore::CSSFontFaceSource::~CSSFontFaceSource): Deleted.
     25        (WebCore::CSSFontFaceSource::pruneTable): Deleted.
     26        (WebCore::CSSFontFaceSource::fontLoaded): Deleted.
     27        * css/CSSFontFaceSource.h:
     28
    1292016-01-25  Sam Weinig  <sam@webkit.org>
    230
  • 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
  • trunk/Source/WebCore/css/CSSFontFaceSource.h

    r195523 r195567  
    3535#endif
    3636#include "Timer.h"
    37 #include <wtf/HashMap.h>
    3837#include <wtf/text/AtomicString.h>
    3938
     
    8281    CachedResourceHandle<CachedFont> m_font; // For remote fonts, a pointer to our cached resource.
    8382    CSSFontFace* m_face; // Our owning font face.
    84     HashMap<unsigned, RefPtr<Font>> m_fontTable; // The hash key is composed of size synthetic styles.
    8583
    8684#if ENABLE(SVG_OTF_CONVERTER)
Note: See TracChangeset for help on using the changeset viewer.