From c989e1851ee6b1be2b5b56129efcd14cfafb31d8 Mon Sep 17 00:00:00 2001 From: bungeman Date: Thu, 19 May 2016 11:23:55 -0700 Subject: Remove mutex for retrieving default typeface. This mutex was added due to FontConfigTypeface::LegacyCreateTypeface being non-thread safe. This method no longer exists and the logic was moved to SkFontMgr_FCI::onLegacyCreateTypeface which has access to an appropriate mutex ("Clean up SkFontConfigInterface implementation.", 0265707c191a31dfde08dd1cd7011c1fe5b8e643). Review-Url: https://codereview.chromium.org/1994703003 --- src/core/SkTypeface.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/core') diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 3c15878f73..ba9e765e99 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -78,19 +78,12 @@ protected: } -SK_DECLARE_STATIC_MUTEX(gCreateDefaultMutex); - SkTypeface* SkTypeface::GetDefaultTypeface(Style style) { static SkOnce once[4]; static SkTypeface* defaults[4]; SkASSERT((int)style < 4); once[style]([style] { - // It is not safe to call FontConfigTypeface::LegacyCreateTypeface concurrently. - // To be safe, we serialize here with a mutex so only one call to - // CreateTypeface is happening at any given time. - // TODO(bungeman, mtklein): This is sad. Make our fontconfig code safe? - SkAutoMutexAcquire lock(&gCreateDefaultMutex); SkAutoTUnref fm(SkFontMgr::RefDefault()); SkTypeface* t = fm->legacyCreateTypeface(nullptr, SkFontStyle::FromOldStyle(style)); defaults[style] = t ? t : SkEmptyTypeface::Create(); -- cgit v1.2.3