Lines Matching refs:instance
5 // The LazyInstance<Type, Traits> class manages a single instance of Type,
10 // and Pointer() will always return the same, completely initialized instance.
11 // When the instance is constructed it is registered with AtExitManager. The
21 // will manage a unique instance. It also preallocates the space for Type, as
22 // to avoid allocating the Type instance on the heap. This may help with the
23 // performance of creating the instance, and reducing heap fragmentation. This
65 static Type* New(void* instance) {
66 DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) & (ALIGNOF(Type) - 1), 0u)
70 // Use placement new to initialize our instance in our preallocated space.
72 return new (instance) Type();
74 static void Delete(Type* instance) {
76 instance->~Type();
99 static Type* New(void* instance) {
100 return DefaultLazyInstanceTraits<Type>::New(instance);
102 static void Delete(Type* /* instance */) {
110 // Check if instance needs to be created. If so return true otherwise
111 // if another thread has beat us, wait for instance to be created and
115 // After creating an instance, call this to register the dtor to be called
148 // If any bit in the created mask is true, the instance has already been
153 // We will hopefully have fast access when the instance is already created.
163 // Create the instance in the space provided by |private_buf_|.
169 return instance();
179 return p == instance();
188 // Preallocated space for the Type instance.
192 Type* instance() {
198 // Calling OnExit while the instance is in use by other threads is a mistake.
202 Traits::Delete(me->instance());