diff options
author | mtklein <mtklein@google.com> | 2014-07-01 13:33:32 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-01 13:33:32 -0700 |
commit | e41f3886ead65550cdbfa99b8f4b7c1831ec3221 (patch) | |
tree | b909d8aca66b89c7a76e64a9fe1c28f72531b485 /src/ports/SkFontConfigInterface_direct.cpp | |
parent | f0aed97aec3fa1c7f6460d8d6327358f3dcbabe6 (diff) |
Revert of Fix race condition in parallel font initialization. (https://codereview.chromium.org/355573006/)
Reason for revert:
canaries still slightly broken
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
>
> Committed: https://skia.googlesource.com/skia/+/60b08a0adfe73f593af62c8d3f55958438360e1b
R=bungeman@google.com, reed@google.com, tomhudson@google.com, tomhudson@chromium.org
TBR=bungeman@google.com, reed@google.com, tomhudson@chromium.org, tomhudson@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2693
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/354133004
Diffstat (limited to 'src/ports/SkFontConfigInterface_direct.cpp')
-rw-r--r-- | src/ports/SkFontConfigInterface_direct.cpp | 10 |
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(); } /////////////////////////////////////////////////////////////////////////////// |