Public Member Functions | Friends

v8::Persistent< T > Class Template Reference

#include <v8.h>

Inheritance diagram for v8::Persistent< T >:
v8::Handle< T >

List of all members.

Public Member Functions

 V8_INLINE (Persistent())
template<class S >
 V8_INLINE (Persistent(Persistent< S > that))
template<class S >
 V8_INLINE (Persistent(S *that))
template<class S >
 V8_INLINE (Persistent(Handle< S > that))
template<class S >
 V8_INLINE (static Persistent< T > Cast(Persistent< S > that))
template<class S >
 V8_INLINE (Persistent< S > As())
 V8_DEPRECATED (static Persistent< T > New(Handle< T > that))
 V8_INLINE (static Persistent< T > New(Isolate *isolate, Handle< T > that))
 V8_DEPRECATED (void Dispose())
 V8_INLINE (void Dispose(Isolate *isolate))
 V8_DEPRECATED (void MakeWeak(void *parameters, WeakReferenceCallback callback))
 V8_INLINE (void MakeWeak(Isolate *isolate, void *parameters, NearDeathCallback callback))
 V8_DEPRECATED (void ClearWeak())
 V8_INLINE (void ClearWeak(Isolate *isolate))
 V8_DEPRECATED (void MarkIndependent())
 V8_INLINE (void MarkIndependent(Isolate *isolate))
 V8_DEPRECATED (void MarkPartiallyDependent())
 V8_INLINE (void MarkPartiallyDependent(Isolate *isolate))
 V8_DEPRECATED (bool IsIndependent() const)
 V8_INLINE (bool IsIndependent(Isolate *isolate) const)
 V8_DEPRECATED (bool IsNearDeath() const)
 V8_INLINE (bool IsNearDeath(Isolate *isolate) const)
 V8_DEPRECATED (bool IsWeak() const)
 V8_INLINE (bool IsWeak(Isolate *isolate) const)
 V8_DEPRECATED (void SetWrapperClassId(uint16_t class_id))
 V8_INLINE (void SetWrapperClassId(Isolate *isolate, uint16_t class_id))
 V8_DEPRECATED (uint16_t WrapperClassId() const)
 V8_INLINE (uint16_t WrapperClassId(Isolate *isolate) const)

Friends

class ImplementationUtilities
class ObjectTemplate

Detailed Description

template<class T>
class v8::Persistent< 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 Persistent 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 Persistent::New and existing handles can be disposed using Persistent::Dispose. Since persistent handles are passed by value you may have many persistent handle objects that point to the same storage cell. For instance, if you pass a persistent handle as an argument to a function you will not get two different storage cells but rather two references to the same storage cell.


Member Function Documentation

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( static Persistent< T >   NewHandle< T > that  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( void   Dispose()  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( void   MarkPartiallyDependent()  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( bool IsIndependent()  const  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( void   MakeWeakvoid *parameters, WeakReferenceCallback callback  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( bool IsNearDeath()  const  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( bool IsWeak()  const  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( void   ClearWeak()  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( void   SetWrapperClassIduint16_t class_id  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( uint16_t WrapperClassId()  const  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_DEPRECATED ( void   MarkIndependent()  ) 

Deprecated. Use Isolate version instead.

template<class T>
v8::Persistent< T >::V8_INLINE ( void   MarkPartiallyDependentIsolate *isolate  ) 

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.

template<class T>
v8::Persistent< T >::V8_INLINE ( static Persistent< T >   NewIsolate *isolate, Handle< T > that  ) 

Creates a new persistent handle for an existing local or persistent handle.

template<class T>
v8::Persistent< T >::V8_INLINE ( void   MarkIndependentIsolate *isolate  ) 

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.

template<class T>
v8::Persistent< T >::V8_INLINE ( void   ClearWeakIsolate *isolate  ) 

Clears the weak reference to this object.

template<class T>
v8::Persistent< T >::V8_INLINE ( bool IsNearDeath(Isolate *isolate)  const  ) 

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

template<class T>
v8::Persistent< T >::V8_INLINE ( Persistent< T >()   ) 

Creates an empty persistent handle that doesn't point to any storage cell.

template<class T>
v8::Persistent< T >::V8_INLINE ( void   MakeWeakIsolate *isolate, void *parameters, NearDeathCallback callback  ) 

Make the reference to this object weak. When only weak handles refer to the object, the garbage collector will perform a callback to the given V8::NearDeathCallback function, passing it the object reference and the given parameters.

template<class T>
v8::Persistent< T >::V8_INLINE ( void   SetWrapperClassIdIsolate *isolate, uint16_t class_id  ) 

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

template<class T>
v8::Persistent< T >::V8_INLINE ( uint16_t WrapperClassId(Isolate *isolate)  const  ) 

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

template<class T>
template<class S >
v8::Persistent< T >::V8_INLINE ( Persistent< T >(Persistent< S > that)   )  [inline]

Creates a persistent handle for the same storage cell as the specified handle. This constructor allows you to pass persistent handles as arguments by value and to assign between persistent handles. However, attempting to assign between incompatible persistent handles, for instance from a Persistent<String> to a Persistent<Number> will cause a compile-time error. Assigning between compatible persistent handles, for instance assigning a Persistent<String> to a variable declared as Persistent<Value>, is allowed as String is a subclass of Value.

This check fails when trying to convert between incompatible handles. For example, converting from a Handle<String> to a Handle<Number>.

template<class T>
v8::Persistent< T >::V8_INLINE ( bool IsIndependent(Isolate *isolate)  const  ) 

Returns true if this handle was previously marked as independent.

template<class T>
v8::Persistent< T >::V8_INLINE ( void   DisposeIsolate *isolate  ) 

Releases the storage cell referenced by this persistent handle. Does not remove the reference to the cell from any handles. This handle's reference, and any other references to the storage cell remain and IsEmpty will still return false.

template<class T>
v8::Persistent< T >::V8_INLINE ( bool IsWeak(Isolate *isolate)  const  ) 

Returns true if the handle's reference is weak.

template<class T>
template<class S >
v8::Persistent< T >::V8_INLINE ( Persistent< T >(Handle< S > that)   )  [inline, explicit]

"Casts" a plain handle which is known to be a persistent handle to a persistent handle.


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