From 0adb330468ab84f9dab91072ada8cba60f6f0225 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Wed, 25 Mar 2020 00:58:41 +0000 Subject: [PATCH] Bug 1611467 - disable Skia typeface cache to prevent it from leaking fonts. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D68131 --HG-- extra : moz-landing-system : lando --- gfx/skia/skia/include/config/SkUserConfig.h | 2 ++ gfx/skia/skia/src/core/SkTypefaceCache.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/gfx/skia/skia/include/config/SkUserConfig.h b/gfx/skia/skia/include/config/SkUserConfig.h index cd7d4da248a1..b26214367794 100644 --- a/gfx/skia/skia/include/config/SkUserConfig.h +++ b/gfx/skia/skia/include/config/SkUserConfig.h @@ -126,4 +126,6 @@ #define I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN +#define SK_DISABLE_TYPEFACE_CACHE + #endif diff --git a/gfx/skia/skia/src/core/SkTypefaceCache.cpp b/gfx/skia/skia/src/core/SkTypefaceCache.cpp index bb4a08dd56cb..0d05bac7fead 100644 --- a/gfx/skia/skia/src/core/SkTypefaceCache.cpp +++ b/gfx/skia/skia/src/core/SkTypefaceCache.cpp @@ -68,18 +68,26 @@ static SkMutex& typeface_cache_mutex() { } void SkTypefaceCache::Add(sk_sp face) { +#ifndef SK_DISABLE_TYPEFACE_CACHE SkAutoMutexExclusive ama(typeface_cache_mutex()); Get().add(std::move(face)); +#endif } sk_sp 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 } ///////////////////////////////////////////////////////////////////////////////