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); }
104 static void EmptyDeleter(
void* data,
size_t length,
void* deleter_data);
114#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
161 virtual void Free(
void* data,
size_t length) = 0;
200 Isolate* isolate,
size_t byte_length,
202 BackingStoreInitializationMode::kZeroInitialized);
211 Isolate* isolate,
size_t byte_length,
213 BackingStoreInitializationMode::kZeroInitialized);
228 std::shared_ptr<BackingStore> backing_store);
241 Isolate* isolate,
size_t byte_length,
243 BackingStoreInitializationMode::kZeroInitialized);
269 size_t byte_length,
size_t max_byte_length);
288 "Use the version which takes a key parameter (passing a null handle is "
322 bool IsResizableByUserJavaScript() const;
331#ifdef V8_ENABLE_CHECKS
337 static constexpr int kInternalFieldCount =
339 static constexpr int kEmbedderFieldCount = kInternalFieldCount;
343 static void CheckCast(
Value* obj);
346#ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
348#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
398#ifdef V8_ENABLE_CHECKS
404 static constexpr int kInternalFieldCount =
406 static const int kEmbedderFieldCount = kInternalFieldCount;
410 static void CheckCast(
Value* obj);
419 size_t byte_offset,
size_t length);
421 size_t byte_offset,
size_t length);
423#ifdef V8_ENABLE_CHECKS
426 return static_cast<DataView*
>(value);
431 static void CheckCast(
Value* obj);
456 Isolate* isolate,
size_t byte_length,
458 BackingStoreInitializationMode::kZeroInitialized);
473 Isolate* isolate, std::shared_ptr<BackingStore> backing_store);
486 Isolate* isolate,
size_t byte_length,
488 BackingStoreInitializationMode::kZeroInitialized);
516#ifdef V8_ENABLE_CHECKS
522 static constexpr int kInternalFieldCount =
527 static void CheckCast(
Value* obj);
Definition: v8-array-buffer.h:355
static ArrayBufferView * Cast(Value *value)
Definition: v8-array-buffer.h:397
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:141
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:168
virtual void * Allocate(size_t length)=0
Definition: v8-array-buffer.h:124
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:93
static void EmptyDeleter(void *data, size_t length, void *deleter_data)
bool IsResizableByUserJavaScript() const
Definition: v8-array-buffer.h:416
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:422
static Local< DataView > New(Local< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
Definition: v8-isolate.h:273
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:437
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:515
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:1340
Definition: libplatform.h:15
void(*)(void *data, size_t length, void *deleter_data) BackingStoreDeleterCallback
Definition: v8-array-buffer.h:117
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:348
#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