aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkFontConfigInterface_direct.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2014-06-30 16:48:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-30 16:48:24 -0700
commit50a7b0e6212cfad02e356f9d0bd82b6eadf31f96 (patch)
tree33a0b411d648b6cbfe183540bec73bbd09df1c37 /src/ports/SkFontConfigInterface_direct.cpp
parentdf022f5972ae6a2a1d96d15c50eca52cade3abd8 (diff)
Revert of Fix race condition in parallel font initialization. (https://codereview.chromium.org/355573006/)
Reason for revert: breaks chrome builds Original issue's description: > Fix race condition in parallel font initialization. > > Uses a mutex to guard construction of the singleton, which initialies > the non-threadsafe libfontconfig. Without this change, the parallel > path ops test runner crashes 6/10 and hangs 2/10 on startup; with this > change, 0/10 problems. > > BUG=skia:2693 > R=mtklein@google.com,bungeman@google.com > > Committed: https://skia.googlesource.com/skia/+/df022f5972ae6a2a1d96d15c50eca52cade3abd8 R=mtklein@google.com, bungeman@google.com, reed@google.com, tomhudson@google.com, tomhudson@chromium.org TBR=bungeman@google.com, mtklein@google.com, reed@google.com, tomhudson@chromium.org, tomhudson@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2693 Author: reed@chromium.org Review URL: https://codereview.chromium.org/365503003
Diffstat (limited to 'src/ports/SkFontConfigInterface_direct.cpp')
-rw-r--r--src/ports/SkFontConfigInterface_direct.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp
index c0cfd8fdcf..dc9afbae1f 100644
--- a/src/ports/SkFontConfigInterface_direct.cpp
+++ b/src/ports/SkFontConfigInterface_direct.cpp
@@ -124,13 +124,9 @@ private:
SkMutex mutex_;
};
-SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBaseMutex* mutex) {
- SkAutoMutexAcquire ac(mutex);
- static SkFontConfigInterfaceDirect* singleton = NULL;
- if (singleton == NULL) {
- singleton = SkNEW(SkFontConfigInterfaceDirect);
- }
- return singleton;
+SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface() {
+ SK_DECLARE_STATIC_LAZY_PTR(SkFontConfigInterfaceDirect, direct);
+ return direct.get();
}
///////////////////////////////////////////////////////////////////////////////