V8 Project
v8::UniquePersistent< T > Class Template Reference

A PersistentBase which has move semantics. More...

#include <v8.h>

+ Inheritance diagram for v8::UniquePersistent< T >:
+ Collaboration diagram for v8::UniquePersistent< T >:

Classes

struct  RValue
 

Public Member Functions

 UniquePersistent ()
 A UniquePersistent with no storage cell. More...
 
template<class S >
 UniquePersistent (Isolate *isolate, Handle< S > that)
 Construct a UniquePersistent from a Handle. More...
 
template<class S >
 UniquePersistent (Isolate *isolate, const PersistentBase< S > &that)
 Construct a UniquePersistent from a PersistentBase. More...
 
 UniquePersistent (RValue rvalue)
 Move constructor. More...
 
 ~UniquePersistent ()
 
template<class S >
UniquePersistentoperator= (UniquePersistent< S > rhs)
 Move via assignment. More...
 
 operator RValue ()
 Cast operator for moves. More...
 
UniquePersistent Pass ()
 Pass allows returning uniques from functions, etc. More...
 
- Public Member Functions inherited from v8::PersistentBase< T >
void Reset ()
 If non-empty, destroy the underlying storage cell IsEmpty() will return true after this call. More...
 
template<class S >
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. More...
 
template<class S >
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. More...
 
bool IsEmpty () const
 
template<class S >
bool operator== (const PersistentBase< S > &that) const
 
template<class S >
bool operator== (const Handle< S > &that) const
 
template<class S >
bool operator!= (const PersistentBase< S > &that) const
 
template<class S >
bool operator!= (const Handle< S > &that) const
 
template<typename P >
void SetWeak (P *parameter, typename WeakCallbackData< T, P >::Callback callback)
 Install a finalization callback on this object. More...
 
template<typename S , typename P >
void SetWeak (P *parameter, typename WeakCallbackData< S, P >::Callback callback)
 
template<typename P >
PClearWeak ()
 
void ClearWeak ()
 
void MarkIndependent ()
 Marks the reference to this object independent. More...
 
void MarkPartiallyDependent ()
 Marks the reference to this object partially dependent. More...
 
bool IsIndependent () const
 
bool IsNearDeath () const
 Checks if the handle holds the only reference to an object. More...
 
bool IsWeak () const
 Returns true if the handle's reference is weak. More...
 
void SetWrapperClassId (uint16_t class_id)
 Assigns a wrapper class ID to the handle. More...
 
uint16_t WrapperClassId () const
 Returns the class ID previously assigned to this handle or 0 if no class ID was previously assigned. More...
 

Private Member Functions

 UniquePersistent (UniquePersistent &)
 
void operator= (UniquePersistent &)
 

Detailed Description

template<class T>
class v8::UniquePersistent< T >

A PersistentBase which has move semantics.

Note: Persistent class hierarchy is subject to future changes.

Definition at line 723 of file v8.h.

Constructor & Destructor Documentation

◆ UniquePersistent() [1/5]

template<class T >
v8::UniquePersistent< T >::UniquePersistent ( )
inline

A UniquePersistent with no storage cell.

Definition at line 733 of file v8.h.

733 : PersistentBase<T>(0) { }

Referenced by v8::UniquePersistent< T >::Pass().

+ Here is the caller graph for this function:

◆ UniquePersistent() [2/5]

template<class T >
template<class S >
v8::UniquePersistent< T >::UniquePersistent ( Isolate isolate,
Handle< S that 
)
inline

Construct a UniquePersistent from a Handle.

When the Handle is non-empty, a new storage cell is created pointing to the same object, and no flags are set.

Definition at line 740 of file v8.h.

741  : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) {
742  TYPE_CHECK(T, S);
743  }
static T * New(Isolate *isolate, T *that)
Definition: v8.h:6031
#define TYPE_CHECK(T, S)
Definition: v8.h:167
#define T(name, string, precedence)
Definition: token.cc:25
#define S(x)
Definition: version.cc:55

References S, T, and TYPE_CHECK.

◆ UniquePersistent() [3/5]

template<class T >
template<class S >
v8::UniquePersistent< T >::UniquePersistent ( Isolate isolate,
const PersistentBase< S > &  that 
)
inline

Construct a UniquePersistent from a PersistentBase.

When the Persistent is non-empty, a new storage cell is created pointing to the same object, and no flags are set.

Definition at line 750 of file v8.h.

751  : PersistentBase<T>(PersistentBase<T>::New(isolate, that.val_)) {
752  TYPE_CHECK(T, S);
753  }

References S, T, and TYPE_CHECK.

◆ UniquePersistent() [4/5]

template<class T >
v8::UniquePersistent< T >::UniquePersistent ( RValue  rvalue)
inline

Move constructor.

Definition at line 757 of file v8.h.

758  : PersistentBase<T>(rvalue.object->val_) {
759  rvalue.object->val_ = 0;
760  }

References v8::UniquePersistent< T >::RValue::object, and v8::PersistentBase< T >::val_.

◆ ~UniquePersistent()

template<class T >
v8::UniquePersistent< T >::~UniquePersistent ( )
inline

Definition at line 761 of file v8.h.

761 { this->Reset(); }
void Reset()
If non-empty, destroy the underlying storage cell IsEmpty() will return true after this call.
Definition: v8.h:6082

References v8::PersistentBase< T >::Reset().

+ Here is the call graph for this function:

◆ UniquePersistent() [5/5]

template<class T >
v8::UniquePersistent< T >::UniquePersistent ( UniquePersistent< T > &  )
private

Member Function Documentation

◆ operator RValue()

template<class T >
v8::UniquePersistent< T >::operator RValue ( )
inline

Cast operator for moves.

Definition at line 776 of file v8.h.

776 { return RValue(this); }

◆ operator=() [1/2]

template<class T >
void v8::UniquePersistent< T >::operator= ( UniquePersistent< T > &  )
private

◆ operator=() [2/2]

template<class T >
template<class S >
UniquePersistent& v8::UniquePersistent< T >::operator= ( UniquePersistent< S rhs)
inline

Move via assignment.

Definition at line 766 of file v8.h.

766  {
767  TYPE_CHECK(T, S);
768  this->Reset();
769  this->val_ = rhs.val_;
770  rhs.val_ = 0;
771  return *this;
772  }

References v8::PersistentBase< T >::Reset(), S, T, TYPE_CHECK, and v8::PersistentBase< T >::val_.

+ Here is the call graph for this function:

◆ Pass()

template<class T >
UniquePersistent v8::UniquePersistent< T >::Pass ( )
inline

Pass allows returning uniques from functions, etc.

Definition at line 780 of file v8.h.

780 { return UniquePersistent(RValue(this)); }
UniquePersistent()
A UniquePersistent with no storage cell.
Definition: v8.h:733

References v8::UniquePersistent< T >::UniquePersistent().

Referenced by v8::PersistentValueMap< K, V, Traits >::Release().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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