V8 Project
|
A vector wrapper that safely stores UniquePersistent values. More...
#include <v8-util.h>
Public Member Functions | |
PersistentValueVector (Isolate *isolate) | |
~PersistentValueVector () | |
void | Append (Local< V > value) |
Append a value to the vector. More... | |
void | Append (UniquePersistent< V > persistent) |
Append a persistent's value to the vector. More... | |
bool | IsEmpty () const |
Are there any values in the vector? More... | |
size_t | Size () const |
How many elements are in the vector? More... | |
Local< V > | Get (size_t index) const |
Retrieve the i-th value in the vector. More... | |
void | Clear () |
Remove all elements from the vector. More... | |
void | ReserveCapacity (size_t capacity) |
Reserve capacity in the vector. More... | |
Static Private Member Functions | |
static PersistentContainerValue | ClearAndLeak (UniquePersistent< V > *persistent) |
static V * | FromVal (PersistentContainerValue v) |
Private Attributes | |
Isolate * | isolate_ |
Traits::Impl | impl_ |
A vector wrapper that safely stores UniquePersistent values.
C++11 embedders don't need this class, as they can use UniquePersistent directly in std containers.
This class relies on a backing vector implementation, whose type and methods 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.
|
inlineexplicit |
|
inline |
Definition at line 409 of file v8-util.h.
References v8::PersistentValueVector< V, Traits >::Clear().
|
inline |
Append a value to the vector.
Definition at line 416 of file v8-util.h.
References v8::PersistentValueVector< V, Traits >::ClearAndLeak(), v8::PersistentValueVector< V, Traits >::impl_, and v8::PersistentValueVector< V, Traits >::isolate_.
|
inline |
Append a persistent's value to the vector.
Definition at line 424 of file v8-util.h.
References v8::PersistentValueVector< V, Traits >::ClearAndLeak(), and v8::PersistentValueVector< V, Traits >::impl_.
|
inline |
Remove all elements from the vector.
Definition at line 452 of file v8-util.h.
References v8::PersistentValueVector< V, Traits >::FromVal(), v8::PersistentValueVector< V, Traits >::impl_, and v8::PersistentBase< T >::val_.
Referenced by v8::PersistentValueVector< V, Traits >::~PersistentValueVector().
|
inlinestaticprivate |
Definition at line 470 of file v8-util.h.
References v8::PersistentBase< T >::val_.
Referenced by v8::PersistentValueVector< V, Traits >::Append().
|
inlinestaticprivate |
Definition at line 477 of file v8-util.h.
Referenced by v8::PersistentValueVector< V, Traits >::Clear(), and v8::PersistentValueVector< V, Traits >::Get().
|
inline |
Retrieve the i-th value in the vector.
Definition at line 445 of file v8-util.h.
References v8::PersistentValueVector< V, Traits >::FromVal(), v8::PersistentValueVector< V, Traits >::impl_, v8::PersistentValueVector< V, Traits >::isolate_, and v8::Local< T >::New().
|
inline |
Are there any values in the vector?
Definition at line 431 of file v8-util.h.
References v8::PersistentValueVector< V, Traits >::impl_.
|
inline |
Reserve capacity in the vector.
(Efficiency gains depend on the backing implementation.)
Definition at line 465 of file v8-util.h.
References v8::PersistentValueVector< V, Traits >::impl_.
|
inline |
How many elements are in the vector?
Definition at line 438 of file v8-util.h.
References v8::PersistentValueVector< V, Traits >::impl_.
|
private |
Definition at line 482 of file v8-util.h.
Referenced by v8::PersistentValueVector< V, Traits >::Append(), v8::PersistentValueVector< V, Traits >::Clear(), v8::PersistentValueVector< V, Traits >::Get(), v8::PersistentValueVector< V, Traits >::IsEmpty(), v8::PersistentValueVector< V, Traits >::ReserveCapacity(), and v8::PersistentValueVector< V, Traits >::Size().
|
private |
Definition at line 481 of file v8-util.h.
Referenced by v8::PersistentValueVector< V, Traits >::Append(), and v8::PersistentValueVector< V, Traits >::Get().