diff options
author | tomhudson <tomhudson@chromium.org> | 2014-06-30 14:14:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-30 14:14:01 -0700 |
commit | df022f5972ae6a2a1d96d15c50eca52cade3abd8 (patch) | |
tree | 044d9f4bce2513318859383a81887b9d0d182ca3 /include/ports/SkFontConfigInterface.h | |
parent | 935a9f6609d88b92044c2f6251bb8ff83cc8e588 (diff) |
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, reed@google.com, tomhudson@google.com
Author: tomhudson@chromium.org
Review URL: https://codereview.chromium.org/355573006
Diffstat (limited to 'include/ports/SkFontConfigInterface.h')
-rw-r--r-- | include/ports/SkFontConfigInterface.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h index 8c12a5628a..f548f37d5d 100644 --- a/include/ports/SkFontConfigInterface.h +++ b/include/ports/SkFontConfigInterface.h @@ -14,6 +14,8 @@ #include "SkTArray.h" #include "SkTypeface.h" +struct SkBaseMutex; + /** * \class SkFontConfigInterface * @@ -95,8 +97,9 @@ public: /** * Return a singleton instance of a direct subclass that calls into * libfontconfig. This does not affect the refcnt of the returned instance. + * The mutex may be used to guarantee the singleton is only constructed once. */ - static SkFontConfigInterface* GetSingletonDirectInterface(); + static SkFontConfigInterface* GetSingletonDirectInterface(SkBaseMutex* mutex); // New APIS, which have default impls for now (which do nothing) |