Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: src/core/SkMessageBus.h

Issue 1948313002: Revert of SkOncePtr -> SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkImageFilterCache.cpp ('k') | src/core/SkMiniRecorder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 -----------------------
« no previous file with comments | « src/core/SkImageFilterCache.cpp ('k') | src/core/SkMiniRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698