Index: src/core/SkTypeface.cpp |
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp |
index f9487870ccc537ad13e669083ab9022f554b6151..81038bc986e510e35922c21625b519839ae84dc0 100644 |
--- a/src/core/SkTypeface.cpp |
+++ b/src/core/SkTypeface.cpp |
@@ -79,8 +79,12 @@ protected: |
} |
}; |
+namespace { |
+ |
SK_DECLARE_STATIC_MUTEX(gCreateDefaultMutex); |
-SkTypeface* SkTypeface::CreateDefault(int style) { |
+ |
+// As a template arguments, these must have external linkage. |
+SkTypeface* sk_create_default_typeface(int style) { |
// If backed by fontconfig, it's not safe to call SkFontHost::CreateTypeface concurrently. |
// To be safe, we serialize here with a mutex so only one call to |
// CreateTypeface is happening at any given time. |
@@ -92,16 +96,14 @@ SkTypeface* SkTypeface::CreateDefault(int style) { |
return t ? t : SkEmptyTypeface::Create(); |
} |
-void SkTypeface::DeleteDefault(SkTypeface* t) { |
- // The SkTypeface returned by SkFontHost::CreateTypeface may _itself_ be a |
- // cleverly-shared singleton. This is less than ideal. This means we |
- // cannot just assert our ownership and SkDELETE(t) like we'd want to. |
- SkSafeUnref(t); |
-} |
+void sk_unref_typeface(SkTypeface* ptr) { SkSafeUnref(ptr); } |
-SkTypeface* SkTypeface::GetDefaultTypeface(Style style) { |
- SK_DECLARE_STATIC_LAZY_PTR_ARRAY(SkTypeface, defaults, 4, CreateDefault, DeleteDefault); |
+} // namespace |
+ |
+SK_DECLARE_STATIC_LAZY_PTR_ARRAY(SkTypeface, defaults, 4, |
+ sk_create_default_typeface, sk_unref_typeface); |
+SkTypeface* SkTypeface::GetDefaultTypeface(Style style) { |
SkASSERT((int)style < 4); |
return defaults[style]; |
} |