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