Lines Matching refs:Type

45 // Default traits for Singleton<Type>. Calls operator new and operator delete on
48 template<typename Type>
51 static Type* New() {
54 return new Type();
58 static void Delete(Type* x) {
75 // Alternate traits for use with the Singleton<Type>. Identical to
78 template<typename Type>
79 struct LeakySingletonTraits : public DefaultSingletonTraits<Type> {
87 // Alternate traits for use with the Singleton<Type>. Allocates memory
108 template <typename Type>
112 static Type* New() {
117 return new(buffer_.void_data()) Type();
120 static void Delete(Type* p) {
122 p->Type::~Type();
132 static AlignedMemory<sizeof(Type), ALIGNOF(Type)> buffer_;
137 template <typename Type>
138 AlignedMemory<sizeof(Type), ALIGNOF(Type)>
139 StaticMemorySingletonTraits<Type>::buffer_;
140 template <typename Type>
141 subtle::Atomic32 StaticMemorySingletonTraits<Type>::dead_ = 0;
143 // The Singleton<Type, Traits, DifferentiatingType> class manages a single
144 // instance of Type which will be created on first use and will be destroyed at
185 // This class is itself thread-safe. The underlying Type must of course be
213 template <typename Type,
214 typename Traits = DefaultSingletonTraits<Type>,
215 typename DifferentiatingType = Type>
220 friend Type* Type::GetInstance();
229 static Type* get() {
240 return reinterpret_cast<Type*>(value);
249 Type* newval = Traits::New();
264 return reinterpret_cast<Type*>(value);
273 Traits::Delete(reinterpret_cast<Type*>(subtle::NoBarrier_Load(&instance_)));
279 template <typename Type, typename Traits, typename DifferentiatingType>
280 subtle::AtomicWord Singleton<Type, Traits, DifferentiatingType>::instance_ = 0;