V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
|
#include <v8.h>
Public Member Functions | |
V8_INLINE void | Reset () |
template<class S > | |
V8_INLINE void | Reset (Isolate *isolate, const Local< S > &other) |
template<class S > | |
V8_INLINE void | Reset (Isolate *isolate, const PersistentBase< S > &other) |
V8_INLINE bool | IsEmpty () const |
V8_INLINE void | Empty () |
V8_INLINE Local< T > | Get (Isolate *isolate) const |
template<class S > | |
V8_INLINE bool | operator== (const PersistentBase< S > &that) const |
template<class S > | |
V8_INLINE bool | operator== (const Local< S > &that) const |
template<class S > | |
V8_INLINE bool | operator!= (const PersistentBase< S > &that) const |
template<class S > | |
V8_INLINE bool | operator!= (const Local< S > &that) const |
template<typename P > | |
V8_INLINE void | SetWeak (P *parameter, typename WeakCallbackInfo< P >::Callback callback, WeakCallbackType type) |
V8_INLINE void | SetWeak () |
template<typename P > | |
V8_INLINE P * | ClearWeak () |
V8_INLINE void | ClearWeak () |
V8_INLINE void | AnnotateStrongRetainer (const char *label) |
V8_INLINE void | RegisterExternalReference (Isolate *isolate) const |
V8_DEPRECATE_SOON ("Objects are always considered independent. " "Use MarkActive to avoid collecting otherwise dead weak handles.", V8_INLINE void MarkIndependent()) | |
V8_INLINE void | MarkActive () |
V8_DEPRECATE_SOON ("See MarkIndependent.", V8_INLINE bool IsIndependent() const) | |
V8_INLINE bool | IsNearDeath () const |
V8_INLINE bool | IsWeak () const |
V8_INLINE void | SetWrapperClassId (uint16_t class_id) |
V8_INLINE uint16_t | WrapperClassId () const |
PersistentBase (const PersistentBase &other)=delete | |
void | operator= (const PersistentBase &)=delete |
An object reference that is independent of any handle scope. Where a Local handle only lives as long as the HandleScope in which it was allocated, a PersistentBase handle remains valid until it is explicitly disposed using Reset().
A persistent handle contains a reference to a storage cell within the V8 engine which holds an object value and which is updated by the garbage collector whenever the object is moved. A new storage cell can be created using the constructor or PersistentBase::Reset and existing handles can be disposed using PersistentBase::Reset.
void v8::PersistentBase< T >::AnnotateStrongRetainer | ( | const char * | label | ) |
Annotates the strong handle with the given label, which is then used by the heap snapshot generator as a name of the edge from the root to the handle. The function does not take ownership of the label and assumes that the label is valid as long as the handle is valid.
bool v8::PersistentBase< T >::IsNearDeath | ( | ) | const |
bool v8::PersistentBase< T >::IsWeak | ( | ) | const |
void v8::PersistentBase< T >::MarkActive | ( | ) |
void v8::PersistentBase< T >::RegisterExternalReference | ( | Isolate * | isolate | ) | const |
void v8::PersistentBase< T >::Reset | ( | ) |
V8_INLINE void v8::PersistentBase< T >::Reset | ( | Isolate * | isolate, |
const Local< S > & | other | ||
) |
If non-empty, destroy the underlying storage cell and create a new one with the contents of other if other is non empty
V8_INLINE void v8::PersistentBase< T >::Reset | ( | Isolate * | isolate, |
const PersistentBase< S > & | other | ||
) |
If non-empty, destroy the underlying storage cell and create a new one with the contents of other if other is non empty
V8_INLINE void v8::PersistentBase< T >::SetWeak | ( | P * | parameter, |
typename WeakCallbackInfo< P >::Callback | callback, | ||
WeakCallbackType | type | ||
) |
Install a finalization callback on this object. NOTE: There is no guarantee as to when or even if the callback is invoked. The invocation is performed solely on a best effort basis. As always, GC-based finalization should not be relied upon for any critical form of resource management!
void v8::PersistentBase< T >::SetWeak | ( | ) |
Turns this handle into a weak phantom handle without finalization callback. The handle will be reset automatically when the garbage collector detects that the object is no longer reachable. A related function Isolate::NumberOfPhantomHandleResetsSinceLastCall returns how many phantom handles were reset by the garbage collector.
void v8::PersistentBase< T >::SetWrapperClassId | ( | uint16_t | class_id | ) |
Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface description in v8-profiler.h for details.
v8::PersistentBase< T >::V8_DEPRECATE_SOON | ( | "Objects are always considered independent. " "Use MarkActive to avoid collecting otherwise dead weak handles." | , |
V8_INLINE void | MarkIndependent() | ||
) |
Marks the reference to this object independent. Garbage collector is free to ignore any object groups containing this object. Weak callback for an independent handle should not assume that it will be preceded by a global GC prologue callback or followed by a global GC epilogue callback.
uint16_t v8::PersistentBase< T >::WrapperClassId | ( | ) | const |