v8  4.2.77(io.js2.5.0)
V8 is Google's open source JavaScript engine
PersistentValueMapBase< K, V, Traits > Class Template Reference

#include <v8-util.h>

Inheritance diagram for PersistentValueMapBase< K, V, Traits >:

Data Structures

class  PersistentValueReference
 

Public Member Functions

IsolateGetIsolate ()
 
size_t Size ()
 
bool IsWeak ()
 
Local< V > Get (const K &key)
 
bool Contains (const K &key)
 
bool SetReturnValue (const K &key, ReturnValue< Value > returnValue)
 
void SetReference (const K &key, const Persistent< Object > &parent)
 
UniquePersistent< V > Remove (const K &key)
 
void Clear ()
 
PersistentValueReference GetReference (const K &key)
 

Protected Member Functions

 PersistentValueMapBase (Isolate *isolate)
 
 ~PersistentValueMapBase ()
 
Isolateisolate ()
 
Traits::Impl * impl ()
 

Static Protected Member Functions

static V * FromVal (PersistentContainerValue v)
 
static PersistentContainerValue ClearAndLeak (UniquePersistent< V > *persistent)
 
static PersistentContainerValue Leak (UniquePersistent< V > *persistent)
 
static UniquePersistent< V > Release (PersistentContainerValue v)
 

Detailed Description

template<typename K, typename V, typename Traits>
class v8::PersistentValueMapBase< K, V, Traits >

A map wrapper that allows using UniquePersistent as a mapped value. C++11 embedders don't need this class, as they can use UniquePersistent directly in std containers.

The map relies on a backing map, whose type and accessors are described by the Traits class. The backing map will handle values of type PersistentContainerValue, with all conversion into and out of V8 handles being transparently handled by this class.

Definition at line 156 of file v8-util.h.

Constructor & Destructor Documentation

PersistentValueMapBase ( Isolate isolate)
inlineexplicitprotected

Definition at line 285 of file v8-util.h.

~PersistentValueMapBase ( )
inlineprotected

Definition at line 287 of file v8-util.h.

References PersistentValueMapBase< K, V, Traits >::Clear().

Member Function Documentation

void Clear ( )
inline

Traverses the map repeatedly, in case side effects of disposal cause insertions.

Definition at line 214 of file v8-util.h.

References PersistentValueMapBase< K, V, Traits >::Release().

Referenced by PersistentValueMapBase< K, V, Traits >::~PersistentValueMapBase().

static PersistentContainerValue ClearAndLeak ( UniquePersistent< V > *  persistent)
inlinestaticprotected

Definition at line 296 of file v8-util.h.

bool Contains ( const K &  key)
inline

Check whether a value is contained in the map.

Definition at line 180 of file v8-util.h.

Local<V> Get ( const K &  key)
inline

Get value stored in map.

Definition at line 173 of file v8-util.h.

References PersistentValueMapBase< K, V, Traits >::FromVal().

Isolate* GetIsolate ( )
inline

Definition at line 158 of file v8-util.h.

Referenced by PersistentValueMapBase< K, V, Traits >::SetReference().

PersistentValueReference GetReference ( const K &  key)
inline

Get a reference to a map value. This enables fast, repeated access to a value stored in the map while the map remains unchanged.

Careful: This is potentially unsafe, so please use with care. The value will become invalid if the value for this key changes in the underlying map, as a result of Set or Remove for the same key; as a result of the weak callback for the same key; or as a result of calling Clear() or destruction of the map.

Definition at line 280 of file v8-util.h.

References PersistentValueMapBase< K, V, Traits >::PersistentValueReference::PersistentValueMapBase.

Traits::Impl* impl ( )
inlineprotected

Definition at line 290 of file v8-util.h.

Isolate* isolate ( )
inlineprotected

Definition at line 289 of file v8-util.h.

bool IsWeak ( )
inline

Return whether the map holds weak persistents.

Definition at line 168 of file v8-util.h.

References v8::kNotWeak.

static PersistentContainerValue Leak ( UniquePersistent< V > *  persistent)
inlinestaticprotected

Definition at line 303 of file v8-util.h.

static UniquePersistent<V> Release ( PersistentContainerValue  v)
inlinestaticprotected

Return a container value as UniquePersistent and make sure the weak callback is properly disposed of. All remove functionality should go through this.

Definition at line 312 of file v8-util.h.

References PersistentValueMapBase< K, V, Traits >::FromVal(), and v8::kNotWeak.

Referenced by PersistentValueMapBase< K, V, Traits >::Clear(), and PersistentValueMapBase< K, V, Traits >::Remove().

UniquePersistent<V> Remove ( const K &  key)
inline

Return value for key and remove it from the map.

Definition at line 206 of file v8-util.h.

References PersistentValueMapBase< K, V, Traits >::Release().

void SetReference ( const K &  key,
const Persistent< Object > &  parent 
)
inline

Call Isolate::SetReference with the given parent and the map value.

Definition at line 196 of file v8-util.h.

References PersistentValueMapBase< K, V, Traits >::FromVal(), and PersistentValueMapBase< K, V, Traits >::GetIsolate().

bool SetReturnValue ( const K &  key,
ReturnValue< Value returnValue 
)
inline

Get value stored in map and set it in returnValue. Return true if a value was found.

Definition at line 188 of file v8-util.h.

size_t Size ( )
inline

Return size of the map.

Definition at line 163 of file v8-util.h.


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