Files
rk35xx-android14/external/pdfium/fxjs/cfx_v8_array_buffer_allocator.h
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

36 lines
1.1 KiB
C++

// Copyright 2021 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef FXJS_CFX_V8_ARRAY_BUFFER_ALLOCATOR_H_
#define FXJS_CFX_V8_ARRAY_BUFFER_ALLOCATOR_H_
#include <stddef.h>
#include <memory>
#include "v8/include/v8-array-buffer.h"
class CFX_V8ArrayBufferAllocator final : public v8::ArrayBuffer::Allocator {
public:
static const size_t kMaxAllowedBytes = 0x10000000;
CFX_V8ArrayBufferAllocator();
CFX_V8ArrayBufferAllocator(const CFX_V8ArrayBufferAllocator&) = delete;
CFX_V8ArrayBufferAllocator(CFX_V8ArrayBufferAllocator&&) = delete;
~CFX_V8ArrayBufferAllocator() override;
void* Allocate(size_t length) override;
void* AllocateUninitialized(size_t length) override;
void Free(void* data, size_t length) override;
#ifdef V8_ENABLE_SANDBOX
private:
std::unique_ptr<v8::ArrayBuffer::Allocator> wrapped_;
#endif // V8_ENABLE_SANDBOX
};
#endif // FXJS_CFX_V8_ARRAY_BUFFER_ALLOCATOR_H_