FontCache::fontCache() never returns nullptr so it can be made to return a reference...
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Apr 2014 19:05:47 +0000 (19:05 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Apr 2014 19:05:47 +0000 (19:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132110

Reviewed by Tim Horton.

Updates callers to use '.' instead of '->'.

No new tests are necessary because there should be no behavior change.

Source/WebCore:
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData):
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::CSSFontSelector):
(WebCore::CSSFontSelector::~CSSFontSelector):
(WebCore::CSSFontSelector::addFontFaceRule):
(WebCore::fontDataForGenericFamily):
(WebCore::CSSFontSelector::getFallbackFontData):
* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::releaseMemory):
* platform/graphics/FontCache.cpp:
(WebCore::fontCache): Return a reference
* platform/graphics/FontCache.h:
(WebCore::FontCachePurgePreventer::FontCachePurgePreventer):
(WebCore::FontCachePurgePreventer::~FontCachePurgePreventer):
* platform/graphics/FontGlyphs.cpp:
(WebCore::FontGlyphs::FontGlyphs):
(WebCore::FontGlyphs::releaseFontData):
(WebCore::FontGlyphs::realizeFontDataAt):
(WebCore::FontGlyphs::glyphDataAndPageForCharacter):
* platform/graphics/freetype/FontPlatformDataFreeType.cpp:
(WebCore::FontPlatformData::verticalData):
* platform/graphics/ios/SimpleFontDataIOS.mm:
(WebCore::SimpleFontData::platformCreateScaledFontData):
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::invalidateFontCache):
(WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::platformDestroy):
(WebCore::SimpleFontData::platformCreateScaledFontData):
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::getCJKCodePageMasks):
* platform/graphics/win/SimpleFontDataWin.cpp:
(WebCore::SimpleFontData::containsCharacters):
* platform/graphics/wince/FontCacheWinCE.cpp:
(WebCore::getCJKCodePageMasks):
* platform/graphics/wince/FontPlatformData.cpp:
(WebCore::FontFamilyCodePageInfo::codePages):
(WebCore::FixedSizeFontData::create):
* platform/graphics/wince/GlyphPageTreeNodeWinCE.cpp:
(WebCore::GlyphPage::fill):
* platform/graphics/wince/SimpleFontDataWinCE.cpp:
(WebCore::SimpleFontData::platformCreateScaledFontData):
(WebCore::SimpleFontData::containsCharacters):

Source/WebKit/efl:
* ewk/ewk_settings.cpp:
(ewk_settings_memory_cache_clear):

Source/WebKit/ios:
* Misc/EmojiFallbackFontSelector.cpp:
(EmojiFallbackFontSelector::getFallbackFontData):

Source/WebKit/mac:
* Misc/WebCoreStatistics.mm:
(+[WebCoreStatistics cachedFontDataCount]):
(+[WebCoreStatistics cachedFontDataInactiveCount]):
(+[WebCoreStatistics purgeInactiveFontData]):
* WebView/WebView.mm:
(+[WebView purgeInactiveFontData]):

Source/WebKit/win:
* WebCoreStatistics.cpp:
(WebCoreStatistics::cachedFontDataCount):
(WebCoreStatistics::cachedFontDataInactiveCount):
(WebCoreStatistics::purgeInactiveFontData):

Source/WebKit2:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::terminate):
(WebKit::WebProcess::didClose):
(WebKit::WebProcess::getWebCoreStatistics):

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

29 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSFontFaceSource.cpp
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/platform/MemoryPressureHandler.cpp
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontGlyphs.cpp
Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
Source/WebCore/platform/graphics/win/FontCacheWin.cpp
Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
Source/WebCore/platform/graphics/wince/FontCacheWinCE.cpp
Source/WebCore/platform/graphics/wince/FontPlatformData.cpp
Source/WebCore/platform/graphics/wince/GlyphPageTreeNodeWinCE.cpp
Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/ewk/ewk_settings.cpp
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/Misc/EmojiFallbackFontSelector.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Misc/WebCoreStatistics.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 c68bf25..6e63240 100644 (file)
@@ -1,3 +1,61 @@
+2014-04-24  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        FontCache::fontCache() never returns nullptr so it can be made to return a reference instead
+        https://bugs.webkit.org/show_bug.cgi?id=132110
+
+        Reviewed by Tim Horton.
+
+        Updates callers to use '.' instead of '->'.
+
+        No new tests are necessary because there should be no behavior change.
+
+        * css/CSSFontFaceSource.cpp:
+        (WebCore::CSSFontFaceSource::getFontData):
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::CSSFontSelector):
+        (WebCore::CSSFontSelector::~CSSFontSelector):
+        (WebCore::CSSFontSelector::addFontFaceRule):
+        (WebCore::fontDataForGenericFamily):
+        (WebCore::CSSFontSelector::getFallbackFontData):
+        * platform/MemoryPressureHandler.cpp:
+        (WebCore::MemoryPressureHandler::releaseMemory):
+        * platform/graphics/FontCache.cpp:
+        (WebCore::fontCache): Return a reference
+        * platform/graphics/FontCache.h:
+        (WebCore::FontCachePurgePreventer::FontCachePurgePreventer):
+        (WebCore::FontCachePurgePreventer::~FontCachePurgePreventer):
+        * platform/graphics/FontGlyphs.cpp:
+        (WebCore::FontGlyphs::FontGlyphs):
+        (WebCore::FontGlyphs::releaseFontData):
+        (WebCore::FontGlyphs::realizeFontDataAt):
+        (WebCore::FontGlyphs::glyphDataAndPageForCharacter):
+        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+        (WebCore::FontPlatformData::verticalData):
+        * platform/graphics/ios/SimpleFontDataIOS.mm:
+        (WebCore::SimpleFontData::platformCreateScaledFontData):
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::invalidateFontCache):
+        (WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
+        * platform/graphics/mac/SimpleFontDataMac.mm:
+        (WebCore::SimpleFontData::platformDestroy):
+        (WebCore::SimpleFontData::platformCreateScaledFontData):
+        * platform/graphics/win/FontCacheWin.cpp:
+        (WebCore::getCJKCodePageMasks):
+        * platform/graphics/win/SimpleFontDataWin.cpp:
+        (WebCore::SimpleFontData::containsCharacters):
+        * platform/graphics/wince/FontCacheWinCE.cpp:
+        (WebCore::getCJKCodePageMasks):
+        * platform/graphics/wince/FontPlatformData.cpp:
+        (WebCore::FontFamilyCodePageInfo::codePages):
+        (WebCore::FixedSizeFontData::create):
+        * platform/graphics/wince/GlyphPageTreeNodeWinCE.cpp:
+        (WebCore::GlyphPage::fill):
+        * platform/graphics/wince/SimpleFontDataWinCE.cpp:
+        (WebCore::SimpleFontData::platformCreateScaledFontData):
+        (WebCore::SimpleFontData::containsCharacters):
+
 2014-04-24  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] Manage AudioSession category according to media type
index 98ff875..b60c85c 100644 (file)
@@ -108,7 +108,7 @@ PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription&
     ) {
         // We're local. Just return a SimpleFontData from the normal cache.
         // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter.
-        return fontCache()->getCachedFontData(fontDescription, m_string, true);
+        return fontCache().getCachedFontData(fontDescription, m_string, true);
     }
 
     // See if we have a mapping in our FontData cache.
@@ -172,7 +172,7 @@ PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription&
 
         // This temporary font is not retained and should not be returned.
         FontCachePurgePreventer fontCachePurgePreventer;
-        SimpleFontData* temporaryFont = fontCache()->getNonRetainedLastResortFallbackFont(fontDescription);
+        SimpleFontData* temporaryFont = fontCache().getNonRetainedLastResortFallbackFont(fontDescription);
         fontData = SimpleFontData::create(temporaryFont->platformData(), true, true);
     }
 
index f7c045e..0121748 100644 (file)
@@ -70,13 +70,13 @@ CSSFontSelector::CSSFontSelector(Document* document)
     // seem to be any such guarantee.
 
     ASSERT(m_document);
-    fontCache()->addClient(this);
+    fontCache().addClient(this);
 }
 
 CSSFontSelector::~CSSFontSelector()
 {
     clearDocument();
-    fontCache()->removeClient(this);
+    fontCache().removeClient(this);
 }
 
 bool CSSFontSelector::isEmpty() const
@@ -300,7 +300,7 @@ void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule)
             ASSERT(!m_locallyInstalledFontFaces.contains(familyName));
 
             Vector<unsigned> locallyInstalledFontsTraitsMasks;
-            fontCache()->getTraitsInFamily(familyName, locallyInstalledFontsTraitsMasks);
+            fontCache().getTraitsInFamily(familyName, locallyInstalledFontsTraitsMasks);
             if (unsigned numLocallyInstalledFaces = locallyInstalledFontsTraitsMasks.size()) {
                 auto familyLocallyInstalledFaces = std::make_unique<Vector<RefPtr<CSSFontFace>>>();
 
@@ -386,7 +386,7 @@ static PassRefPtr<SimpleFontData> fontDataForGenericFamily(Document* document, c
         genericFamily = settings.standardFontFamily(script);
 
     if (!genericFamily.isEmpty())
-        return fontCache()->getCachedFontData(fontDescription, genericFamily);
+        return fontCache().getCachedFontData(fontDescription, genericFamily);
 
     return nullptr;
 }
@@ -649,7 +649,7 @@ PassRefPtr<FontData> CSSFontSelector::getFallbackFontData(const FontDescription&
     if (!settings || !settings->fontFallbackPrefersPictographs())
         return 0;
 
-    return fontCache()->getCachedFontData(fontDescription, settings->pictographFontFamily());
+    return fontCache().getCachedFontData(fontDescription, settings->pictographFontFamily());
 }
 
 }
index a3749d8..493eb13 100644 (file)
@@ -76,7 +76,7 @@ void MemoryPressureHandler::releaseMemory(bool critical)
 
     {
         ReliefLogger log("Purge inactive FontData");
-        fontCache()->purgeInactiveFontData();
+        fontCache().purgeInactiveFontData();
     }
 
     {
index 5b49cd9..4c65eb7 100644 (file)
@@ -85,11 +85,10 @@ using namespace WTF;
 
 namespace WebCore {
 
-// FIXME: We should return a reference instead of a pointer since we never return a nullptr.
-FontCache* fontCache()
+FontCache& fontCache()
 {
     static NeverDestroyed<FontCache> globalFontCache;
-    return &globalFontCache.get();
+    return globalFontCache.get();
 }
 
 FontCache::FontCache()
index c3e8e71..1b15945 100644 (file)
@@ -108,7 +108,7 @@ class FontCache {
 
     WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED;
 public:
-    friend FontCache* fontCache();
+    friend FontCache& fontCache();
 
     enum ShouldRetain { Retain, DoNotRetain };
 
@@ -203,12 +203,12 @@ private:
 };
 
 // Get the global fontCache.
-FontCache* fontCache();
+FontCache& fontCache();
 
 class FontCachePurgePreventer {
 public:
-    FontCachePurgePreventer() { fontCache()->disablePurging(); }
-    ~FontCachePurgePreventer() { fontCache()->enablePurging(); }
+    FontCachePurgePreventer() { fontCache().disablePurging(); }
+    ~FontCachePurgePreventer() { fontCache().enablePurging(); }
 };
 
 }
index 3004c51..9487cc0 100644 (file)
@@ -42,7 +42,7 @@ FontGlyphs::FontGlyphs(PassRefPtr<FontSelector> fontSelector)
     , m_fontSelector(fontSelector)
     , m_fontSelectorVersion(m_fontSelector ? m_fontSelector->version() : 0)
     , m_familyIndex(0)
-    , m_generation(fontCache()->generation())
+    , m_generation(fontCache().generation())
     , m_pitch(UnknownPitch)
     , m_loadingCustomFonts(false)
     , m_isForPlatformFont(false)
@@ -55,12 +55,12 @@ FontGlyphs::FontGlyphs(const FontPlatformData& platformData)
     , m_fontSelector(0)
     , m_fontSelectorVersion(0)
     , m_familyIndex(cAllFamiliesScanned)
-    , m_generation(fontCache()->generation())
+    , m_generation(fontCache().generation())
     , m_pitch(UnknownPitch)
     , m_loadingCustomFonts(false)
     , m_isForPlatformFont(true)
 {
-    RefPtr<FontData> fontData = fontCache()->getCachedFontData(&platformData);
+    RefPtr<FontData> fontData = fontCache().getCachedFontData(&platformData);
     m_realizedFontData.append(fontData.release());
 }
 
@@ -71,7 +71,7 @@ void FontGlyphs::releaseFontData()
         if (m_realizedFontData[i]->isCustomFont())
             continue;
         ASSERT(!m_realizedFontData[i]->isSegmented());
-        fontCache()->releaseFontData(static_cast<const SimpleFontData*>(m_realizedFontData[i].get()));
+        fontCache().releaseFontData(static_cast<const SimpleFontData*>(m_realizedFontData[i].get()));
     }
 }
 
@@ -117,8 +117,8 @@ const FontData* FontGlyphs::realizeFontDataAt(const FontDescription& description
     // We are obtaining this font for the first time. We keep track of the families we've looked at before
     // in |m_familyIndex|, so that we never scan the same spot in the list twice. getFontData will adjust our
     // |m_familyIndex| as it scans for the right font to make.
-    ASSERT(fontCache()->generation() == m_generation);
-    RefPtr<FontData> result = fontCache()->getFontData(description, m_familyIndex, m_fontSelector.get());
+    ASSERT(fontCache().generation() == m_generation);
+    RefPtr<FontData> result = fontCache().getFontData(description, m_familyIndex, m_fontSelector.get());
     if (result) {
         m_realizedFontData.append(result);
         if (result->isLoading())
@@ -381,7 +381,7 @@ std::pair<GlyphData, GlyphPage*> FontGlyphs::glyphDataAndPageForCharacter(const
         codeUnitsLength = 2;
     }
     const SimpleFontData* originalFontData = primaryFontData(description)->fontDataForCharacter(c);
-    RefPtr<SimpleFontData> characterFontData = fontCache()->systemFallbackForCharacters(description, originalFontData, m_isForPlatformFont, codeUnits, codeUnitsLength);
+    RefPtr<SimpleFontData> characterFontData = fontCache().systemFallbackForCharacters(description, originalFontData, m_isForPlatformFont, codeUnits, codeUnitsLength);
     if (characterFontData) {
         if (characterFontData->platformData().orientation() == Vertical && !characterFontData->hasVerticalGlyphs() && Font::isCJKIdeographOrSymbol(c))
             variant = BrokenIdeographVariant;
index 765f75e..1d4f24d 100644 (file)
@@ -343,7 +343,7 @@ bool FontPlatformData::hasCompatibleCharmap()
 PassRefPtr<OpenTypeVerticalData> FontPlatformData::verticalData() const
 {
     ASSERT(hash());
-    return fontCache()->getVerticalData(String::number(hash()), *this);
+    return fontCache().getVerticalData(String::number(hash()), *this);
 }
 
 PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
index 7750c49..0b140e1 100644 (file)
@@ -159,7 +159,7 @@ PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo
         scaledFontData.m_syntheticBold = (fontTraits & kCTFontBoldTrait) && !(scaledFontTraits & kCTFontTraitBold);
         scaledFontData.m_syntheticOblique = (fontTraits & kCTFontItalicTrait) && !(scaledFontTraits & kCTFontTraitItalic);
 
-        return fontCache()->getCachedFontData(&scaledFontData);
+        return fontCache().getCachedFontData(&scaledFontData);
     }
 
     return nullptr;
index 44c0294..fea48df 100644 (file)
@@ -269,13 +269,13 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
                         m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));
                         continue;
                     }
-                    runFontData = fontCache()->getCachedFontData(m_font.fontDescription(), fontName.get(), false, FontCache::DoNotRetain).get();
+                    runFontData = fontCache().getCachedFontData(m_font.fontDescription(), fontName.get(), false, FontCache::DoNotRetain).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 (!runFontData) {
                         FontPlatformData runFontPlatformData((NSFont *)runFont, CTFontGetSize(runFont), m_font.fontDescription().usePrinterFont());
-                        runFontData = fontCache()->getCachedFontData(&runFontPlatformData, FontCache::DoNotRetain).get();
+                        runFontData = fontCache().getCachedFontData(&runFontPlatformData, FontCache::DoNotRetain).get();
                     }
 #else
                     // FIXME: Just assert for now, until we can devise a better fix that works with iOS.
index 9631c5a..69021a5 100644 (file)
@@ -51,12 +51,12 @@ static void invalidateFontCache(void*)
         callOnMainThread(&invalidateFontCache, 0);
         return;
     }
-    fontCache()->invalidate();
+    fontCache().invalidate();
 }
 
 static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef)
 {
-    ASSERT_UNUSED(observer, observer == fontCache());
+    ASSERT_UNUSED(observer, observer == &fontCache());
     ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotification));
     invalidateFontCache(0);
 }
index 72357fa..a5eec0f 100644 (file)
@@ -275,10 +275,10 @@ void SimpleFontData::platformDestroy()
     if (!isCustomFont() && m_derivedFontData) {
         // These come from the cache.
         if (m_derivedFontData->smallCaps)
-            fontCache()->releaseFontData(m_derivedFontData->smallCaps.get());
+            fontCache().releaseFontData(m_derivedFontData->smallCaps.get());
 
         if (m_derivedFontData->emphasisMark)
-            fontCache()->releaseFontData(m_derivedFontData->emphasisMark.get());
+            fontCache().releaseFontData(m_derivedFontData->emphasisMark.get());
     }
 }
 
@@ -313,7 +313,7 @@ PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo
         scaledFontData.m_syntheticOblique = (fontTraits & NSItalicFontMask) && !(scaledFontTraits & NSItalicFontMask);
 
         // SimpleFontData::platformDestroy() takes care of not deleting the cached font data twice.
-        return fontCache()->getCachedFontData(&scaledFontData);
+        return fontCache().getCachedFontData(&scaledFontData);
     }
     END_BLOCK_OBJC_EXCEPTIONS;
 
index 9f6a2e4..41023a8 100644 (file)
@@ -138,7 +138,7 @@ static const Vector<DWORD, 4>& getCJKCodePageMasks()
     static bool initialized;
     if (!initialized) {
         initialized = true;
-        IMLangFontLinkType* langFontLink = fontCache()->getFontLinkInterface();
+        IMLangFontLinkType* langFontLink = fontCache().getFontLinkInterface();
         if (!langFontLink)
             return codePageMasks;
 
index 3f570c9..fedd3ed 100644 (file)
@@ -152,7 +152,7 @@ bool SimpleFontData::containsCharacters(const UChar* characters, int length) con
     // FIXME: Microsoft documentation seems to imply that characters can be output using a given font and DC
     // merely by testing code page intersection.  This seems suspect though.  Can't a font only partially
     // cover a given code page?
-    IMLangFontLinkType* langFontLink = fontCache()->getFontLinkInterface();
+    IMLangFontLinkType* langFontLink = fontCache().getFontLinkInterface();
     if (!langFontLink)
         return false;
 
index 137449b..f9ebe4b 100644 (file)
@@ -127,7 +127,7 @@ static const Vector<DWORD, 4>& getCJKCodePageMasks()
     static bool initialized;
     if (!initialized) {
         initialized = true;
-        IMLangFontLinkType* langFontLink = fontCache()->getFontLinkInterface();
+        IMLangFontLinkType* langFontLink = fontCache().getFontLinkInterface();
         if (!langFontLink)
             return codePageMasks;
 
index e88d582..ca6ca5f 100644 (file)
@@ -53,7 +53,7 @@ public:
     DWORD codePages() const
     {
         if (!m_codePages) {
-            if (IMLangFontLinkType* langFontLink = fontCache()->getFontLinkInterface())
+            if (IMLangFontLinkType* langFontLink = fontCache().getFontLinkInterface())
                 langFontLink->CodePageToCodePages(m_codePage, &m_codePages);
         }
         return m_codePages;
@@ -262,7 +262,7 @@ PassRefPtr<FixedSizeFontData> FixedSizeFontData::create(const AtomicString& fami
 
     GetTextMetrics(g_screenDC, &fontData->m_metrics);
 
-    if (IMLangFontLinkType* langFontLink = fontCache()->getFontLinkInterface()) {
+    if (IMLangFontLinkType* langFontLink = fontCache().getFontLinkInterface()) {
         langFontLink->GetFontCodePages(g_screenDC, fontData->m_hfont.get(), &fontData->m_codePages);
         fontData->m_codePages |= FontPlatformData::getKnownFontCodePages(winFont.lfFaceName);
     }
index 025689c..8dc55f4 100644 (file)
@@ -51,7 +51,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
                         setGlyphDataForIndex(offset + i, 0, 0);
                 }
                 return true;
-            } else if (IMLangFontLinkType* langFontLink = fontCache()->getFontLinkInterface()) {
+            } else if (IMLangFontLinkType* langFontLink = fontCache().getFontLinkInterface()) {
                 for (unsigned i = 0; i < bufferLength; ++i) {
                     DWORD actualCodePages;
                     langFontLink->GetCharCodePages(buffer[i], &actualCodePages);
index f075ccb..bcb8f8c 100644 (file)
@@ -69,7 +69,7 @@ PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo
     fontDesc.setComputedSize(lroundf(scaleFactor * fontDesc.computedSize()));
     fontDesc.setSpecifiedSize(lroundf(scaleFactor * fontDesc.specifiedSize()));
     fontDesc.setKeywordSize(lroundf(scaleFactor * fontDesc.keywordSize()));
-    FontPlatformData* result = fontCache()->getCachedFontPlatformData(fontDesc, m_platformData.family());
+    FontPlatformData* result = fontCache().getCachedFontPlatformData(fontDesc, m_platformData.family());
     if (!result)
         return 0;
     return SimpleFontData::create(*result);
@@ -87,7 +87,7 @@ bool SimpleFontData::containsCharacters(const UChar* characters, int length) con
     // cover a given code page?
 
     // FIXME: in the case that we failed to get the interface, still use the font.
-    IMLangFontLinkType* langFontLink = fontCache()->getFontLinkInterface();
+    IMLangFontLinkType* langFontLink = fontCache().getFontLinkInterface();
     if (!langFontLink)
         return true;
 
index 99ffcdf..285679f 100644 (file)
@@ -1,3 +1,17 @@
+2014-04-24  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        FontCache::fontCache() never returns nullptr so it can be made to return a reference instead
+        https://bugs.webkit.org/show_bug.cgi?id=132110
+
+        Reviewed by Tim Horton.
+
+        Updates callers to use '.' instead of '->'.
+
+        No new tests are necessary because there should be no behavior change.
+
+        * ewk/ewk_settings.cpp:
+        (ewk_settings_memory_cache_clear):
+
 2014-04-23  Hyowon Kim  <hw1008.kim@samsung.com>
 
         [EFL][WK1] Add *const* keyword to _get() APIs
index 209d4f5..72d0661 100644 (file)
@@ -279,7 +279,7 @@ void ewk_settings_memory_cache_clear()
     WebCore::pageCache()->setCapacity(pageCapacity);
 
     // Invalidating the font cache and freeing all inactive font data.
-    WebCore::fontCache()->invalidate();
+    WebCore::fontCache().invalidate();
 
     // Empty the Cross-Origin Preflight cache
     WebCore::CrossOriginPreflightResultCache::shared().empty();
index 8b440ae..5f3420c 100644 (file)
@@ -1,3 +1,17 @@
+2014-04-24  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        FontCache::fontCache() never returns nullptr so it can be made to return a reference instead
+        https://bugs.webkit.org/show_bug.cgi?id=132110
+
+        Reviewed by Tim Horton.
+
+        Updates callers to use '.' instead of '->'.
+
+        No new tests are necessary because there should be no behavior change.
+
+        * Misc/EmojiFallbackFontSelector.cpp:
+        (EmojiFallbackFontSelector::getFallbackFontData):
+
 2014-04-17  Daniel Bates  <dabates@apple.com>
 
         [iOS] Hook up screen.{availHeight, availWidth, height, width}
index f464a7f..e4be6a6 100644 (file)
@@ -37,10 +37,10 @@ using namespace WebCore;
 PassRefPtr<FontData> EmojiFallbackFontSelector::getFallbackFontData(const FontDescription& fontDescription, size_t)
 {
     DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, appleColorEmoji, ("Apple Color Emoji"));
-    RefPtr<FontData> fontData = fontCache()->getCachedFontData(fontDescription, appleColorEmoji);
+    RefPtr<FontData> fontData = fontCache().getCachedFontData(fontDescription, appleColorEmoji);
     if (!fontData) {
         LOG_ERROR("Failed to get \"Apple Color Emoji\" from the font cache. Using the last resort fallback font instead.");
-        fontData = fontCache()->getLastResortFallbackFont(fontDescription);
+        fontData = fontCache().getLastResortFallbackFont(fontDescription);
     }
 
     return fontData.release();
index 8e98fb9..4871a71 100644 (file)
@@ -1,3 +1,21 @@
+2014-04-24  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        FontCache::fontCache() never returns nullptr so it can be made to return a reference instead
+        https://bugs.webkit.org/show_bug.cgi?id=132110
+
+        Reviewed by Tim Horton.
+
+        Updates callers to use '.' instead of '->'.
+
+        No new tests are necessary because there should be no behavior change.
+
+        * Misc/WebCoreStatistics.mm:
+        (+[WebCoreStatistics cachedFontDataCount]):
+        (+[WebCoreStatistics cachedFontDataInactiveCount]):
+        (+[WebCoreStatistics purgeInactiveFontData]):
+        * WebView/WebView.mm:
+        (+[WebView purgeInactiveFontData]):
+
 2014-04-24  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] Manage AudioSession category according to media type
index 065f793..c3d6a73 100644 (file)
@@ -147,17 +147,17 @@ using namespace WebCore;
 
 + (size_t)cachedFontDataCount
 {
-    return fontCache()->fontDataCount();
+    return fontCache().fontDataCount();
 }
 
 + (size_t)cachedFontDataInactiveCount
 {
-    return fontCache()->inactiveFontDataCount();
+    return fontCache().inactiveFontDataCount();
 }
 
 + (void)purgeInactiveFontData
 {
-    fontCache()->purgeInactiveFontData();
+    fontCache().purgeInactiveFontData();
 }
 
 + (size_t)glyphPageCount
index 5fa27fa..f6023a4 100644 (file)
@@ -1328,7 +1328,7 @@ static bool shouldUseLegacyBackgroundSizeShorthandBehavior()
 {
     ASSERT(WebThreadIsCurrent());
     WebKit::MemoryMeasure measurer("Memory warning: Purging inactive font data.");
-    fontCache()->purgeInactiveFontData();
+    fontCache().purgeInactiveFontData();
 }
 
 + (void)drainLayerPool
index 26e6a88..e6133f7 100644 (file)
@@ -1,3 +1,19 @@
+2014-04-24  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        FontCache::fontCache() never returns nullptr so it can be made to return a reference instead
+        https://bugs.webkit.org/show_bug.cgi?id=132110
+
+        Reviewed by Tim Horton.
+
+        Updates callers to use '.' instead of '->'.
+
+        No new tests are necessary because there should be no behavior change.
+
+        * WebCoreStatistics.cpp:
+        (WebCoreStatistics::cachedFontDataCount):
+        (WebCoreStatistics::cachedFontDataInactiveCount):
+        (WebCoreStatistics::purgeInactiveFontData):
+
 2014-04-22  Alex Christensen  <achristensen@webkit.org>
 
         Begin implementation of video using Media Foundation.
index 1b83925..ac86e29 100644 (file)
@@ -193,7 +193,7 @@ HRESULT STDMETHODCALLTYPE WebCoreStatistics::cachedFontDataCount(
 {
     if (!count)
         return E_POINTER;
-    *count = (UINT) fontCache()->fontDataCount();
+    *count = (UINT) fontCache().fontDataCount();
     return S_OK;
 }
 
@@ -202,13 +202,13 @@ HRESULT STDMETHODCALLTYPE WebCoreStatistics::cachedFontDataInactiveCount(
 {
     if (!count)
         return E_POINTER;
-    *count = (UINT) fontCache()->inactiveFontDataCount();
+    *count = (UINT) fontCache().inactiveFontDataCount();
     return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE WebCoreStatistics::purgeInactiveFontData(void)
 {
-    fontCache()->purgeInactiveFontData();
+    fontCache().purgeInactiveFontData();
     return S_OK;
 }
 
index 6835d34..3e3c0b5 100644 (file)
@@ -1,3 +1,19 @@
+2014-04-24  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        FontCache::fontCache() never returns nullptr so it can be made to return a reference instead
+        https://bugs.webkit.org/show_bug.cgi?id=132110
+
+        Reviewed by Tim Horton.
+
+        Updates callers to use '.' instead of '->'.
+
+        No new tests are necessary because there should be no behavior change.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::terminate):
+        (WebKit::WebProcess::didClose):
+        (WebKit::WebProcess::getWebCoreStatistics):
+
 2014-04-24  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] Manage AudioSession category according to media type
index 73f0ebd..e26ef15 100644 (file)
@@ -564,7 +564,7 @@ void WebProcess::terminate()
 {
 #ifndef NDEBUG
     gcController().garbageCollectNow();
-    fontCache()->invalidate();
+    fontCache().invalidate();
     memoryCache()->setDisabled(true);
 #endif
 
@@ -617,7 +617,7 @@ void WebProcess::didClose(IPC::Connection*)
     pages.clear();
 
     gcController().garbageCollectSoon();
-    fontCache()->invalidate();
+    fontCache().invalidate();
     memoryCache()->setDisabled(true);
 #endif    
 
@@ -898,8 +898,8 @@ void WebProcess::getWebCoreStatistics(uint64_t callbackID)
     data.statisticsNumbers.set(ASCIILiteral("IconsWithDataCount"), iconDatabase().iconRecordCountWithData());
     
     // Gather font statistics.
-    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataCount"), fontCache()->fontDataCount());
-    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataInactiveCount"), fontCache()->inactiveFontDataCount());
+    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataCount"), fontCache().fontDataCount());
+    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataInactiveCount"), fontCache().inactiveFontDataCount());
     
     // Gather glyph page statistics.
     data.statisticsNumbers.set(ASCIILiteral("GlyphPageCount"), GlyphPageTreeNode::treeGlyphPageCount());