Access FontCache global instance via singleton() static member function
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2015 20:05:11 +0000 (20:05 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2015 20:05:11 +0000 (20:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141726

Reviewed by Daniel Bates.

Access FontCache global instance via singleton() static member function,
as per coding style.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180281 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSFontFaceSource.cpp
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/platform/MemoryPressureHandler.cpp
Source/WebCore/platform/graphics/Font.cpp
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontGlyphs.cpp
Source/WebCore/platform/graphics/cocoa/FontCocoa.mm
Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/graphics/win/FontCacheWin.cpp
Source/WebCore/testing/Internals.cpp
Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Misc/WebCoreStatistics.mm
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreStatistics.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebProcess.cpp

index d05404b91258bed309579b92907f2ae399f03ee0..b65068c89b6e0d23393b06b7f7de156e83e9b952 100644 (file)
@@ -1,3 +1,13 @@
+2015-02-18  Chris Dumez  <cdumez@apple.com>
+
+        Access FontCache global instance via singleton() static member function
+        https://bugs.webkit.org/show_bug.cgi?id=141726
+
+        Reviewed by Daniel Bates.
+
+        Access FontCache global instance via singleton() static member function,
+        as per coding style.
+
 2015-02-18  Alexey Proskuryakov  <ap@apple.com>
 
         Crashes under IDBDatabase::closeConnection.
index 43f059d0f7533592203604d81f4540e6cd892814..75bfd81d99debacc575dcf676b227bf35b566dac 100644 (file)
@@ -105,7 +105,7 @@ RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, boo
 {
     // If the font hasn't loaded or an error occurred, then we've got nothing.
     if (!isValid())
-        return 0;
+        return nullptr;
 
     if (!m_font
 #if ENABLE(SVG_FONTS)
@@ -114,7 +114,7 @@ RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, boo
     ) {
         // We're local. Just return a Font from the normal cache.
         // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter.
-        return fontCache().fontForFamily(fontDescription, m_string, true);
+        return FontCache::singleton().fontForFamily(fontDescription, m_string, true);
     }
 
     unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3
@@ -163,7 +163,7 @@ RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, boo
         // and the loader may invoke arbitrary delegate or event handler code.
         fontSelector->beginLoadingFontSoon(m_font.get());
 
-        Ref<Font> placeholderFont = fontCache().lastResortFallbackFont(fontDescription);
+        Ref<Font> placeholderFont = FontCache::singleton().lastResortFallbackFont(fontDescription);
         Ref<Font> placeholderFontCopyInLoadingState = Font::create(placeholderFont->platformData(), true, true);
         return WTF::move(placeholderFontCopyInLoadingState);
     }
index 82c0eb58ef83b6b761060270e63041e59bdd5e9a..104ae7067b2fcdd9a9fd86d5ffb1659cf40a8f85 100644 (file)
@@ -70,13 +70,13 @@ CSSFontSelector::CSSFontSelector(Document& document)
     // seem to be any such guarantee.
 
     ASSERT(m_document);
-    fontCache().addClient(this);
+    FontCache::singleton().addClient(this);
 }
 
 CSSFontSelector::~CSSFontSelector()
 {
     clearDocument();
-    fontCache().removeClient(this);
+    FontCache::singleton().removeClient(this);
 }
 
 bool CSSFontSelector::isEmpty() const
@@ -299,7 +299,7 @@ void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule)
             ASSERT(!m_locallyInstalledFontFaces.contains(familyName));
 
             Vector<unsigned> locallyInstalledFontsTraitsMasks;
-            fontCache().getTraitsInFamily(familyName, locallyInstalledFontsTraitsMasks);
+            FontCache::singleton().getTraitsInFamily(familyName, locallyInstalledFontsTraitsMasks);
             if (unsigned numLocallyInstalledFaces = locallyInstalledFontsTraitsMasks.size()) {
                 auto familyLocallyInstalledFaces = std::make_unique<Vector<RefPtr<CSSFontFace>>>();
 
@@ -468,7 +468,7 @@ FontRanges CSSFontSelector::fontRangesForFamily(const FontDescription& fontDescr
     if (!face) {
         if (!resolveGenericFamilyFirst)
             familyForLookup = resolveGenericFamily(m_document, fontDescription, familyName);
-        return FontRanges(fontCache().fontForFamily(fontDescription, familyForLookup));
+        return FontRanges(FontCache::singleton().fontForFamily(fontDescription, familyForLookup));
     }
 
     return face->fontRanges(fontDescription);
@@ -617,13 +617,13 @@ PassRefPtr<Font> CSSFontSelector::fallbackFontAt(const FontDescription& fontDesc
     ASSERT_UNUSED(index, !index);
 
     if (!m_document)
-        return 0;
+        return nullptr;
 
     Settings* settings = m_document->settings();
     if (!settings || !settings->fontFallbackPrefersPictographs())
-        return 0;
+        return nullptr;
 
-    return fontCache().fontForFamily(fontDescription, settings->pictographFontFamily());
+    return FontCache::singleton().fontForFamily(fontDescription, settings->pictographFontFamily());
 }
 
 }
index 0a2908ba52d0021d3a047dada548ccb0255a1e5b..e2b72266969f5f7e5673c8ff9e35c325bc121e25 100644 (file)
@@ -76,7 +76,7 @@ void MemoryPressureHandler::releaseNoncriticalMemory()
 {
     {
         ReliefLogger log("Purge inactive FontData");
-        fontCache().purgeInactiveFontData();
+        FontCache::singleton().purgeInactiveFontData();
     }
 
     {
index e27fe95eab672db1a8675dea4661e18bd3b74611..8e2138a243999278ef044150e5d9a5c134cc9b3e 100644 (file)
@@ -428,7 +428,7 @@ RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontD
             codeUnitsLength = 2;
         }
 
-        fallbackFont = fontCache().systemFallbackForCharacters(description, this, isForPlatformFont, codeUnits, codeUnitsLength).get();
+        fallbackFont = FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, codeUnits, codeUnitsLength).get();
         if (fallbackFont)
             fallbackFont->m_isUsedInSystemFallbackCache = true;
     }
index 02d3ddadf4f06b339fbeb97aef30b933dcfbe657..d4fbb21c7d5c87743b885385cada0b2004629b93 100644 (file)
@@ -86,7 +86,7 @@ using namespace WTF;
 
 namespace WebCore {
 
-FontCache& fontCache()
+FontCache& FontCache::singleton()
 {
     static NeverDestroyed<FontCache> globalFontCache;
     return globalFontCache;
index a6e63762ea639fd6423b67940ab364a12204d5bf..eb9e3138faafc4c8e8a086e7ce672e2844d130dd 100644 (file)
@@ -107,7 +107,7 @@ class FontCache {
 
     WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED;
 public:
-    friend FontCache& fontCache();
+    WEBCORE_EXPORT static FontCache& singleton();
 
     // This method is implemented by the platform.
     RefPtr<Font> systemFallbackForCharacters(const FontDescription&, const Font* originalFontData, bool isPlatformFont, const UChar* characters, int length);
@@ -153,7 +153,7 @@ public:
 
 private:
     FontCache();
-    ~FontCache();
+    ~FontCache() = delete;
 
     void purgeTimerFired();
 
@@ -177,9 +177,6 @@ private:
     friend class Font;
 };
 
-// Get the global fontCache.
-WEBCORE_EXPORT FontCache& fontCache();
-
 }
 
 #endif
index 839cac57cf2c55de58f333bdc6574592472be2eb..b20d0ed5cddd2d64f1b16c5dbb2752ac0d54bbae 100644 (file)
@@ -37,21 +37,20 @@ namespace WebCore {
 
 
 FontGlyphs::FontGlyphs(PassRefPtr<FontSelector> fontSelector)
-    : m_cachedPrimaryFont(0)
+    : m_cachedPrimaryFont(nullptr)
     , m_fontSelector(fontSelector)
     , m_fontSelectorVersion(m_fontSelector ? m_fontSelector->version() : 0)
-    , m_generation(fontCache().generation())
+    , m_generation(FontCache::singleton().generation())
 {
 }
 
 FontGlyphs::FontGlyphs(const FontPlatformData& platformData)
-    : m_cachedPrimaryFont(0)
-    , m_fontSelector(0)
+    : m_cachedPrimaryFont(nullptr)
     , m_fontSelectorVersion(0)
-    , m_generation(fontCache().generation())
+    , m_generation(FontCache::singleton().generation())
     , m_isForPlatformFont(true)
 {
-    m_realizedFallbackRanges.append(FontRanges(fontCache().fontForPlatformData(platformData)));
+    m_realizedFallbackRanges.append(FontRanges(FontCache::singleton().fontForPlatformData(platformData)));
 }
 
 FontGlyphs::~FontGlyphs()
@@ -81,6 +80,7 @@ static FontRanges realizeNextFallback(const FontDescription& description, unsign
 {
     ASSERT(index < description.familyCount());
 
+    auto& fontCache = FontCache::singleton();
     while (index < description.familyCount()) {
         const AtomicString& family = description.familyAt(index++);
         if (family.isEmpty())
@@ -90,13 +90,13 @@ static FontRanges realizeNextFallback(const FontDescription& description, unsign
             if (!ranges.isNull())
                 return ranges;
         }
-        if (auto font = fontCache().fontForFamily(description, family))
+        if (auto font = fontCache.fontForFamily(description, family))
             return FontRanges(WTF::move(font));
     }
     // We didn't find a font. Try to find a similar font using our own specific knowledge about our platform.
     // For example on OS X, we know to map any families containing the words Arabic, Pashto, or Urdu to the
     // Geeza Pro font.
-    return FontRanges(fontCache().similarFont(description));
+    return FontRanges(fontCache.similarFont(description));
 }
 
 const FontRanges& FontGlyphs::realizeFallbackRangesAt(const FontDescription& description, unsigned index)
@@ -105,7 +105,7 @@ const FontRanges& FontGlyphs::realizeFallbackRangesAt(const FontDescription& des
         return m_realizedFallbackRanges[index];
 
     ASSERT(index == m_realizedFallbackRanges.size());
-    ASSERT(fontCache().generation() == m_generation);
+    ASSERT(FontCache::singleton().generation() == m_generation);
 
     m_realizedFallbackRanges.append(FontRanges());
     auto& fontRanges = m_realizedFallbackRanges.last();
@@ -115,7 +115,7 @@ const FontRanges& FontGlyphs::realizeFallbackRangesAt(const FontDescription& des
         if (fontRanges.isNull() && m_fontSelector)
             fontRanges = m_fontSelector->fontRangesForFamily(description, standardFamily);
         if (fontRanges.isNull())
-            fontRanges = FontRanges(fontCache().lastResortFallbackFont(description));
+            fontRanges = FontRanges(FontCache::singleton().lastResortFallbackFont(description));
         return fontRanges;
     }
 
index 8cd848142e2544a00bee593dea15f24b1513b49f..b22735ccbb1016b5410f6ebc7cb488cdbf7b5999 100644 (file)
@@ -339,11 +339,11 @@ PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float sc
         scaledFontData.m_syntheticBold = (fontTraits & NSBoldFontMask) && !(scaledFontTraits & NSBoldFontMask);
         scaledFontData.m_syntheticOblique = (fontTraits & NSItalicFontMask) && !(scaledFontTraits & NSItalicFontMask);
 
-        return fontCache().fontForPlatformData(scaledFontData);
+        return FontCache::singleton().fontForPlatformData(scaledFontData);
     }
     END_BLOCK_OBJC_EXCEPTIONS;
 
-    return 0;
+    return nullptr;
 #else
     CTFontSymbolicTraits fontTraits = CTFontGetSymbolicTraits(m_platformData.font());
     RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontCopyFontDescriptor(m_platformData.font()));
@@ -360,7 +360,7 @@ PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float sc
         scaledFontData.m_syntheticBold = (fontTraits & kCTFontBoldTrait) && !(scaledFontTraits & kCTFontTraitBold);
         scaledFontData.m_syntheticOblique = (fontTraits & kCTFontItalicTrait) && !(scaledFontTraits & kCTFontTraitItalic);
 
-        return fontCache().fontForPlatformData(scaledFontData);
+        return FontCache::singleton().fontForPlatformData(scaledFontData);
     }
 
     return nullptr;
index da1f2f98c7175e2ef51dfc57cf2f716eb0f434d3..3f472a4be8731cf2c09f3ce5b51c6590e1fa8791 100644 (file)
@@ -346,29 +346,29 @@ bool FontPlatformData::hasCompatibleCharmap()
 PassRefPtr<OpenTypeVerticalData> FontPlatformData::verticalData() const
 {
     ASSERT(hash());
-    return fontCache().getVerticalData(String::number(hash()), *this);
+    return FontCache::singleton().getVerticalData(String::number(hash()), *this);
 }
 
 PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
 {
     FT_Face freeTypeFace = cairo_ft_scaled_font_lock_face(m_scaledFont);
     if (!freeTypeFace)
-        return 0;
+        return nullptr;
 
     FT_ULong tableSize = 0;
     // Tag bytes need to be reversed because OT_MAKE_TAG uses big-endian order.
     uint32_t tag = FT_MAKE_TAG((table & 0xff), (table & 0xff00) >> 8, (table & 0xff0000) >> 16, table >> 24);
     if (FT_Load_Sfnt_Table(freeTypeFace, tag, 0, 0, &tableSize))
-        return 0;
+        return nullptr;
 
     RefPtr<SharedBuffer> buffer = SharedBuffer::create(tableSize);
     FT_ULong expectedTableSize = tableSize;
     if (buffer->size() != tableSize)
-        return 0;
+        return nullptr;
 
     FT_Error error = FT_Load_Sfnt_Table(freeTypeFace, tag, 0, reinterpret_cast<FT_Byte*>(const_cast<char*>(buffer->data())), &tableSize);
     if (error || tableSize != expectedTableSize)
-        return 0;
+        return nullptr;
 
     cairo_ft_scaled_font_unlock_face(m_scaledFont);
 
index d6ec3a6ba2874f523afc8d29afc2d07f72183209..79dfcd19b1f5bac197933dda07f0ba618fd2cca4 100644 (file)
@@ -275,13 +275,14 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
                         m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));
                         continue;
                     }
-                    runFont = fontCache().fontForFamily(m_font.fontDescription(), fontName.get(), false).get();
+                    auto& fontCache = FontCache::singleton();
+                    runFont = fontCache.fontForFamily(m_font.fontDescription(), fontName.get(), false).get();
 #if !PLATFORM(IOS)
                     // Core Text may have used a font that is not known to NSFontManager. In that case, fall back on
                     // using the font as returned, even though it may not have the best NSFontRenderingMode.
                     if (!runFont) {
                         FontPlatformData runFontPlatformData((NSFont *)runCTFont, CTFontGetSize(runCTFont));
-                        runFont = &fontCache().fontForPlatformData(runFontPlatformData).get();
+                        runFont = fontCache.fontForPlatformData(runFontPlatformData).ptr();
                     }
 #else
                     // FIXME: Just assert for now, until we can devise a better fix that works with iOS.
index 8d91229695f2d523e8a7882d281fac74e4f8caa9..d0af4db3ca4b0d030bc3c39f36344ebd7811e9f4 100644 (file)
@@ -275,16 +275,16 @@ static NSFont *fontWithFamily(NSString *desiredFamily, NSFontTraitMask desiredTr
 static void invalidateFontCache(void*)
 {
     if (!isMainThread()) {
-        callOnMainThread(&invalidateFontCache, 0);
+        callOnMainThread(&invalidateFontCache, nullptr);
         return;
     }
-    fontCache().invalidate();
+    FontCache::singleton().invalidate();
     [desiredFamilyToAvailableFamilyDictionary() removeAllObjects];
 }
 
 static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef)
 {
-    ASSERT_UNUSED(observer, observer == &fontCache());
+    ASSERT_UNUSED(observer, observer == &FontCache::singleton());
     ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotification));
     invalidateFontCache(0);
 }
index c52cf1373b52bfc91575233a226e7eb7d8e84474..3350f1516898ce853a936150d94e92ca234284f0 100644 (file)
@@ -149,7 +149,7 @@ static const Vector<DWORD, 4>& getCJKCodePageMasks()
     static bool initialized;
     if (!initialized) {
         initialized = true;
-        IMLangFontLinkType* langFontLink = fontCache().getFontLinkInterface();
+        IMLangFontLinkType* langFontLink = FontCache::singleton().getFontLinkInterface();
         if (!langFontLink)
             return codePageMasks;
 
index 4fb19712cb474fc848efa0e128ec118c9c859ad2..67c8f17ce7ba04cfea13a14af69f0172f3e92508 100644 (file)
@@ -884,7 +884,7 @@ void Internals::setMarkedTextMatchesAreHighlighted(bool flag, ExceptionCode& ec)
 
 void Internals::invalidateFontCache()
 {
-    fontCache().invalidate();
+    FontCache::singleton().invalidate();
 }
 
 void Internals::setScrollViewPosition(long x, long y, ExceptionCode& ec)
index 111cd8e378dc8d59b56f2356e0fef978d0756be0..3284dfe78393070f7bee579c9c4ffaa2dd5166f0 100644 (file)
@@ -390,7 +390,7 @@ EXPORTS
         symbolWithPointer(?create@BitmapInfo@WebCore@@SA?AU12@ABVIntSize@2@W4BitCount@12@@Z, ?create@BitmapInfo@WebCore@@SA?AU12@AEBVIntSize@2@W4BitCount@12@@Z)
         symbolWithPointer(?drawPattern@Image@WebCore@@UAEXPAVGraphicsContext@2@ABVFloatRect@2@ABVAffineTransform@2@ABVFloatPoint@2@W4ColorSpace@2@W4CompositeOperator@2@1W4BlendMode@2@@Z, ?drawPattern@Image@WebCore@@UEAAXPEAVGraphicsContext@2@AEBVFloatRect@2@AEBVAffineTransform@2@AEBVFloatPoint@2@W4ColorSpace@2@W4CompositeOperator@2@1W4BlendMode@2@@Z)
         symbolWithPointer(?drawFrameMatchingSourceSize@BitmapImage@WebCore@@MAEXPAVGraphicsContext@2@ABVFloatRect@2@ABVIntSize@2@W4ColorSpace@2@W4CompositeOperator@2@@Z, ?drawFrameMatchingSourceSize@BitmapImage@WebCore@@MEAAXPEAVGraphicsContext@2@AEBVFloatRect@2@AEBVIntSize@2@W4ColorSpace@2@W4CompositeOperator@2@@Z)
-        symbolWithPointer(?fontCache@WebCore@@YAAAVFontCache@1@XZ, ?fontCache@WebCore@@YAAEAVFontCache@1@XZ)
+        symbolWithPointer(?singleton@FontCache@WebCore@@SAAAV12@XZ, ?singleton@FontCache@WebCore@@SAAAV12@XZ)
         symbolWithPointer(?invalidate@FontCache@WebCore@@QAEXXZ, ?invalidate@FontCache@WebCore@@QEAAXXZ)
         symbolWithPointer(?mayFillWithSolidColor@BitmapImage@WebCore@@MAE_NXZ, ?mayFillWithSolidColor@BitmapImage@WebCore@@MEAA_NXZ)
         symbolWithPointer(?solidColor@BitmapImage@WebCore@@MBE?AVColor@2@XZ, ?solidColor@BitmapImage@WebCore@@MEBA?AVColor@2@XZ)
index e0d0ee0ad38b7d9b8ba8f9a4339e77c5edc0d667..4679d538173e703c40b2ac2d7ed5fb6db8f54207 100644 (file)
@@ -1,3 +1,13 @@
+2015-02-18  Chris Dumez  <cdumez@apple.com>
+
+        Access FontCache global instance via singleton() static member function
+        https://bugs.webkit.org/show_bug.cgi?id=141726
+
+        Reviewed by Daniel Bates.
+
+        Access FontCache global instance via singleton() static member function,
+        as per coding style.
+
 2015-02-17  Chris Dumez  <cdumez@apple.com>
 
         Access MemoryPressureHandler global instance via a singleton() static member function
index e8dcb24422dedbb84acb9e814ec3aa6ed7a4ddfe..6644cc4476704f7d4d42696f992676b69aa9e643 100644 (file)
@@ -147,17 +147,17 @@ using namespace WebCore;
 
 + (size_t)cachedFontDataCount
 {
-    return fontCache().fontCount();
+    return FontCache::singleton().fontCount();
 }
 
 + (size_t)cachedFontDataInactiveCount
 {
-    return fontCache().inactiveFontCount();
+    return FontCache::singleton().inactiveFontCount();
 }
 
 + (void)purgeInactiveFontData
 {
-    fontCache().purgeInactiveFontData();
+    FontCache::singleton().purgeInactiveFontData();
 }
 
 + (size_t)glyphPageCount
index 1120674d499f57ef484d65091213c2013bb027ab..e23d6bd6c9e551c811b7a3a6d54d8f2735f774a5 100644 (file)
@@ -4875,7 +4875,7 @@ static NSString *fontNameForDescription(NSString *familyName, BOOL italic, BOOL
     fontDescription.setIsItalic(italic);
     fontDescription.setWeight(bold ? FontWeight900 : FontWeight500);
     fontDescription.setSpecifiedSize(pointSize);
-    RefPtr<Font> font = fontCache().fontForFamily(fontDescription, familyName);
+    RefPtr<Font> font = FontCache::singleton().fontForFamily(fontDescription, familyName);
     return [font->platformData().nsFont() fontName];
 }
 
index eb2c6ae1c6194cb6b15f7d289fc7d7be8230c427..65ee1486cbdf3b3ccf66b05e57f680af9118a5bc 100644 (file)
@@ -1346,7 +1346,7 @@ static void WebKitInitializeGamepadProviderIfNecessary()
 {
     ASSERT(WebThreadIsCurrent());
     WebKit::MemoryMeasure measurer("Memory warning: Purging inactive font data.");
-    fontCache().purgeInactiveFontData();
+    FontCache::singleton().purgeInactiveFontData();
 }
 
 + (void)drainLayerPool
index 5baf89f8198fe2f50d77e58cdc44e1dbceec74cb..f47e257e34a4c42466a1c29ad2f3d328040741bb 100644 (file)
@@ -1,3 +1,13 @@
+2015-02-18  Chris Dumez  <cdumez@apple.com>
+
+        Access FontCache global instance via singleton() static member function
+        https://bugs.webkit.org/show_bug.cgi?id=141726
+
+        Reviewed by Daniel Bates.
+
+        Access FontCache global instance via singleton() static member function,
+        as per coding style.
+
 2015-02-09  Brian J. Burg  <burg@cs.washington.edu>
 
         Web Inspector: remove some unnecessary Inspector prefixes from class names in Inspector namespace
index 1680265ad82f8fbb264243f612ace06ab626ef4a..10f91ffde404a2717998570526d392381fb0406f 100644 (file)
@@ -215,7 +215,7 @@ HRESULT STDMETHODCALLTYPE WebCoreStatistics::cachedFontDataCount(
 {
     if (!count)
         return E_POINTER;
-    *count = (UINT) fontCache().fontCount();
+    *count = (UINT) FontCache::singleton().fontCount();
     return S_OK;
 }
 
@@ -224,13 +224,13 @@ HRESULT STDMETHODCALLTYPE WebCoreStatistics::cachedFontDataInactiveCount(
 {
     if (!count)
         return E_POINTER;
-    *count = (UINT) fontCache().inactiveFontCount();
+    *count = (UINT) FontCache::singleton().inactiveFontCount();
     return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE WebCoreStatistics::purgeInactiveFontData(void)
 {
-    fontCache().purgeInactiveFontData();
+    FontCache::singleton().purgeInactiveFontData();
     return S_OK;
 }
 
index 882391101cf889be690e1e3cdd54b75bdb10595d..7bd9e14c26b6d0cbd55062ca1974c9014d38df53 100644 (file)
@@ -1,3 +1,13 @@
+2015-02-18  Chris Dumez  <cdumez@apple.com>
+
+        Access FontCache global instance via singleton() static member function
+        https://bugs.webkit.org/show_bug.cgi?id=141726
+
+        Reviewed by Daniel Bates.
+
+        Access FontCache global instance via singleton() static member function,
+        as per coding style.
+
 2015-02-18  Timothy Horton  <timothy_horton@apple.com>
 
         Add WKContext SPI to clear all visited links
index b281abbb17bba4c8f2ed2b51e271b7dfa9e6da3f..f836164dadb2c5513108402fc05cea8dd5094933 100644 (file)
@@ -587,7 +587,7 @@ void WebProcess::terminate()
 {
 #ifndef NDEBUG
     gcController().garbageCollectNow();
-    fontCache().invalidate();
+    FontCache::singleton().invalidate();
     MemoryCache::singleton().setDisabled(true);
 #endif
 
@@ -640,12 +640,12 @@ void WebProcess::didClose(IPC::Connection&)
     // Close all the live pages.
     Vector<RefPtr<WebPage>> pages;
     copyValuesToVector(m_pageMap, pages);
-    for (size_t i = 0; i < pages.size(); ++i)
-        pages[i]->close();
+    for (auto& page : pages)
+        page->close();
     pages.clear();
 
     gcController().garbageCollectSoon();
-    fontCache().invalidate();
+    FontCache::singleton().invalidate();
     MemoryCache::singleton().setDisabled(true);
 #endif    
 
@@ -940,8 +940,9 @@ void WebProcess::getWebCoreStatistics(uint64_t callbackID)
     data.statisticsNumbers.set(ASCIILiteral("IconsWithDataCount"), iconDatabase().iconRecordCountWithData());
     
     // Gather font statistics.
-    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataCount"), fontCache().fontCount());
-    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataInactiveCount"), fontCache().inactiveFontCount());
+    auto& fontCache = FontCache::singleton();
+    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataCount"), fontCache.fontCount());
+    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataInactiveCount"), fontCache.inactiveFontCount());
     
     // Gather glyph page statistics.
     data.statisticsNumbers.set(ASCIILiteral("GlyphPageCount"), GlyphPage::count());