v8  10.1.124 (node 18.2.0)
V8 is Google's open source JavaScript engine
TracedGlobal< T > Class Template Reference

#include <v8-traced-handle.h>

Inheritance diagram for TracedGlobal< T >:
Collaboration diagram for TracedGlobal< T >:

Public Member Functions

 ~TracedGlobal ()
 
 TracedGlobal ()
 
template<class S >
 TracedGlobal (Isolate *isolate, Local< S > that)
 
V8_INLINE TracedGlobal (TracedGlobal &&other) noexcept
 
template<typename S >
V8_INLINE TracedGlobal (TracedGlobal< S > &&other) noexcept
 
V8_INLINE TracedGlobal (const TracedGlobal &other)
 
template<typename S >
V8_INLINE TracedGlobal (const TracedGlobal< S > &other)
 
V8_INLINE TracedGlobaloperator= (TracedGlobal &&rhs) noexcept
 
template<class S >
V8_INLINE TracedGlobaloperator= (TracedGlobal< S > &&rhs) noexcept
 
V8_INLINE TracedGlobaloperator= (const TracedGlobal &rhs)
 
template<class S >
V8_INLINE TracedGlobaloperator= (const TracedGlobal< S > &rhs)
 
template<class S >
V8_INLINE void Reset (Isolate *isolate, const Local< S > &other)
 
template<class S >
V8_INLINE TracedGlobal< S > & As () 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) noexcept
 
template<class S >
TracedGlobal< T > & operator= (const TracedGlobal< S > &rhs)
 
- Public Member Functions inherited from BasicTracedReference< T >
Local< T > Get (Isolate *isolate) const
 
template<class S >
V8_INLINE BasicTracedReference< S > & As () const
 
T * operator-> () const
 
T * operator* () const
 
- Public Member Functions inherited from TracedReferenceBase
bool IsEmpty () const
 
V8_INLINE void Reset ()
 
V8_INLINE v8::Local< v8::ValueGet (v8::Isolate *isolate) const
 
bool IsEmptyThreadSafe () const
 
V8_INLINE void SetWrapperClassId (uint16_t class_id)
 
V8_INLINE uint16_t WrapperClassId () const
 

Additional Inherited Members

- Protected Member Functions inherited from TracedReferenceBase
void SetSlotThreadSafe (void *new_val)
 
const void * GetSlotThreadSafe () const
 
V8_EXPORT void CheckValue () const
 
- Protected Attributes inherited from TracedReferenceBase
internal::Addressval_ = nullptr
 

Detailed Description

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

A traced handle with destructor that clears the handle. For more details see BasicTracedReference.

This type is being deprecated and embedders are encouraged to use v8::TracedReference in combination with v8::CppHeap. If this is not possible, the following provides feature parity:

template <typename T>
struct TracedGlobalPolyfill {
v8::TracedReference<T> traced_reference;
v8::Global<T> weak_reference_for_callback;
};

In this example, weak_reference_for_callback can be used to emulate SetFinalizationCallback().

Definition at line 217 of file v8-traced-handle.h.

Constructor & Destructor Documentation

◆ ~TracedGlobal()

~TracedGlobal ( )
inline

Destructor resetting the handle.Is

Definition at line 224 of file v8-traced-handle.h.

◆ TracedGlobal() [1/6]

TracedGlobal ( )
inline

An empty TracedGlobal without storage cell.

Definition at line 230 of file v8-traced-handle.h.

References Local< T >::BasicTracedReference.

◆ TracedGlobal() [2/6]

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 240 of file v8-traced-handle.h.

References Local< T >::BasicTracedReference, v8::internal::kInitializingStore, and v8::internal::kWithDestructor.

◆ TracedGlobal() [3/6]

V8_INLINE TracedGlobal ( TracedGlobal< T > &&  other)
inlinenoexcept

Move constructor initializing TracedGlobal from an existing one.

Definition at line 251 of file v8-traced-handle.h.

◆ TracedGlobal() [4/6]

V8_INLINE TracedGlobal ( TracedGlobal< S > &&  other)
inlinenoexcept

Move constructor initializing TracedGlobal from an existing one.

Definition at line 260 of file v8-traced-handle.h.

◆ TracedGlobal() [5/6]

V8_INLINE TracedGlobal ( const TracedGlobal< T > &  other)
inline

Copy constructor initializing TracedGlobal from an existing one.

Definition at line 268 of file v8-traced-handle.h.

◆ TracedGlobal() [6/6]

V8_INLINE TracedGlobal ( const TracedGlobal< S > &  other)
inline

Copy constructor initializing TracedGlobal from an existing one.

Definition at line 277 of file v8-traced-handle.h.

Member Function Documentation

◆ As()

V8_INLINE TracedGlobal<S>& As ( ) const
inline

Definition at line 318 of file v8-traced-handle.h.

References Local< T >::TracedGlobal.

◆ operator=() [1/6]

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

Copy assignment operator initializing TracedGlobal from an existing one.

Note: Prohibited when |other| has a finalization callback set through |SetFinalizationCallback|.

Definition at line 616 of file v8-traced-handle.h.

References v8::internal::CopyTracedGlobalReference().

◆ operator=() [2/6]

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

Copy assignment operator initializing TracedGlobal from an existing one.

Note: Prohibited when |other| has a finalization callback set through |SetFinalizationCallback|.

◆ operator=() [3/6]

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

Definition at line 599 of file v8-traced-handle.h.

◆ operator=() [4/6]

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

Move assignment operator initializing TracedGlobal from an existing one.

Definition at line 606 of file v8-traced-handle.h.

References v8::internal::MoveTracedGlobalReference().

◆ operator=() [5/6]

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

Move assignment operator initializing TracedGlobal from an existing one.

◆ operator=() [6/6]

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

Definition at line 591 of file v8-traced-handle.h.

◆ Reset() [1/2]

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() [2/2]

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

◆ 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 629 of file v8-traced-handle.h.

References v8::internal::SetFinalizationCallbackTraced().


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