v8  9.0.257(node16.0.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< VGet (const K &key)
 
bool Contains (const K &key)
 
bool SetReturnValue (const K &key, ReturnValue< Value > returnValue)
 
Global< VRemove (const K &key)
 
void Clear ()
 
PersistentValueReference GetReference (const K &key)
 

Protected Member Functions

 PersistentValueMapBase (Isolate *isolate)
 
 PersistentValueMapBase (Isolate *isolate, const char *label)
 
 ~PersistentValueMapBase ()
 
Isolateisolate ()
 
Traits::Impl * impl ()
 
void RemoveWeak (const K &key)
 
void AnnotateStrongRetainer (Global< V > *persistent)
 

Static Protected Member Functions

static VFromVal (PersistentContainerValue v)
 
static PersistentContainerValue ClearAndLeak (Global< V > *persistent)
 
static PersistentContainerValue Leak (Global< V > *persistent)
 
static Global< VRelease (PersistentContainerValue v)
 

Detailed Description

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

A map wrapper that allows using Global as a mapped value. C++11 embedders don't need this class, as they can use Global 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 160 of file v8-util.h.

Constructor & Destructor Documentation

◆ PersistentValueMapBase() [1/2]

PersistentValueMapBase ( Isolate isolate)
inlineexplicitprotected

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

◆ PersistentValueMapBase() [2/2]

PersistentValueMapBase ( Isolate isolate,
const char *  label 
)
inlineprotected

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

◆ ~PersistentValueMapBase()

~PersistentValueMapBase ( )
inlineprotected

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

Member Function Documentation

◆ AnnotateStrongRetainer()

void AnnotateStrongRetainer ( Global< V > *  persistent)
inlineprotected

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

◆ Clear()

void Clear ( )
inline

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

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

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

◆ ClearAndLeak()

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

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

◆ Contains()

bool Contains ( const K &  key)
inline

Check whether a value is contained in the map.

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

◆ FromVal()

◆ Get()

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

Get value stored in map.

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

◆ GetIsolate()

Isolate* GetIsolate ( )
inline

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

◆ GetReference()

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

◆ impl()

Traits::Impl* impl ( )
inlineprotected

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

◆ isolate()

Isolate* isolate ( )
inlineprotected

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

◆ IsWeak()

bool IsWeak ( )
inline

Return whether the map holds weak persistents.

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

◆ Leak()

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

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

◆ Release()

static Global<V> Release ( PersistentContainerValue  v)
inlinestaticprotected

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

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

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

◆ Remove()

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

Return value for key and remove it from the map.

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

◆ RemoveWeak()

void RemoveWeak ( const K &  key)
inlineprotected

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

◆ SetReturnValue()

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

◆ Size()

size_t Size ( )
inline

Return size of the map.

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


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