v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::BackingStore Class Reference

#include <v8-array-buffer.h>

Inheritance diagram for v8::BackingStore:
Collaboration diagram for v8::BackingStore:

Public Types

using DeleterCallback
 

Public Member Functions

 ~BackingStore ()
 
void * Data () const
 
size_t ByteLength () const
 
size_t MaxByteLength () const
 
bool IsShared () const
 
bool IsResizableByUserJavaScript () const
 
void operator delete (void *ptr)
 

Static Public Member Functions

static void EmptyDeleter (void *data, size_t length, void *deleter_data)
 

Private Member Functions

 BackingStore ()
 

Detailed Description

A wrapper around the backing store (i.e. the raw memory) of an array buffer. See a document linked in http://crbug.com/v8/9908 for more information.

The allocation and destruction of backing stores is generally managed by V8. Clients should always use standard C++ memory ownership types (i.e. std::unique_ptr and std::shared_ptr) to manage lifetimes of backing stores properly, since V8 internal objects may alias backing stores.

This object does not keep the underlying |ArrayBuffer::Allocator| alive by default. Use Isolate::CreateParams::array_buffer_allocator_shared when creating the Isolate to make it hold a reference to the allocator itself.

Definition at line 49 of file v8-array-buffer.h.

Member Typedef Documentation

◆ DeleterCallback

Initial value:
void (*)(void* data, size_t length,
void* deleter_data)
union v8::internal::@341::BuiltinMetadata::KindSpecificData data

This callback is used only if the memory block for a BackingStore cannot be allocated with an ArrayBuffer::Allocator. In such cases the destructor of the BackingStore invokes the callback to free the memory block.

Definition at line 99 of file v8-array-buffer.h.

Constructor & Destructor Documentation

◆ ~BackingStore()

v8::BackingStore::~BackingStore ( )

Definition at line 3997 of file api.cc.

Here is the call graph for this function:

◆ BackingStore()

v8::BackingStore::BackingStore ( )
private

Member Function Documentation

◆ ByteLength()

size_t v8::BackingStore::ByteLength ( ) const

The length (in bytes) of this backing store.

Definition at line 4006 of file api.cc.

◆ Data()

void * v8::BackingStore::Data ( ) const

Return a pointer to the beginning of the memory block for this backing store. The pointer is only valid as long as this backing store object lives.

Definition at line 4002 of file api.cc.

◆ EmptyDeleter()

void v8::BackingStore::EmptyDeleter ( void * data,
size_t length,
void * deleter_data )
static

If the memory block of a BackingStore is static or is managed manually, then this empty deleter along with nullptr deleter_data can be passed to ArrayBuffer::NewBackingStore to indicate that.

The manually managed case should be used with caution and only when it is guaranteed that the memory block freeing happens after detaching its ArrayBuffer.

Definition at line 4023 of file api.cc.

Here is the caller graph for this function:

◆ IsResizableByUserJavaScript()

bool v8::BackingStore::IsResizableByUserJavaScript ( ) const

Indicates whether the backing store was created for a resizable ArrayBuffer or a growable SharedArrayBuffer, and thus may be resized by user JavaScript code.

Definition at line 4018 of file api.cc.

◆ IsShared()

bool v8::BackingStore::IsShared ( ) const

Indicates whether the backing store was created for an ArrayBuffer or a SharedArrayBuffer.

Definition at line 4014 of file api.cc.

◆ MaxByteLength()

size_t v8::BackingStore::MaxByteLength ( ) const

The maximum length (in bytes) that this backing store may grow to.

If this backing store was created for a resizable ArrayBuffer or a growable SharedArrayBuffer, it is >= ByteLength(). Otherwise it is == ByteLength().

Definition at line 4010 of file api.cc.

◆ operator delete()

void v8::BackingStore::operator delete ( void * ptr)
inline

Prevent implicit instantiation of operator delete with size_t argument. The size_t argument would be incorrect because ptr points to the internal BackingStore object.

Definition at line 92 of file v8-array-buffer.h.


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