v8
10.1.124 (node 18.2.0)
V8 is Google's open source JavaScript engine
|
#include <v8-persistent-handle.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 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) |
Friends | |
class | Isolate |
class | Utils |
template<class F > | |
class | Local |
template<class F1 , class F2 > | |
class | Persistent |
template<class F > | |
class | Global |
template<class F > | |
class | PersistentBase |
template<class F > | |
class | ReturnValue |
template<class F1 , class F2 , class F3 > | |
class | PersistentValueMapBase |
template<class F1 , class F2 > | |
class | PersistentValueVector |
class | Object |
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.
Definition at line 94 of file v8-persistent-handle.h.
|
delete |
void 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.
Definition at line 538 of file v8-persistent-handle.h.
References v8::api_internal::AnnotateStrongRetainer().
V8_INLINE P* ClearWeak | ( | ) |
|
inline |
Definition at line 181 of file v8-persistent-handle.h.
|
inline |
Definition at line 117 of file v8-persistent-handle.h.
Definition at line 119 of file v8-persistent-handle.h.
References HandleScope::Local.
|
inline |
Definition at line 116 of file v8-persistent-handle.h.
bool IsWeak |
Returns true if the handle's reference is weak.
Definition at line 467 of file v8-persistent-handle.h.
References Internals::GetNodeState(), and Internals::kNodeStateIsWeakValue.
Definition at line 147 of file v8-persistent-handle.h.
|
inline |
Definition at line 142 of file v8-persistent-handle.h.
|
delete |
Definition at line 133 of file v8-persistent-handle.h.
|
inline |
Definition at line 124 of file v8-persistent-handle.h.
void Reset |
If non-empty, destroy the underlying storage cell IsEmpty() will return true after this call.
Definition at line 475 of file v8-persistent-handle.h.
References v8::api_internal::DisposeGlobal().
If non-empty, destroy the underlying storage cell and create a new one with the contents of other if other is non empty
If non-empty, destroy the underlying storage cell and create a new one with the contents of other if other is non empty
Definition at line 487 of file v8-persistent-handle.h.
V8_INLINE void 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
void 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
Definition at line 500 of file v8-persistent-handle.h.
void 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.
Definition at line 526 of file v8-persistent-handle.h.
References v8::api_internal::MakeWeak().
V8_INLINE void 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!
The callback is supposed to reset the handle. 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 510 of file v8-persistent-handle.h.
void SetWrapperClassId | ( | uint16_t | class_id | ) |
Assigns a wrapper class ID to the handle.
Definition at line 544 of file v8-persistent-handle.h.
References Internals::kNodeClassIdOffset.
uint16_t WrapperClassId |
Returns the class ID previously assigned to this handle or 0 if no class ID was previously assigned.
Definition at line 553 of file v8-persistent-handle.h.
References Internals::kNodeClassIdOffset.
|
friend |
Definition at line 216 of file v8-persistent-handle.h.
Referenced by PersistentValueVector< V, Traits >::Append(), PersistentValueVector< V, Traits >::Clear(), Global< T >::Pass(), PersistentValueMapBase< K, V, Traits >::Release(), PersistentValueMapBase< K, V, Traits >::RemoveWeak(), PersistentValueMap< K, V, Traits >::Set(), and GlobalValueMap< K, V, Traits >::Set().
|
friend |
Definition at line 209 of file v8-persistent-handle.h.
|
friend |
Definition at line 212 of file v8-persistent-handle.h.
|
friend |
Definition at line 225 of file v8-persistent-handle.h.
|
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 214 of file v8-persistent-handle.h.
|
friend |
Definition at line 218 of file v8-persistent-handle.h.
|
friend |
Definition at line 222 of file v8-persistent-handle.h.
|
friend |
Definition at line 224 of file v8-persistent-handle.h.
|
friend |
Definition at line 220 of file v8-persistent-handle.h.
|
friend |
Definition at line 210 of file v8-persistent-handle.h.