5#ifndef INCLUDE_V8_ARRAY_BUFFER_H_
6#define INCLUDE_V8_ARRAY_BUFFER_H_
19class SharedArrayBuffer;
21#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
23#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
85 void operator delete(
void* ptr) { ::operator
delete(ptr); }
93 "Reallocate is unsafe, please do not use. Please allocate a new "
94 "BackingStore and copy instead.")
116 static
void EmptyDeleter(
void* data,
size_t length,
void* deleter_data);
126#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
173 virtual void Free(
void* data,
size_t length) = 0;
188 "Reallocate is unsafe, please do not use. Please allocate new memory "
190 virtual
void* Reallocate(
void* data,
size_t old_length,
size_t new_length);
229 Isolate* isolate,
size_t byte_length,
231 BackingStoreInitializationMode::kZeroInitialized);
240 Isolate* isolate,
size_t byte_length,
242 BackingStoreInitializationMode::kZeroInitialized);
257 std::shared_ptr<BackingStore> backing_store);
270 Isolate* isolate,
size_t byte_length,
272 BackingStoreInitializationMode::kZeroInitialized);
298 size_t byte_length,
size_t max_byte_length);
317 "Use the version which takes a key parameter (passing a null handle is "
351 bool IsResizableByUserJavaScript() const;
360#ifdef V8_ENABLE_CHECKS
366 static constexpr int kInternalFieldCount =
368 static constexpr int kEmbedderFieldCount = kInternalFieldCount;
372 static void CheckCast(
Value* obj);
375#ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
377#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
427#ifdef V8_ENABLE_CHECKS
433 static constexpr int kInternalFieldCount =
435 static const int kEmbedderFieldCount = kInternalFieldCount;
439 static void CheckCast(
Value* obj);
448 size_t byte_offset,
size_t length);
450 size_t byte_offset,
size_t length);
452#ifdef V8_ENABLE_CHECKS
455 return static_cast<DataView*
>(value);
460 static void CheckCast(
Value* obj);
485 Isolate* isolate,
size_t byte_length,
487 BackingStoreInitializationMode::kZeroInitialized);
502 Isolate* isolate, std::shared_ptr<BackingStore> backing_store);
515 Isolate* isolate,
size_t byte_length,
517 BackingStoreInitializationMode::kZeroInitialized);
545#ifdef V8_ENABLE_CHECKS
551 static constexpr int kInternalFieldCount =
556 static void CheckCast(
Value* obj);
Definition: v8-array-buffer.h:384
static ArrayBufferView * Cast(Value *value)
Definition: v8-array-buffer.h:426
Local< ArrayBuffer > Buffer()
v8::MemorySpan< uint8_t > GetContents(v8::MemorySpan< uint8_t > storage)
size_t CopyContents(void *dest, size_t byte_length)
Definition: v8-array-buffer.h:153
virtual ~Allocator()=default
virtual void Free(void *data, size_t length)=0
static Allocator * NewDefaultAllocator()
virtual void * AllocateUninitialized(size_t length)=0
AllocationMode
Definition: v8-array-buffer.h:197
virtual void * Allocate(size_t length)=0
Definition: v8-array-buffer.h:136
static std::unique_ptr< BackingStore > NewBackingStore(void *data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, void *deleter_data)
size_t MaxByteLength() const
static std::unique_ptr< BackingStore > NewResizableBackingStore(size_t byte_length, size_t max_byte_length)
static Local< ArrayBuffer > New(Isolate *isolate, std::shared_ptr< BackingStore > backing_store)
static std::unique_ptr< BackingStore > NewBackingStore(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
bool IsDetachable() const
static Local< ArrayBuffer > New(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
size_t ByteLength() const
static MaybeLocal< ArrayBuffer > MaybeNew(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
Definition: v8-array-buffer.h:42
size_t MaxByteLength() const
size_t ByteLength() const
void(*)(void *data, size_t length, void *deleter_data) DeleterCallback
Definition: v8-array-buffer.h:105
bool IsResizableByUserJavaScript() const
Definition: v8-array-buffer.h:445
static Local< DataView > New(Local< SharedArrayBuffer > shared_array_buffer, size_t byte_offset, size_t length)
static DataView * Cast(Value *value)
Definition: v8-array-buffer.h:451
static Local< DataView > New(Local< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
Definition: v8-isolate.h:261
Definition: v8-local-handle.h:266
Definition: v8-local-handle.h:632
Definition: v8-maybe.h:32
Definition: v8-memory-span.h:64
Definition: v8-object.h:233
Definition: v8-array-buffer.h:466
static Local< SharedArrayBuffer > New(Isolate *isolate, std::shared_ptr< BackingStore > backing_store)
std::shared_ptr< BackingStore > GetBackingStore()
static std::unique_ptr< BackingStore > NewBackingStore(void *data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, void *deleter_data)
size_t ByteLength() const
size_t MaxByteLength() const
static Local< SharedArrayBuffer > New(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
static SharedArrayBuffer * Cast(Value *value)
Definition: v8-array-buffer.h:544
static std::unique_ptr< BackingStore > NewBackingStore(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
Definition: v8-value.h:32
Definition: v8-internal.h:1297
Definition: libplatform.h:15
void(*)(void *data, size_t length, void *deleter_data) BackingStoreDeleterCallback
Definition: v8-array-buffer.h:129
BackingStoreInitializationMode
Definition: v8-array-buffer.h:27
ArrayBufferCreationMode
Definition: v8-array-buffer.h:26
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
Definition: v8-array-buffer.h:23
#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
Definition: v8-array-buffer.h:377
#define V8_EXPORT
Definition: v8config.h:793
#define V8_INLINE
Definition: v8config.h:499
#define V8_DEPRECATED(message)
Definition: v8config.h:595
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:660