Chromium Code Reviews| Index: include/core/SkInstCnt.h |
| diff --git a/include/core/SkInstCnt.h b/include/core/SkInstCnt.h |
| index 1839ee1dbdc6720d9c6b0870ea10e52dbe901c7a..e4b43d130b94b6a2ab9303c3c6c1170f7c3722ff 100644 |
| --- a/include/core/SkInstCnt.h |
| +++ b/include/core/SkInstCnt.h |
| @@ -73,9 +73,14 @@ extern bool gPrintInstCount; |
| return gChildren; \ |
| } \ |
| \ |
| + static void create_mutex(SkMutex** mutex) { \ |
| + *mutex = SkNEW(SkMutex); \ |
| + } \ |
| static SkBaseMutex& GetChildrenMutex() { \ |
| - SK_DECLARE_STATIC_MUTEX(childrenMutex); \ |
| - return childrenMutex; \ |
| + static SkMutex* childrenMutex; \ |
| + SK_DECLARE_STATIC_ONCE(once); \ |
| + SkOnce(&once, className::SkInstanceCountHelper::create_mutex, &childrenMutex);\ |
| + return *childrenMutex; \ |
|
bungeman-skia
2014/07/25 15:44:07
Making this body look like
SK_DECLARE_STATIC_LAZY
|
| } \ |
| \ |
| } fInstanceCountHelper; \ |