v8  5.5.372(node7.10.1)
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 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 RegisterExternalReference (Isolate *isolate) const
 
V8_INLINE void RegisterExternalReference (EmbedderReachableReferenceReporter *reporter) const
 
V8_INLINE void MarkIndependent ()
 
V8_INLINE V8_DEPRECATED ("deprecated optimization, do not use partially dependent groups", void MarkPartiallyDependent())
 
V8_INLINE void MarkActive ()
 
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
 
 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
 

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

Constructor & Destructor Documentation

PersistentBase ( const PersistentBase< T > &  other)
delete

Member Function Documentation

V8_INLINE P* ClearWeak ( )
P * ClearWeak ( )
inline

Definition at line 574 of file v8.h.

V8_INLINE void Empty ( )
inline

Definition at line 515 of file v8.h.

V8_INLINE Local<T> Get ( Isolate isolate) const
inline

Definition at line 517 of file v8.h.

V8_INLINE bool IsEmpty ( ) const
inline

Definition at line 514 of file v8.h.

Referenced by PersistentBase< T >::RegisterExternalReference().

bool IsIndependent ( ) const

Definition at line 8489 of file v8.h.

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

bool IsNearDeath ( ) const

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

Definition at line 8498 of file v8.h.

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

bool IsWeak ( ) const

Returns true if the handle's reference is weak.

Definition at line 8509 of file v8.h.

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

void MarkActive ( )

Marks the reference to this object as active. The scavenge garbage collection should not reclaim the objects marked as active. This bit is cleared after the each garbage collection pass.

Definition at line 8596 of file v8.h.

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

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

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

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

Definition at line 540 of file v8.h.

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

Definition at line 545 of file v8.h.

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

Definition at line 522 of file v8.h.

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

Definition at line 531 of file v8.h.

V8_INLINE void RegisterExternalReference ( Isolate isolate) const
inline

Deprecated. TODO(hlopko): remove once migration to reporter is finished.

Definition at line 580 of file v8.h.

void RegisterExternalReference ( EmbedderReachableReferenceReporter reporter) const

Allows the embedder to tell the v8 garbage collector that a certain object is alive. Only allowed when the embedder is asked to trace its heap by EmbedderHeapTracer.

Definition at line 8569 of file v8.h.

References PersistentBase< T >::IsEmpty(), and EmbedderReachableReferenceReporter::ReportExternalReference().

void Reset ( )

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

Definition at line 8518 of file v8.h.

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

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 Local< S > &  other 
)

Definition at line 8527 of file v8.h.

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

Definition at line 8537 of file v8.h.

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!

Definition at line 8548 of file v8.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 8557 of file v8.h.

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

References Internals::kNodeClassIdOffset.

V8_INLINE V8_DEPRECATED ( "deprecated  optimization,
do not use partially dependent groups"  ,
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.

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

References Internals::kNodeClassIdOffset.

Friends And Related Function Documentation

friend class Global
friend

Definition at line 646 of file v8.h.

friend class Isolate
friend

Definition at line 641 of file v8.h.

friend class Local
friend

Definition at line 643 of file v8.h.

friend class Object
friend

Definition at line 652 of file v8.h.

friend class Persistent
friend

Definition at line 644 of file v8.h.

friend class PersistentBase
friend

Definition at line 647 of file v8.h.

friend class PersistentValueMapBase
friend

Definition at line 650 of file v8.h.

friend class PersistentValueVector
friend

Definition at line 651 of file v8.h.

friend class ReturnValue
friend

Definition at line 648 of file v8.h.

friend class Utils
friend

Definition at line 642 of file v8.h.


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