Index: include/core/SkInstCnt.h |
diff --git a/include/core/SkInstCnt.h b/include/core/SkInstCnt.h |
index 1839ee1dbdc6720d9c6b0870ea10e52dbe901c7a..a401071d80ad3804d4d5100952d94e4fed6d1638 100644 |
--- a/include/core/SkInstCnt.h |
+++ b/include/core/SkInstCnt.h |
@@ -73,10 +73,16 @@ 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 = (SkMutex*)className::SkInstanceCountHelper::nil; \ |
mtklein
2014/07/25 12:35:33
Just curious, how come static SkMutex* childrenMut
bungeman-skia
2014/07/25 14:40:40
Because that would require an out of line definiti
|
+ SK_DECLARE_STATIC_ONCE(once); \ |
mtklein
2014/07/25 12:35:33
Can't we still use SK_DECLARE_STATIC_MUTEX to make
bungeman-skia
2014/07/25 14:40:40
See above, it's the same situation as the pointer,
|
+ SkOnce(&once, create_mutex, &childrenMutex); \ |
+ return *childrenMutex; \ |
} \ |
+ static const intptr_t nil = (intptr_t)NULL; \ |
\ |
} fInstanceCountHelper; \ |
\ |