v8  8.4.371 (node 14.15.5)
V8 is Google's open source JavaScript engine
Persistent< T, M > Class Template Reference

#include <v8.h>

Inheritance diagram for Persistent< T, M >:
Collaboration diagram for Persistent< T, M >:

Public Member Functions

V8_INLINE Persistent ()
 
template<class S >
V8_INLINE Persistent (Isolate *isolate, Local< S > that)
 
template<class S , class M2 >
V8_INLINE Persistent (Isolate *isolate, const Persistent< S, M2 > &that)
 
V8_INLINE Persistent (const Persistent &that)
 
template<class S , class M2 >
V8_INLINE Persistent (const Persistent< S, M2 > &that)
 
V8_INLINE Persistentoperator= (const Persistent &that)
 
template<class S , class M2 >
V8_INLINE Persistentoperator= (const Persistent< S, M2 > &that)
 
V8_INLINE ~Persistent ()
 
template<class S >
V8_INLINE Persistent< S > & As () const
 
template<class S , class M2 >
void Copy (const Persistent< S, M2 > &that)
 
- Public Member Functions inherited from PersistentBase< T >
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 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
 
template<class S >
void Reset (Isolate *isolate, const Local< S > &other)
 
template<class S >
void Reset (Isolate *isolate, const PersistentBase< S > &other)
 

Static Public Member Functions

template<class S >
static V8_INLINE Persistent< T > & Cast (const Persistent< S > &that)
 

Friends

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

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.

Note: Persistent class hierarchy is subject to future changes.

Definition at line 657 of file v8.h.

Constructor & Destructor Documentation

◆ Persistent() [1/5]

V8_INLINE Persistent ( )
inline

A Persistent with no storage cell.

Definition at line 662 of file v8.h.

References Local< T >::PersistentBase.

◆ Persistent() [2/5]

V8_INLINE 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.

Definition at line 669 of file v8.h.

References Local< T >::PersistentBase.

◆ Persistent() [3/5]

V8_INLINE 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.

Definition at line 679 of file v8.h.

References Local< T >::PersistentBase.

◆ Persistent() [4/5]

V8_INLINE 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.

Definition at line 689 of file v8.h.

References Local< T >::PersistentBase.

◆ Persistent() [5/5]

V8_INLINE Persistent ( const Persistent< S, M2 > &  that)
inline

Definition at line 693 of file v8.h.

References Local< T >::PersistentBase.

◆ ~Persistent()

V8_INLINE ~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.

Definition at line 710 of file v8.h.

Member Function Documentation

◆ As()

V8_INLINE Persistent<S>& As ( ) const
inline

Definition at line 727 of file v8.h.

References Local< T >::Persistent.

◆ Cast()

static V8_INLINE Persistent<T>& Cast ( const Persistent< S > &  that)
inlinestatic

Definition at line 716 of file v8.h.

References Local< T >::Persistent.

◆ Copy()

void Copy ( const Persistent< S, M2 > &  that)

Definition at line 10754 of file v8.h.

◆ operator=() [1/2]

V8_INLINE Persistent& operator= ( const Persistent< T, M > &  that)
inline

Definition at line 696 of file v8.h.

◆ operator=() [2/2]

V8_INLINE Persistent& operator= ( const Persistent< S, M2 > &  that)
inline

Definition at line 701 of file v8.h.

Friends And Related Function Documentation

◆ Isolate

friend class Isolate
friend

Definition at line 732 of file v8.h.

◆ Local

friend class Local
friend

Definition at line 734 of file v8.h.

◆ Persistent

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.

Definition at line 735 of file v8.h.

◆ ReturnValue

friend class ReturnValue
friend

Definition at line 736 of file v8.h.

◆ Utils

friend class Utils
friend

Definition at line 733 of file v8.h.


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