Pepper_47_C++_interfaces
|
#include <var_array_buffer.h>
Public Member Functions | |
VarArrayBuffer () | |
VarArrayBuffer (const Var &var) | |
VarArrayBuffer (uint32_t size_in_bytes) | |
VarArrayBuffer (const VarArrayBuffer &buffer) | |
Copy constructor. More... | |
virtual | ~VarArrayBuffer () |
VarArrayBuffer & | operator= (const VarArrayBuffer &other) |
virtual Var & | operator= (const Var &other) |
uint32_t | ByteLength () const |
void * | Map () |
void | Unmap () |
![]() | |
Var () | |
Var (Null) | |
A constructor used to create a Var of type Null . More... | |
Var (bool b) | |
Var (int32_t i) | |
Var (double d) | |
Var (const char *utf8_str) | |
A constructor used to create a UTF-8 character Var . More... | |
Var (const std::string &utf8_str) | |
A constructor used to create a UTF-8 character Var . More... | |
Var (const pp::Resource &resource) | |
A constructor used to create a resource Var . More... | |
Var (PassRef, const PP_Var &var) | |
Var (const PP_Var &var) | |
A constructor that increments the reference count. More... | |
Var (DontManage, const PP_Var &var) | |
Var (const Var &other) | |
A constructor for copying a Var . More... | |
virtual | ~Var () |
Destructor. More... | |
bool | operator== (const Var &other) const |
bool | is_undefined () const |
bool | is_null () const |
bool | is_bool () const |
bool | is_string () const |
bool | is_object () const |
bool | is_array () const |
bool | is_dictionary () const |
bool | is_resource () const |
bool | is_int () const |
bool | is_double () const |
bool | is_number () const |
bool | is_array_buffer () const |
This function determines if this Var is an ArrayBuffer. More... | |
bool | AsBool () const |
int32_t | AsInt () const |
double | AsDouble () const |
std::string | AsString () const |
pp::Resource | AsResource () const |
const PP_Var & | pp_var () const |
PP_Var | Detach () |
std::string | DebugString () const |
Additional Inherited Members | |
![]() | |
PP_Var | var_ |
bool | is_managed_ |
VarArrayBuffer
provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous sequence of bytes. Note that these vars are not part of the embedding page's DOM, and can only be shared with JavaScript using the PostMessage
and HandleMessage
functions of Instance
.
Definition at line 20 of file var_array_buffer.h.
pp::VarArrayBuffer::VarArrayBuffer | ( | ) |
The default constructor constructs a VarArrayBuffer
which is 0 byte long.
Definition at line 23 of file var_array_buffer.cc.
|
explicit |
Construct a VarArrayBuffer
given a var for which is_array_buffer() is true. This will refer to the same ArrayBuffer
as var, but allows you to access methods specific to VarArrayBuffer
.
[in] | var | An ArrayBuffer var. |
Definition at line 27 of file var_array_buffer.cc.
References pp::Var::is_array_buffer(), PP_NOTREACHED, and pp::Var::var_.
|
explicit |
Construct a new VarArrayBuffer
which is size_in_bytes
bytes long and initialized to zero.
[in] | size_in_bytes | The size of the constructed ArrayBuffer in bytes. |
Definition at line 34 of file var_array_buffer.cc.
|
inline |
Copy constructor.
Definition at line 42 of file var_array_buffer.h.
|
inlinevirtual |
Definition at line 44 of file var_array_buffer.h.
uint32_t pp::VarArrayBuffer::ByteLength | ( | ) | const |
ByteLength() retrieves the length of the VarArrayBuffer
in bytes.
VarArrayBuffer
in bytes. Definition at line 52 of file var_array_buffer.cc.
References pp::Var::is_array_buffer(), PP_NOTREACHED, and pp::Var::var_.
void * pp::VarArrayBuffer::Map | ( | ) |
Map() maps the ArrayBuffer
in to the module's address space and returns a pointer to the beginning of the internal buffer for this ArrayBuffer
. ArrayBuffers are copied when transmitted, so changes to the underlying memory are not automatically available to the embedding page.
Note that calling Map() can be a relatively expensive operation. Use care when calling it in performance-critical code. For example, you should call it only once when looping over an ArrayBuffer
.
Example:
ArrayBuffer
. Definition at line 61 of file var_array_buffer.cc.
References pp::Var::is_array_buffer(), PP_NOTREACHED, and pp::Var::var_.
pp::VarArrayBuffer & pp::VarArrayBuffer::operator= | ( | const VarArrayBuffer & | other | ) |
This function assigns one VarArrayBuffer
to another VarArrayBuffer
.
[in] | other | The VarArrayBuffer to be assigned. |
VarArrayBuffer
. Definition at line 38 of file var_array_buffer.cc.
References pp::Var::operator=().
This function assigns one VarArrayBuffer
to another VarArrayBuffer
. A Var's assignment operator is overloaded here so that we can check for assigning a non-ArrayBuffer var to a VarArrayBuffer
.
[in] | other | The VarArrayBuffer to be assigned. |
VarArrayBuffer
(as a Var&). Reimplemented from pp::Var.
Definition at line 43 of file var_array_buffer.cc.
References pp::Var::is_array_buffer(), pp::Var::operator=(), and PP_NOTREACHED.
void pp::VarArrayBuffer::Unmap | ( | ) |
Unmap() unmaps this ArrayBuffer
var from the module address space. Use this if you want to save memory but might want to call Map() to map the buffer again later.
Definition at line 68 of file var_array_buffer.cc.
References pp::Var::is_array_buffer(), PP_NOTREACHED, and pp::Var::var_.