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 c68bf259b78145b454de6ce2f69aae890067e176..6e63240c732fe06ae0ee3f83646e633b06757a09 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 98ff875b4d94aca43058e72ddd3fc5677d7d1e29..b60c85ca277509c27a82d984eb02fb89e872b3ea 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 f7c045e014bc1564fc946f4f442a71760297606d..012174846355f38abbe9c719837e0277967b19f3 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 a3749d85f6b8662315cbec5eed1a70b496c44ede..493eb13ab5a0944e45bd595aac6f8e58aa4885aa 100644 (file)
@@ -76,7 +76,7 @@ void MemoryPressureHandler::releaseMemory(bool critical)
 
     {
         ReliefLogger log("Purge inactive FontData");
-        fontCache()->purgeInactiveFontData();
+        fontCache().purgeInactiveFontData();
     }
 
     {
index 5b49cd90a665027a844f4b7299cd51480741a2f9..4c65eb79982f9841c15e49c0bf6cf024a2ab3811 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 c3e8e71f71cb04f77253d8c6dd2b800ecd67f506..1b15945a503ba93f64216ac96532bfd7d9317d88 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 3004c5171fe1980a39e4aba0b4345bae6de1248f..9487cc0a08b1cdb008bd1c1dd36f0d104a4dd2f7 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 765f75ef277cc8197b63adfef924694349d15350..1d4f24d3a08e1d542e31343d75492d7d2c8e19f3 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 7750c49e5ce34b96d9592c26461318d7f4952f1b..0b140e1dbcdf4fd935d2f8f6398b8465da6a24dd 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 44c0294fd77c0ff9b28a3811ff718b0cce1f011c..fea48df91d9a767f8faf23348c179143c2c36893 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 9631c5afb1c5e03a17d4162888cbc70348dbd7d8..69021a5125fdf59644ac0dc9637e06106b11671b 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 72357fadf71ecc4ac941a42fd4372694806f1568..a5eec0faa16416a2817459caa4da1ad63005dd4a 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 9f6a2e4272c7ffe1a4fad625072fcfd35d8124fe..41023a81262cbcb826a4e73187942374acf03b4a 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 3f570c9d313b74d780b7c0109ca941883b56c7b3..fedd3edf1cd4d8e42aa27431143b514a3fa587d6 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 137449b38eb70dc249472f6e2df131cdc0b9f208..f9ebe4bfb66dc57c0b5f7919000e994d93732e51 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 e88d582770c7229c34619485de30e8d551f0a0e0..ca6ca5f8680239810b5a2423148d5671f017a568 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 025689cc51f7c72c099ab74a276c6e463df03214..8dc55f428f4a4c29df7b8a971af61d4c2c62e4f3 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 f075ccbc74c566c7d4c0b7a0db9c50ea45175701..bcb8f8cc7f3f078e9b7da7389f4aa6ee54ca8d97 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 99ffcdf811f798fa2251181b6b910f96494f1a2b..285679f4145dcb384c224f5031f478ce8ba11a0f 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 209d4f5b450e2007d32eaef6925841878483e5b8..72d06619ee17e312a2bb9152d0c1ba692fcd23ab 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 8b440ae3713a2184b9bd8246aacb8b7f1018f2c8..5f3420c64caa2dadd0fb4ef739332564ed233864 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 f464a7fba4878af23da8aa06ec41f360f45d2fc2..e4be6a64f26be4d3e4802e7d5768ee51a47c0be3 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 8e98fb9a388dc77dc251a2c268b22b6e80389f59..4871a7124f50cb732a025a1793be4fc313edf07d 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 065f793de7e9b2b2ca285372d8f45706f3d626e8..c3d6a73e3a3b5d6ebcc430ef8ec43de70df84b25 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 5fa27fa0246ce8c18a8a7c7960c96dc5604b31ad..f6023a426cf78c3ef038b01e2e1aafd7daa7ed0b 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 26e6a88a4ec82e0f68ffcd660bbfbc7f33e64840..e6133f7009945265f52599e92541d251c90b58a3 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 1b83925e74fa5bb3489fae332c7ab8bcc9e08546..ac86e29b28aa3c36c9dd0f0e61fe489f43fec42a 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 6835d3495e8a1d82cf9e13cef91abdf392b4c009..3e3c0b5fb14616e6455664352e00f351f94a4b75 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 73f0ebd1d3a981dda6bdab7e9372675e95e3e0c9..e26ef15b5fe7ef78a7cedafac3b5103c4e1a86cc 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());