Changeset 195567 in webkit
- Timestamp:
- Jan 25, 2016 4:35:17 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r195565 r195567 1 2016-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 1 29 2016-01-25 Sam Weinig <sam@webkit.org> 2 30 -
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r195523 r195567 67 67 if (m_font) 68 68 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();78 69 } 79 70 … … 87 78 void CSSFontFaceSource::fontLoaded(CachedFont*) 88 79 { 89 pruneTable();90 80 if (m_face) 91 81 m_face->fontLoaded(this); … … 108 98 } 109 99 110 unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3111 | (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 117 100 if (!m_font || m_font->isLoaded()) { 118 101 if (m_font) { … … 120 103 return nullptr; 121 104 122 font =m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings);105 return m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings); 123 106 } else { 124 107 #if ENABLE(SVG_FONTS) … … 138 121 if (!customPlatformData) 139 122 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); 141 124 #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); 143 126 #endif 144 127 } 145 128 #endif 129 return nullptr; 146 130 } 147 131 } else { … … 150 134 fontSelector->beginLoadingFontSoon(m_font.get()); 151 135 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); 155 137 } 156 157 return font.release();158 138 } 159 139 -
trunk/Source/WebCore/css/CSSFontFaceSource.h
r195523 r195567 35 35 #endif 36 36 #include "Timer.h" 37 #include <wtf/HashMap.h>38 37 #include <wtf/text/AtomicString.h> 39 38 … … 82 81 CachedResourceHandle<CachedFont> m_font; // For remote fonts, a pointer to our cached resource. 83 82 CSSFontFace* m_face; // Our owning font face. 84 HashMap<unsigned, RefPtr<Font>> m_fontTable; // The hash key is composed of size synthetic styles.85 83 86 84 #if ENABLE(SVG_OTF_CONVERTER)
Note: See TracChangeset
for help on using the changeset viewer.