Index: src/ports/SkFontConfigInterface_direct_google3_factory.cpp |
diff --git a/src/ports/SkFontConfigInterface_direct_google3_factory.cpp b/src/ports/SkFontConfigInterface_direct_google3_factory.cpp |
index f0ac53fd8b5e62e176876690af99f8ca23b72d33..9e863d4f0b9bc3c8346ebbb339b42383f8d2b858 100644 |
--- a/src/ports/SkFontConfigInterface_direct_google3_factory.cpp |
+++ b/src/ports/SkFontConfigInterface_direct_google3_factory.cpp |
@@ -5,16 +5,12 @@ |
* found in the LICENSE file. |
*/ |
-/* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ |
- |
#include "SkFontConfigInterface_direct_google3.h" |
-#include "SkMutex.h" |
+#include "SkOnce.h" |
-SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBaseMutex* mutex) { |
- SkAutoMutexAcquire ac(mutex); |
- static SkFontConfigInterfaceDirectGoogle3* singleton = nullptr; |
- if (singleton == nullptr) { |
- singleton = new SkFontConfigInterfaceDirectGoogle3; |
- } |
+SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface() { |
+ static SkFontConfigInterface* singleton; |
+ static SkOnce once; |
+ once([]{ singleton = new SkFontConfigInterfaceDirectGoogle3(); }); |
return singleton; |
} |