v8  7.4.288(node12.0.0)
V8 is Google's open source JavaScript engine
TracedGlobal< T > Class Template Reference

#include <v8.h>

Public Member Functions

 TracedGlobal ()=default
 
 ~TracedGlobal ()
 
template<class S >
 TracedGlobal (Isolate *isolate, Local< S > that)
 
V8_INLINE TracedGlobal (TracedGlobal &&other)
 
template<class S >
V8_INLINE TracedGlobaloperator= (TracedGlobal< S > &&rhs)
 
 TracedGlobal (const TracedGlobal &)=delete
 
void operator= (const TracedGlobal &)=delete
 
bool IsEmpty () const
 
V8_INLINE void Reset ()
 
template<class S >
V8_INLINE void Reset (Isolate *isolate, const Local< S > &other)
 
Local< T > Get (Isolate *isolate) const
 
template<class S >
V8_INLINE TracedGlobal< S > & As () const
 
template<class S >
V8_INLINE bool operator== (const TracedGlobal< S > &that) const
 
template<class S >
V8_INLINE bool operator== (const Local< S > &that) const
 
template<class S >
V8_INLINE bool operator!= (const TracedGlobal< S > &that) const
 
template<class S >
V8_INLINE bool operator!= (const Local< S > &that) const
 
V8_INLINE void SetWrapperClassId (uint16_t class_id)
 
V8_INLINE uint16_t WrapperClassId () const
 
V8_INLINE void SetFinalizationCallback (void *parameter, WeakCallbackInfo< void >::Callback callback)
 
template<class S >
void Reset (Isolate *isolate, const Local< S > &other)
 
template<class S >
TracedGlobal< T > & operator= (TracedGlobal< S > &&rhs)
 

Friends

class EmbedderHeapTracer
 
template<typename F >
class Local
 
class Object
 
template<typename F >
class ReturnValue
 

Detailed Description

template<typename T>
class v8::TracedGlobal< T >

A traced handle with move semantics, similar to std::unique_ptr. The handle is to be used together with |v8::EmbedderHeapTracer| and specifies edges from the embedder into V8's heap.

The exact semantics are:

  • Tracing garbage collections use |v8::EmbedderHeapTracer|.
  • Non-tracing garbage collections refer to |v8::EmbedderHeapTracer::IsRootForNonTracingGC()| whether the handle should be treated as root or not.

Definition at line 97 of file v8.h.

Constructor & Destructor Documentation

◆ TracedGlobal() [1/4]

TracedGlobal ( )
default

An empty TracedGlobal without storage cell.

◆ ~TracedGlobal()

~TracedGlobal ( )
inline

Definition at line 846 of file v8.h.

◆ TracedGlobal() [2/4]

TracedGlobal ( Isolate isolate,
Local< S >  that 
)
inline

Construct a TracedGlobal from a Local.

When the Local is non-empty, a new storage cell is created pointing to the same object.

Definition at line 855 of file v8.h.

References TYPE_CHECK.

◆ TracedGlobal() [3/4]

TracedGlobal ( TracedGlobal< T > &&  other)

Move constructor initializing TracedGlobal from an existing one.

Definition at line 9957 of file v8.h.

◆ TracedGlobal() [4/4]

TracedGlobal ( const TracedGlobal< T > &  )
delete

TracedGlobal only supports move semantics and forbids copying.

Member Function Documentation

◆ As()

V8_INLINE TracedGlobal<S>& As ( ) const
inline

Definition at line 902 of file v8.h.

◆ Get()

Local<T> Get ( Isolate isolate) const
inline

Construct a Local<T> from this handle.

Definition at line 899 of file v8.h.

References Local< T >::New().

◆ IsEmpty()

bool IsEmpty ( ) const
inline

Returns true if this TracedGlobal is empty, i.e., has not been assigned an object.

Definition at line 881 of file v8.h.

Referenced by ReturnValue< T >::Set().

◆ operator!=() [1/2]

V8_INLINE bool operator!= ( const TracedGlobal< S > &  that) const
inline

Definition at line 926 of file v8.h.

◆ operator!=() [2/2]

V8_INLINE bool operator!= ( const Local< S > &  that) const
inline

Definition at line 931 of file v8.h.

◆ operator=() [1/3]

V8_INLINE TracedGlobal& operator= ( TracedGlobal< S > &&  rhs)

Move assignment operator initializing TracedGlobal from an existing one.

◆ operator=() [2/3]

void operator= ( const TracedGlobal< T > &  )
delete

◆ operator=() [3/3]

TracedGlobal<T>& operator= ( TracedGlobal< S > &&  rhs)

Definition at line 9968 of file v8.h.

References TYPE_CHECK.

◆ operator==() [1/2]

V8_INLINE bool operator== ( const TracedGlobal< S > &  that) const
inline

Definition at line 908 of file v8.h.

◆ operator==() [2/2]

V8_INLINE bool operator== ( const Local< S > &  that) const
inline

Definition at line 917 of file v8.h.

◆ Reset() [1/3]

void Reset ( )

If non-empty, destroy the underlying storage cell. |IsEmpty| will return true after this call.

Definition at line 9941 of file v8.h.

◆ Reset() [2/3]

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

◆ Reset() [3/3]

void Reset ( Isolate isolate,
const Local< S > &  other 
)

Definition at line 9949 of file v8.h.

References TYPE_CHECK.

◆ SetFinalizationCallback()

void SetFinalizationCallback ( void *  parameter,
WeakCallbackInfo< void >::Callback  callback 
)

Adds a finalization callback to the handle. The type of this callback is similar to WeakCallbackType::kInternalFields, i.e., it will pass the parameter and the first two internal fields of the object.

The callback is then supposed to reset the handle in the callback. No further V8 API may be called in this callback. In case additional work involving V8 needs to be done, a second callback can be scheduled using WeakCallbackInfo<void>::SetSecondPassCallback.

Definition at line 10002 of file v8.h.

◆ SetWrapperClassId()

void SetWrapperClassId ( uint16_t  class_id)

Assigns a wrapper class ID to the handle.

Definition at line 9984 of file v8.h.

◆ WrapperClassId()

uint16_t WrapperClassId ( ) const

Returns the class ID previously assigned to this handle or 0 if no class ID was previously assigned.

Definition at line 9993 of file v8.h.

Friends And Related Function Documentation

◆ EmbedderHeapTracer

friend class EmbedderHeapTracer
friend

Definition at line 966 of file v8.h.

◆ Local

friend class Local
friend

Definition at line 968 of file v8.h.

◆ Object

friend class Object
friend

Definition at line 969 of file v8.h.

◆ ReturnValue

friend class ReturnValue
friend

Definition at line 971 of file v8.h.


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