Lines Matching defs:instance
10 // static base::NoDestructor<Factory> instance;
11 // return *instance;
15 // The LazyInstance<Type, Traits> class manages a single instance of Type,
20 // and Pointer() will always return the same, completely initialized instance.
21 // When the instance is constructed it is registered with AtExitManager. The
31 // will manage a unique instance. It also preallocates the space for Type, as
32 // to avoid allocating the Type instance on the heap. This may help with the
33 // performance of creating the instance, and reducing heap fragmentation. This
64 static Type* New(void* instance) {
65 DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) & (alignof(Type) - 1), 0u);
66 // Use placement new to initialize our instance in our preallocated space.
68 return new (instance) Type();
71 static void CallDestructor(Type* instance) {
73 instance->~Type();
91 static Type* New(void* instance) {
92 return LazyInstanceTraitsBase<Type>::New(instance);
95 static void Delete(Type* instance) {
96 LazyInstanceTraitsBase<Type>::CallDestructor(instance);
115 static Type* New(void* instance) {
117 return LazyInstanceTraitsBase<Type>::New(instance);
119 static void Delete(Type* instance) {
162 // Returns true if the lazy instance has been created. Unlike Get() and
185 // Preallocated space for the Type instance.
193 Type* instance() {
199 // Calling OnExit while the instance is in use by other threads is a mistake.
203 Traits::Delete(me->instance());