#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "gin/array_buffer.h"
#include <stddef.h>
#include <stdlib.h>
#include "base/bits.h"
#include "base/check_op.h"
#include "base/no_destructor.h"
#include "build/build_config.h"
#include "gin/per_isolate_data.h"
#include "partition_alloc/page_allocator.h"
#include "partition_alloc/partition_alloc.h"
#include "partition_alloc/partition_root.h"
#include "v8/include/v8-initialization.h"
#if BUILDFLAG(IS_POSIX)
#include <sys/mman.h>
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS …
#endif
#endif
namespace gin {
partition_alloc::PartitionRoot* ArrayBufferAllocator::partition_ = …;
void* ArrayBufferAllocator::Allocate(size_t length) { … }
void* ArrayBufferAllocator::AllocateUninitialized(size_t length) { … }
template <partition_alloc::AllocFlags flags>
void* ArrayBufferAllocator::AllocateInternal(size_t length) { … }
void ArrayBufferAllocator::Free(void* data, size_t length) { … }
ArrayBufferAllocator* ArrayBufferAllocator::SharedInstance() { … }
void ArrayBufferAllocator::InitializePartition() { … }
ArrayBuffer::ArrayBuffer() = default;
ArrayBuffer::ArrayBuffer(v8::Isolate* isolate, v8::Local<v8::ArrayBuffer> array)
: … { … }
ArrayBuffer::~ArrayBuffer() = default;
ArrayBuffer& ArrayBuffer::operator=(const ArrayBuffer& other) = default;
bool Converter<ArrayBuffer>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
ArrayBuffer* out) { … }
ArrayBufferView::ArrayBufferView()
: … { … }
ArrayBufferView::ArrayBufferView(v8::Isolate* isolate,
v8::Local<v8::ArrayBufferView> view)
: … { … }
ArrayBufferView::~ArrayBufferView() = default;
ArrayBufferView& ArrayBufferView::operator=(const ArrayBufferView& other) =
default;
bool Converter<ArrayBufferView>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
ArrayBufferView* out) { … }
namespace {
#ifdef V8_ENABLE_SANDBOX
class ArrayBufferSharedMemoryMapper : public base::SharedMemoryMapper { … };
#endif
}
base::SharedMemoryMapper* GetSharedMemoryMapperForArrayBuffers() { … }
}