68 #ifndef V8_BASE_LAZY_INSTANCE_H_
69 #define V8_BASE_LAZY_INSTANCE_H_
77 #define LAZY_STATIC_INSTANCE_INITIALIZER { V8_ONCE_INIT, { {} } }
78 #define LAZY_DYNAMIC_INSTANCE_INITIALIZER { V8_ONCE_INIT, 0 }
81 #define LAZY_INSTANCE_INITIALIZER LAZY_STATIC_INSTANCE_INITIALIZER
103 return reinterpret_cast<T*
>(storage);
106 template <
typename ConstructTrait>
113 template <
typename T>
121 template <
typename CreateTrait>
123 *storage = CreateTrait::Create();
128 template <
typename T>
132 new(allocated_ptr)
T();
137 template <
typename T>
146 template <
typename Function,
typename Storage>
155 template <
typename Function,
typename Storage>
166 template <
typename T,
typename AllocationTrait,
typename CreateTrait,
167 typename InitOnceTrait,
typename DestroyTrait >
174 AllocationTrait::template InitStorageUsingTrait<CreateTrait>(storage);
183 reinterpret_cast<void*
>(&
storage_));
189 return AllocationTrait::MutableInstance(&
storage_);
194 return *AllocationTrait::MutableInstance(&
storage_);
205 template <
typename T,
211 CreateTrait, InitOnceTrait, DestroyTrait>
type;
215 template <
typename T,
226 template <
typename T,
232 CreateTrait, InitOnceTrait, DestroyTrait>
type;
A JavaScript function object (ECMA-262, 15.3).
void CallOnce(OnceType *once, NoArgFunction init_func)
@ ONCE_STATE_UNINITIALIZED
Debugger support for the V8 JavaScript engine.
static void Construct(T *allocated_ptr)
static T * MutableInstance(StorageType *storage)
static void InitStorageUsingTrait(StorageType *storage)
LazyInstanceImpl< T, DynamicallyAllocatedInstanceTrait< T >, CreateTrait, InitOnceTrait, DestroyTrait > type
AllocationTrait::StorageType StorageType
static void InitInstance(StorageType *storage)
LazyStaticInstance< T, CreateTrait, InitOnceTrait, DestroyTrait >::type type
LazyInstanceImpl< T, StaticallyAllocatedInstanceTrait< T >, CreateTrait, InitOnceTrait, DestroyTrait > type
static void Init(OnceType *once, Function function, Storage storage)
static T * MutableInstance(StorageType *storage)
static void InitStorageUsingTrait(StorageType *storage)
STATIC_ASSERT(V8_ALIGNOF(StorageType) >=V8_ALIGNOF(T))
struct V8_ALIGNAS(T, 16) StorageType
static void Init(OnceType *once, Function function, Storage storage)
#define T(name, string, precedence)