Home | History | Annotate | Download | only in base

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
62 static Type* New(void* instance) {
63 DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) & (ALIGNOF(Type) - 1), 0u)
67 // Use placement new to initialize our instance in our preallocated space.
69 return new (instance) Type();
71 static void Delete(Type* instance) {
73 instance->~Type();
94 static Type* New(void* instance) {
96 return DefaultLazyInstanceTraits<Type>::New(instance);
98 static void Delete(Type* instance) {
106 // Check if instance needs to be created. If so return true otherwise
107 // if another thread has beat us, wait for instance to be created and
111 // After creating an instance, call this to register the dtor to be called
144 // If any bit in the created mask is true, the instance has already been
149 // We will hopefully have fast access when the instance is already created.
159 // Create the instance in the space provided by |private_buf_|.
169 // and CompleteLazyInstance(...) happens before "return instance()" below.
172 return instance();
182 return p == instance();
191 // Preallocated space for the Type instance.
195 Type* instance() {
201 // Calling OnExit while the instance is in use by other threads is a mistake.
205 Traits::Delete(me->instance());