v8  3.28.71 (node 0.12.18)
V8 is Google's open source JavaScript engine
PersistentBase< T > Class Template Reference

#include <v8.h>

Inheritance diagram for PersistentBase< T >:

Public Member Functions

V8_INLINE void Reset ()
 
template<class S >
V8_INLINE void Reset (Isolate *isolate, const Handle< S > &other)
 
template<class S >
V8_INLINE void Reset (Isolate *isolate, const PersistentBase< S > &other)
 
V8_INLINE bool IsEmpty () const
 
template<class S >
V8_INLINE bool operator== (const PersistentBase< S > &that) const
 
template<class S >
V8_INLINE bool operator== (const Handle< S > &that) const
 
template<class S >
V8_INLINE bool operator!= (const PersistentBase< S > &that) const
 
template<class S >
V8_INLINE bool operator!= (const Handle< S > &that) const
 
template<typename P >
V8_INLINE void SetWeak (P *parameter, typename WeakCallbackData< T, P >::Callback callback)
 
template<typename S , typename P >
V8_INLINE void SetWeak (P *parameter, typename WeakCallbackData< S, P >::Callback callback)
 
template<typename P >
V8_INLINE P * ClearWeak ()
 
V8_INLINE void ClearWeak ()
 
V8_INLINE void MarkIndependent ()
 
V8_INLINE void MarkPartiallyDependent ()
 
V8_INLINE bool IsIndependent () const
 
V8_INLINE bool IsNearDeath () const
 
V8_INLINE bool IsWeak () const
 
V8_INLINE void SetWrapperClassId (uint16_t class_id)
 
V8_INLINE uint16_t WrapperClassId () const
 
template<class S >
void Reset (Isolate *isolate, const Handle< S > &other)
 
template<class S >
void Reset (Isolate *isolate, const PersistentBase< S > &other)
 
template<typename S , typename P >
void SetWeak (P *parameter, typename WeakCallbackData< S, P >::Callback callback)
 
template<typename P >
void SetWeak (P *parameter, typename WeakCallbackData< T, P >::Callback callback)
 

Friends

class Isolate
 
class Utils
 
template<class F >
class Handle
 
template<class F >
class Local
 
template<class F1 , class F2 >
class Persistent
 
template<class F >
class UniquePersistent
 
template<class F >
class PersistentBase
 
template<class F >
class ReturnValue
 
template<class F1 , class F2 , class F3 >
class PersistentValueMap
 
template<class F1 , class F2 >
class PersistentValueVector
 
class Object
 

Detailed Description

template<class T>
class v8::PersistentBase< T >

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.

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 446 of file v8.h.

Member Function Documentation

◆ ClearWeak() [1/2]

V8_INLINE P* ClearWeak ( )

◆ ClearWeak() [2/2]

P * ClearWeak ( )
inline

Definition at line 516 of file v8.h.

◆ IsEmpty()

V8_INLINE bool IsEmpty ( ) const
inline

Definition at line 467 of file v8.h.

◆ IsIndependent()

bool IsIndependent

Definition at line 5820 of file v8.h.

References Internals::GetNodeFlag(), and Internals::kNodeIsIndependentShift.

◆ IsNearDeath()

bool IsNearDeath

Checks if the handle holds the only reference to an object.

Definition at line 5829 of file v8.h.

References Internals::GetNodeState(), Internals::kNodeStateIsNearDeathValue, and Internals::kNodeStateIsPendingValue.

◆ IsWeak()

bool IsWeak

Returns true if the handle's reference is weak.

Definition at line 5840 of file v8.h.

References Internals::GetNodeState(), and Internals::kNodeStateIsWeakValue.

◆ MarkIndependent()

void MarkIndependent

Marks the reference to this object independent. Garbage collector is free to ignore any object groups containing this object. Weak callback for an independent handle should not assume that it will be preceded by a global GC prologue callback or followed by a global GC epilogue callback.

Definition at line 5908 of file v8.h.

References Internals::kNodeIsIndependentShift, and Internals::UpdateNodeFlag().

◆ MarkPartiallyDependent()

void MarkPartiallyDependent

Marks the reference to this object partially dependent. Partially dependent handles only depend on other partially dependent handles and these dependencies are provided through object groups. It provides a way to build smaller object groups for young objects that represent only a subset of all external dependencies. This mark is automatically cleared after each garbage collection.

Definition at line 5918 of file v8.h.

References Internals::kNodeIsPartiallyDependentShift, and Internals::UpdateNodeFlag().

◆ operator!=() [1/2]

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

Definition at line 491 of file v8.h.

◆ operator!=() [2/2]

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

Definition at line 487 of file v8.h.

◆ operator==() [1/2]

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

Definition at line 478 of file v8.h.

◆ operator==() [2/2]

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

Definition at line 470 of file v8.h.

◆ Reset() [1/5]

void Reset

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

Definition at line 5849 of file v8.h.

◆ Reset() [2/5]

V8_INLINE void Reset ( Isolate isolate,
const Handle< 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/5]

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

Definition at line 5858 of file v8.h.

◆ Reset() [4/5]

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

◆ Reset() [5/5]

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

Definition at line 5868 of file v8.h.

◆ SetWeak() [1/4]

V8_INLINE void SetWeak ( P *  parameter,
typename WeakCallbackData< S, P >::Callback  callback 
)

◆ SetWeak() [2/4]

void SetWeak ( P *  parameter,
typename WeakCallbackData< S, P >::Callback  callback 
)

Definition at line 5879 of file v8.h.

◆ SetWeak() [3/4]

V8_INLINE void SetWeak ( P *  parameter,
typename WeakCallbackData< T, P >::Callback  callback 
)

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!

◆ SetWeak() [4/4]

void SetWeak ( P *  parameter,
typename WeakCallbackData< T, P >::Callback  callback 
)

Definition at line 5892 of file v8.h.

◆ SetWrapperClassId()

void SetWrapperClassId ( uint16_t  class_id)

Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface description in v8-profiler.h for details.

Definition at line 5937 of file v8.h.

References Internals::kNodeClassIdOffset.

◆ WrapperClassId()

uint16_t WrapperClassId

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

Definition at line 5947 of file v8.h.

References Internals::kNodeClassIdOffset.

Friends And Related Function Documentation

◆ Handle

friend class Handle
friend

Definition at line 559 of file v8.h.

◆ Isolate

friend class Isolate
friend

Definition at line 557 of file v8.h.

◆ Local

friend class Local
friend

Definition at line 560 of file v8.h.

◆ Object

friend class Object
friend

Definition at line 567 of file v8.h.

◆ Persistent

friend class Persistent
friend

Definition at line 561 of file v8.h.

◆ PersistentBase

friend class PersistentBase
friend

Definition at line 563 of file v8.h.

◆ PersistentValueMap

friend class PersistentValueMap
friend

Definition at line 565 of file v8.h.

◆ PersistentValueVector

friend class PersistentValueVector
friend

Definition at line 566 of file v8.h.

◆ ReturnValue

friend class ReturnValue
friend

◆ UniquePersistent

◆ Utils

friend class Utils
friend

Definition at line 558 of file v8.h.


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