5#ifndef INCLUDE_V8_ARRAY_BUFFER_H_
6#define INCLUDE_V8_ARRAY_BUFFER_H_
18class SharedArrayBuffer;
20#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
22#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
67 void operator delete(
void* ptr) { ::operator
delete(ptr); }
75 v8::Isolate* isolate, std::unique_ptr<BackingStore> backing_store,
95 static void EmptyDeleter(
void* data,
size_t length,
void* deleter_data);
105#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
152 virtual void Free(
void* data,
size_t length) = 0;
166 virtual void*
Reallocate(
void* data,
size_t old_length,
size_t new_length);
213 std::shared_ptr<BackingStore> backing_store);
260#ifdef V8_ENABLE_CHECKS
271 static void CheckCast(
Value* obj);
274#ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
276#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
316#ifdef V8_ENABLE_CHECKS
322 static const int kInternalFieldCount =
324 static const int kEmbedderFieldCount =
329 static void CheckCast(
Value* obj);
338 size_t byte_offset,
size_t length);
340 size_t byte_offset,
size_t length);
342#ifdef V8_ENABLE_CHECKS
345 return static_cast<DataView*
>(value);
350 static void CheckCast(
Value* obj);
384 Isolate* isolate, std::shared_ptr<BackingStore> backing_store);
418#ifdef V8_ENABLE_CHECKS
428 static void CheckCast(
Value* obj);
static Allocator * NewDefaultAllocator()
virtual void * Reallocate(void *data, size_t old_length, size_t new_length)
virtual void * AllocateUninitialized(size_t length)=0
virtual ~Allocator()=default
virtual void Free(void *data, size_t length)=0
virtual void * Allocate(size_t length)=0
static Local< ArrayBuffer > New(Isolate *isolate, std::shared_ptr< BackingStore > backing_store)
static V8_INLINE ArrayBuffer * Cast(Value *value)
static std::unique_ptr< BackingStore > NewBackingStore(void *data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, void *deleter_data)
bool IsDetachable() const
static Local< ArrayBuffer > New(Isolate *isolate, size_t byte_length)
std::shared_ptr< BackingStore > GetBackingStore()
size_t ByteLength() const
static std::unique_ptr< BackingStore > NewBackingStore(Isolate *isolate, size_t byte_length)
Local< ArrayBuffer > Buffer()
size_t CopyContents(void *dest, size_t byte_length)
static V8_INLINE ArrayBufferView * Cast(Value *value)
void(*)(void *data, size_t length, void *deleter_data) DeleterCallback
static void EmptyDeleter(void *data, size_t length, void *deleter_data)
static std::unique_ptr< BackingStore > Reallocate(v8::Isolate *isolate, std::unique_ptr< BackingStore > backing_store, size_t byte_length)
size_t ByteLength() const
static Local< DataView > New(Local< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static V8_INLINE DataView * Cast(Value *value)
static Local< DataView > New(Local< SharedArrayBuffer > shared_array_buffer, size_t byte_offset, size_t length)
static Local< SharedArrayBuffer > New(Isolate *isolate, std::shared_ptr< BackingStore > backing_store)
static std::unique_ptr< BackingStore > NewBackingStore(void *data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, void *deleter_data)
static V8_INLINE SharedArrayBuffer * Cast(Value *value)
std::shared_ptr< BackingStore > GetBackingStore()
size_t ByteLength() const
static std::unique_ptr< BackingStore > NewBackingStore(Isolate *isolate, size_t byte_length)
static Local< SharedArrayBuffer > New(Isolate *isolate, size_t byte_length)
void(*)(void *data, size_t length, void *deleter_data) BackingStoreDeleterCallback
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT