Bug 1174946 - Back out the (incorrectly-implemented) caching of sentinelFirstFamily from bug 1165693, which should be largely overshadowed by the mFcSubstituteCache anyway. r=jdaggett
authorJonathan Kew <jkew@mozilla.com>
Sat, 20 Jun 2015 08:44:21 +0100
changeset 280652 5081a6d1bd3845030b8328c7beda877d9a1bacf1
parent 280651 a560e8f9999136d20f2b3d6e270fb2e82a1c41d3
child 280653 8e1bc0ef35d2a4fa67d13784bbe76fbed5de7ab7
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs1174946, 1165693
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1174946 - Back out the (incorrectly-implemented) caching of sentinelFirstFamily from bug 1165693, which should be largely overshadowed by the mFcSubstituteCache anyway. r=jdaggett
gfx/thebes/gfxFcPlatformFontList.cpp
gfx/thebes/gfxFcPlatformFontList.h
--- a/gfx/thebes/gfxFcPlatformFontList.cpp
+++ b/gfx/thebes/gfxFcPlatformFontList.cpp
@@ -53,17 +53,16 @@ ToFcChar8Ptr(const char* aStr)
 
 static const char*
 ToCharPtr(const FcChar8 *aStr)
 {
     return reinterpret_cast<const char*>(aStr);
 }
 
 FT_Library gfxFcPlatformFontList::sCairoFTLibrary = nullptr;
-FcChar8* gfxFcPlatformFontList::sSentinelFirstFamily = nullptr;
 
 static cairo_user_data_key_t sFcFontlistUserFontDataKey;
 
 // canonical name ==> first en name or first name if no en name
 // This is the required logic for fullname lookups as per CSS3 Fonts spec.
 static uint32_t
 FindCanonicalNameIndex(FcPattern* aFont, const char* aLangField)
 {
@@ -1035,17 +1034,16 @@ gfxFcPlatformFontList::InitFontList()
     mLastConfig = FcConfigGetCurrent();
 
     // reset font lists
     gfxPlatformFontList::InitFontList();
 
     mLocalNames.Clear();
     mGenericMappings.Clear();
     mFcSubstituteCache.Clear();
-    sSentinelFirstFamily = nullptr;
 
     // iterate over available fonts
     FcFontSet* systemFonts = FcConfigGetFonts(nullptr, FcSetSystem);
     AddFontSetFamilies(systemFonts);
 
 #ifdef MOZ_BUNDLED_FONTS
     ActivateBundledFonts();
     FcFontSet* appFonts = FcConfigGetFonts(nullptr, FcSetApplication);
@@ -1248,39 +1246,39 @@ gfxFcPlatformFontList::FindFamily(const 
     // actual font family found via this process. So check the cache first:
     NS_ConvertUTF16toUTF8 familyToFind(familyName);
     gfxFontFamily* cached = mFcSubstituteCache.GetWeak(familyToFind);
     if (cached) {
         return cached;
     }
 
     const FcChar8* kSentinelName = ToFcChar8Ptr("-moz-sentinel");
-    if (!sSentinelFirstFamily) {
-        nsAutoRef<FcPattern> sentinelSubst(FcPatternCreate());
-        FcPatternAddString(sentinelSubst, FC_FAMILY, kSentinelName);
-        FcConfigSubstitute(nullptr, sentinelSubst, FcMatchPattern);
-        FcPatternGetString(sentinelSubst, FC_FAMILY, 0, &sSentinelFirstFamily);
-    }
+    FcChar8* sentinelFirstFamily = nullptr;
+    nsAutoRef<FcPattern> sentinelSubst(FcPatternCreate());
+    FcPatternAddString(sentinelSubst, FC_FAMILY, kSentinelName);
+    FcConfigSubstitute(nullptr, sentinelSubst, FcMatchPattern);
+    FcPatternGetString(sentinelSubst, FC_FAMILY, 0, &sentinelFirstFamily);
 
     // substitutions for font, -moz-sentinel pattern
     nsAutoRef<FcPattern> fontWithSentinel(FcPatternCreate());
-    FcPatternAddString(fontWithSentinel, FC_FAMILY, ToFcChar8Ptr(familyToFind.get()));
+    FcPatternAddString(fontWithSentinel, FC_FAMILY,
+                       ToFcChar8Ptr(familyToFind.get()));
     FcPatternAddString(fontWithSentinel, FC_FAMILY, kSentinelName);
     FcConfigSubstitute(nullptr, fontWithSentinel, FcMatchPattern);
 
     // iterate through substitutions until hitting the sentinel
     FcChar8* substName = nullptr;
     for (int i = 0;
          FcPatternGetString(fontWithSentinel, FC_FAMILY,
                             i, &substName) == FcResultMatch;
          i++)
     {
         NS_ConvertUTF8toUTF16 subst(ToCharPtr(substName));
-        if (sSentinelFirstFamily &&
-            FcStrCmp(substName, sSentinelFirstFamily) == 0) {
+        if (sentinelFirstFamily &&
+            FcStrCmp(substName, sentinelFirstFamily) == 0) {
             break;
         }
         gfxFontFamily* foundFamily = gfxPlatformFontList::FindFamily(subst);
         if (foundFamily) {
             // We've figured out what family the given name maps to, after any
             // fontconfig subsitutions. Cache it to speed up future lookups.
             mFcSubstituteCache.Put(familyToFind, foundFamily);
             return foundFamily;
--- a/gfx/thebes/gfxFcPlatformFontList.h
+++ b/gfx/thebes/gfxFcPlatformFontList.h
@@ -258,12 +258,11 @@ protected:
 
     // caching family lookups as found by FindFamily after resolving substitutions
     nsRefPtrHashtable<nsCStringHashKey, gfxFontFamily> mFcSubstituteCache;
 
     nsCOMPtr<nsITimer> mCheckFontUpdatesTimer;
     nsCountedRef<FcConfig> mLastConfig;
 
     static FT_Library sCairoFTLibrary;
-    static FcChar8* sSentinelFirstFamily;
 };
 
 #endif /* GFXPLATFORMFONTLIST_H_ */