Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: src/core/SkTypeface.cpp

Issue 1994703003: Remove mutex for retrieving default typeface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTypeface.cpp
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 3c15878f737bc5c10a1d38b9d0377487300e8e38..ba9e765e99df11da1f869f54e9f2aee48ba113cc 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<SkFontMgr> fm(SkFontMgr::RefDefault());
SkTypeface* t = fm->legacyCreateTypeface(nullptr, SkFontStyle::FromOldStyle(style));
defaults[style] = t ? t : SkEmptyTypeface::Create();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698