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

Unified Diff: src/core/SkMessageBus.h

Issue 1322933005: Port uses of SkLazyPtr to SkOncePtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: name Created 5 years, 3 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/SkImageFilter.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 6f032a1fe2181232b2ee2cbfef3443ce7d86d45d..a2802f06d40141f34951c0b16b253d04cb54b094 100644
--- a/src/core/SkMessageBus.h
+++ b/src/core/SkMessageBus.h
@@ -8,8 +8,8 @@
#ifndef SkMessageBus_DEFINED
#define SkMessageBus_DEFINED
-#include "SkLazyPtr.h"
#include "SkMutex.h"
+#include "SkOncePtr.h"
#include "SkTArray.h"
#include "SkTDArray.h"
#include "SkTypes.h"
@@ -40,20 +40,17 @@ private:
SkMessageBus();
static SkMessageBus* Get();
- // Allow SkLazyPtr to call SkMessageBus::SkMessageBus().
- template <typename T> friend T* Private::sk_new();
-
SkTDArray<Inbox*> fInboxes;
SkMutex fInboxesMutex;
};
// 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_LAZY_PTR(SkMessageBus<Message>, bus); \
- template <> \
- SkMessageBus<Message>* SkMessageBus<Message>::Get() { \
- return bus.get(); \
+#define DECLARE_SKMESSAGEBUS_MESSAGE(Message) \
+ SK_DECLARE_STATIC_ONCE_PTR(SkMessageBus<Message>, bus); \
+ template <> \
+ SkMessageBus<Message>* SkMessageBus<Message>::Get() { \
+ return bus.get([]{ return new SkMessageBus<Message>(); }); \
}
// ----------------------- Implementation of SkMessageBus::Inbox -----------------------
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/core/SkMiniRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698