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

Unified Diff: src/ports/SkFontConfigInterface_direct.cpp

Issue 355573006: Fix race condition in parallel font initialization. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make mutex optional Created 6 years, 6 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 | « src/ports/SkFontConfigInterface_android.cpp ('k') | src/ports/SkFontHost_fontconfig.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontConfigInterface_direct.cpp
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp
index dc9afbae1f47b642704ca02df68923145f38898f..c0cfd8fdcf9cd9c43ab565cb15e76d58badb9b6b 100644
--- a/src/ports/SkFontConfigInterface_direct.cpp
+++ b/src/ports/SkFontConfigInterface_direct.cpp
@@ -124,9 +124,13 @@ private:
SkMutex mutex_;
};
-SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface() {
- SK_DECLARE_STATIC_LAZY_PTR(SkFontConfigInterfaceDirect, direct);
- return direct.get();
+SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBaseMutex* mutex) {
+ SkAutoMutexAcquire ac(mutex);
+ static SkFontConfigInterfaceDirect* singleton = NULL;
+ if (singleton == NULL) {
+ singleton = SkNEW(SkFontConfigInterfaceDirect);
+ }
+ return singleton;
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/ports/SkFontConfigInterface_android.cpp ('k') | src/ports/SkFontHost_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698