aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-05-19 11:23:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-19 11:23:55 -0700
commitc989e1851ee6b1be2b5b56129efcd14cfafb31d8 (patch)
tree9da5502bfc44b096b2b4edb6bc4b31e3f12a5b07 /src/core
parent66a96d07d5583cc018cb70127bd5483799b69d0e (diff)
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
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkTypeface.cpp7
1 files changed, 0 insertions, 7 deletions
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<SkFontMgr> fm(SkFontMgr::RefDefault());
SkTypeface* t = fm->legacyCreateTypeface(nullptr, SkFontStyle::FromOldStyle(style));
defaults[style] = t ? t : SkEmptyTypeface::Create();