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 | |
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')
-rw-r--r-- | src/ports/SkFontConfigInterface_android.cpp | 3 | ||||
-rw-r--r-- | src/ports/SkFontConfigInterface_direct.cpp | 10 | ||||
-rw-r--r-- | src/ports/SkFontHost_fontconfig.cpp | 2 |
3 files changed, 5 insertions, 10 deletions
diff --git a/src/ports/SkFontConfigInterface_android.cpp b/src/ports/SkFontConfigInterface_android.cpp index 1f901b9fa9..20e6c5eb84 100644 --- a/src/ports/SkFontConfigInterface_android.cpp +++ b/src/ports/SkFontConfigInterface_android.cpp @@ -155,8 +155,7 @@ static SkFontConfigInterfaceAndroid* getSingletonInterface() { return gFontConfigInterface; } -SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBaseMutex*) { - // Doesn't need passed-in mutex because getSingletonInterface() uses one +SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface() { return getSingletonInterface(); } 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(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp index 8abf5cf7f0..07bfbd044c 100644 --- a/src/ports/SkFontHost_fontconfig.cpp +++ b/src/ports/SkFontHost_fontconfig.cpp @@ -50,7 +50,7 @@ static SkFontConfigInterface* RefFCI() { if (fci) { return fci; } - fci = SkFontConfigInterface::GetSingletonDirectInterface(&gFontConfigInterfaceMutex); + fci = SkFontConfigInterface::GetSingletonDirectInterface(); SkFontConfigInterface::SetGlobal(fci); } } |