7#include "fxjs/cfx_v8_array_buffer_allocator.h"
9#include "core/fxcrt/fx_memory.h"
19void* CFX_V8ArrayBufferAllocator::
Allocate(size_t length) {
20 if (length > kMaxAllowedBytes)
22#ifdef V8_ENABLE_SANDBOX
24 wrapped_.reset(v8::ArrayBuffer::Allocator::NewDefaultAllocator());
26 return wrapped_->Allocate(length);
28 return FX_ArrayBufferAllocate(length);
33 if (length > kMaxAllowedBytes)
35#ifdef V8_ENABLE_SANDBOX
37 wrapped_.reset(v8::ArrayBuffer::Allocator::NewDefaultAllocator());
39 return wrapped_->AllocateUninitialized(length);
41 return FX_ArrayBufferAllocateUninitialized(length);
45void CFX_V8ArrayBufferAllocator::
Free(
void* data, size_t length) {
46#ifdef V8_ENABLE_SANDBOX
48 wrapped_->Free(data, length);
void Free(void *data, size_t length) override
void * AllocateUninitialized(size_t length) override
void * Allocate(size_t length) override
CFX_V8ArrayBufferAllocator()
~CFX_V8ArrayBufferAllocator() override
void FX_ArrayBufferFree(void *data)