Home | History | Annotate | Download | only in base

Lines Matching full: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
63 static Type* New(void* instance) {
64 DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) & (ALIGNOF(Type) - 1), 0u)
68 // Use placement new to initialize our instance in our preallocated space.
70 return new (instance) Type();
72 static void Delete(Type* instance) {
74 instance->~Type();
97 static Type* New(void* instance) {
99 return DefaultLazyInstanceTraits<Type>::New(instance);
101 static void Delete(Type* instance) {
109 // Check if instance needs to be created. If so return true otherwise
110 // if another thread has beat us, wait for instance to be created and
114 // After creating an instance, call this to register the dtor to be called
147 // If any bit in the created mask is true, the instance has already been
152 // We will hopefully have fast access when the instance is already created.
162 // Create the instance in the space provided by |private_buf_|.
168 return instance();
178 return p == instance();
187 // Preallocated space for the Type instance.
191 Type* instance() {
197 // Calling OnExit while the instance is in use by other threads is a mistake.
201 Traits::Delete(me->instance());