Index: src/core/SkMessageBus.h |
diff --git a/src/core/SkMessageBus.h b/src/core/SkMessageBus.h |
index 79f5c026dcde2ee82e9ffc5f74007e54f55dfe14..a2802f06d40141f34951c0b16b253d04cb54b094 100644 |
--- a/src/core/SkMessageBus.h |
+++ b/src/core/SkMessageBus.h |
@@ -9,7 +9,7 @@ |
#define SkMessageBus_DEFINED |
#include "SkMutex.h" |
-#include "SkOnce.h" |
+#include "SkOncePtr.h" |
#include "SkTArray.h" |
#include "SkTDArray.h" |
#include "SkTypes.h" |
@@ -47,12 +47,10 @@ |
// This must go in a single .cpp file, not some .h, or we risk creating more than one global |
// SkMessageBus per type when using shared libraries. NOTE: at most one per file will compile. |
#define DECLARE_SKMESSAGEBUS_MESSAGE(Message) \ |
+ SK_DECLARE_STATIC_ONCE_PTR(SkMessageBus<Message>, bus); \ |
template <> \ |
SkMessageBus<Message>* SkMessageBus<Message>::Get() { \ |
- static SkOnce once; \ |
- static SkMessageBus<Message>* bus; \ |
- once([] { bus = new SkMessageBus<Message>(); }); \ |
- return bus; \ |
+ return bus.get([]{ return new SkMessageBus<Message>(); }); \ |
} |
// ----------------------- Implementation of SkMessageBus::Inbox ----------------------- |