Bug 1611467 - disable Skia typeface cache to prevent it from leaking fonts. r=jrmuizel
authorLee Salzman <lsalzman@mozilla.com>
Wed, 25 Mar 2020 00:58:41 +0000
changeset 520310 14b59d4adc958b8fd2bbfa2497a758a1575a39c9
parent 520309 36300cc32afc651a155380297dd1fdc8bcd31c31
child 520311 97e12e4882482fa89bfbe83246a2b7cc23676611
push id37246
push useropoprus@mozilla.com
push dateWed, 25 Mar 2020 03:40:33 +0000
treeherdermozilla-central@14b59d4adc95 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1611467
milestone76.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 1611467 - disable Skia typeface cache to prevent it from leaking fonts. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D68131
gfx/skia/skia/include/config/SkUserConfig.h
gfx/skia/skia/src/core/SkTypefaceCache.cpp
--- a/gfx/skia/skia/include/config/SkUserConfig.h
+++ b/gfx/skia/skia/include/config/SkUserConfig.h
@@ -121,9 +121,11 @@
 #endif
 
 #define SK_DISABLE_SLOW_DEBUG_VALIDATION 1
 
 #define SK_IGNORE_MAC_BLENDING_MATCH_FIX
 
 #define I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN
 
+#define SK_DISABLE_TYPEFACE_CACHE
+
 #endif
--- a/gfx/skia/skia/src/core/SkTypefaceCache.cpp
+++ b/gfx/skia/skia/src/core/SkTypefaceCache.cpp
@@ -63,28 +63,36 @@ SkFontID SkTypefaceCache::NewFontID() {
 }
 
 static SkMutex& typeface_cache_mutex() {
     static SkMutex& mutex = *(new SkMutex);
     return mutex;
 }
 
 void SkTypefaceCache::Add(sk_sp<SkTypeface> face) {
+#ifndef SK_DISABLE_TYPEFACE_CACHE
     SkAutoMutexExclusive ama(typeface_cache_mutex());
     Get().add(std::move(face));
+#endif
 }
 
 sk_sp<SkTypeface> SkTypefaceCache::FindByProcAndRef(FindProc proc, void* ctx) {
+#ifndef SK_DISABLE_TYPEFACE_CACHE
     SkAutoMutexExclusive ama(typeface_cache_mutex());
     return Get().findByProcAndRef(proc, ctx);
+#else
+    return nullptr;
+#endif
 }
 
 void SkTypefaceCache::PurgeAll() {
+#ifndef SK_DISABLE_TYPEFACE_CACHE
     SkAutoMutexExclusive ama(typeface_cache_mutex());
     Get().purgeAll();
+#endif
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifdef SK_DEBUG
 static bool DumpProc(SkTypeface* face, void* ctx) {
     SkString n;
     face->getFamilyName(&n);