Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
v8::Persistent< T, M > Class Template Reference

#include <v8-persistent-handle.h>

Inheritance diagram for v8::Persistent< T, M >:
[legend]
Collaboration diagram for v8::Persistent< T, M >:
[legend]

Public Member Functions

 Persistent ()=default
 
template<class S >
 Persistent (Isolate *isolate, Local< S > that)
 
template<class S , class M2 >
 Persistent (Isolate *isolate, const Persistent< S, M2 > &that)
 
 Persistent (const Persistent &that)
 
template<class S , class M2 >
 Persistent (const Persistent< S, M2 > &that)
 
Persistentoperator= (const Persistent &that)
 
template<class S , class M2 >
Persistentoperator= (const Persistent< S, M2 > &that)
 
 ~Persistent ()
 
template<class S , class M2 >
Persistent< S, M2 > & As () const
 
- Public Member Functions inherited from v8::PersistentBase< T >
void Reset ()
 
template<class S >
void Reset (Isolate *isolate, const Local< S > &other)
 
template<class S >
void Reset (Isolate *isolate, const PersistentBase< S > &other)
 
Local< T > Get (Isolate *isolate) const
 
template<class S >
bool operator== (const PersistentBase< S > &that) const
 
template<class S >
bool operator== (const Local< S > &that) const
 
template<class S >
bool operator!= (const PersistentBase< S > &that) const
 
template<class S >
bool operator!= (const Local< S > &that) const
 
template<typename P >
void SetWeak (P *parameter, typename WeakCallbackInfo< P >::Callback callback, WeakCallbackType type)
 
void SetWeak ()
 
template<typename P >
P * ClearWeak ()
 
void ClearWeak ()
 
void AnnotateStrongRetainer (const char *label)
 
bool IsWeak () const
 
void SetWrapperClassId (uint16_t class_id)
 
uint16_t WrapperClassId () const
 
 PersistentBase (const PersistentBase &other)=delete
 
void operator= (const PersistentBase &)=delete
 
- Public Member Functions inherited from v8::api_internal::IndirectHandleBase
bool IsEmpty () const
 
void Clear ()
 

Static Public Member Functions

template<class S , class M2 >
static Persistent< T, M > & Cast (const Persistent< S, M2 > &that)
 

Friends

class Isolate
 
class Utils
 
template<class F >
class Local
 
template<class F1 , class F2 >
class Persistent
 
template<class F >
class ReturnValue
 

Additional Inherited Members

- Protected Member Functions inherited from v8::api_internal::IndirectHandleBase
 IndirectHandleBase ()=default
 
 IndirectHandleBase (const IndirectHandleBase &other)=default
 
IndirectHandleBaseoperator= (const IndirectHandleBase &that)=default
 
 IndirectHandleBase (internal::Address *location)
 
internal::Address ptr () const
 
internal::Address *const & slot () const
 
internal::Address *& slot ()
 
template<typename T , bool check_null = false>
T * value () const
 
internal::ValueHelper::InternalRepresentationType repr () const
 

Detailed Description

template<class T, class M>
class v8::Persistent< T, M >

A PersistentBase which allows copy and assignment.

Copy, assignment and destructor behavior is controlled by the traits class M.

CAVEAT: Persistent objects do not have proper destruction behavior by default and as such will leak the object without explicit clear. Consider using v8::Global instead which has proper destruction and move semantics.

Constructor & Destructor Documentation

◆ Persistent() [1/5]

template<class T , class M >
v8::Persistent< T, M >::Persistent ( )
inlinedefault

A Persistent with no storage cell.

◆ Persistent() [2/5]

template<class T , class M >
template<class S >
v8::Persistent< T, M >::Persistent ( Isolate isolate,
Local< S >  that 
)
inline

Construct a Persistent from a Local. When the Local is non-empty, a new storage cell is created pointing to the same object, and no flags are set.

◆ Persistent() [3/5]

template<class T , class M >
template<class S , class M2 >
v8::Persistent< T, M >::Persistent ( Isolate isolate,
const Persistent< S, M2 > &  that 
)
inline

Construct a Persistent from a Persistent. When the Persistent is non-empty, a new storage cell is created pointing to the same object, and no flags are set.

◆ Persistent() [4/5]

template<class T , class M >
v8::Persistent< T, M >::Persistent ( const Persistent< T, M > &  that)
inline

The copy constructors and assignment operator create a Persistent exactly as the Persistent constructor, but the Copy function from the traits class is called, allowing the setting of flags based on the copied Persistent.

◆ Persistent() [5/5]

template<class T , class M >
template<class S , class M2 >
v8::Persistent< T, M >::Persistent ( const Persistent< S, M2 > &  that)
inline

◆ ~Persistent()

template<class T , class M >
v8::Persistent< T, M >::~Persistent ( )
inline

The destructor will dispose the Persistent based on the kResetInDestructor flags in the traits class. Since not calling dispose can result in a memory leak, it is recommended to always set this flag.

Here is the call graph for this function:

Member Function Documentation

◆ As()

template<class T , class M >
template<class S , class M2 >
Persistent< S, M2 > & v8::Persistent< T, M >::As ( ) const
inline
Here is the call graph for this function:

◆ Cast()

template<class T , class M >
template<class S , class M2 >
static Persistent< T, M > & v8::Persistent< T, M >::Cast ( const Persistent< S, M2 > &  that)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

template<class T , class M >
Persistent & v8::Persistent< T, M >::operator= ( const Persistent< T, M > &  that)
inline

◆ operator=() [2/2]

template<class T , class M >
template<class S , class M2 >
Persistent & v8::Persistent< T, M >::operator= ( const Persistent< S, M2 > &  that)
inline

Friends And Related Function Documentation

◆ Isolate

template<class T , class M >
friend class Isolate
friend

◆ Local

template<class T , class M >
template<class F >
friend class Local
friend

◆ Persistent

template<class T , class M >
template<class F1 , class F2 >
friend class Persistent
friend

Persistent is a way to create a strong pointer from an off-heap object to another on-heap object. As long as the Persistent handle is alive the GC will keep the object pointed to alive. The Persistent handle is always a GC root from the point of view of the GC. Persistent must be constructed and destructed in the same thread.

◆ ReturnValue

template<class T , class M >
template<class F >
friend class ReturnValue
friend

◆ Utils

template<class T , class M >
friend class Utils
friend

The documentation for this class was generated from the following files: