Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfx_v8_array_buffer_allocator.h
Go to the documentation of this file.
1// Copyright 2021 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef FXJS_CFX_V8_ARRAY_BUFFER_ALLOCATOR_H_
8#define FXJS_CFX_V8_ARRAY_BUFFER_ALLOCATOR_H_
9
10#include <stddef.h>
11
12#include <memory>
13
14#include "v8/include/v8-array-buffer.h"
15
16class CFX_V8ArrayBufferAllocator final : public v8::ArrayBuffer::Allocator {
17 public:
18 static const size_t kMaxAllowedBytes = 0x10000000;
19
21 CFX_V8ArrayBufferAllocator(const CFX_V8ArrayBufferAllocator&) = delete;
22 CFX_V8ArrayBufferAllocator(CFX_V8ArrayBufferAllocator&&) = delete;
24
25 void* Allocate(size_t length) override;
26 void* AllocateUninitialized(size_t length) override;
27 void Free(void* data, size_t length) override;
28
29#ifdef V8_ENABLE_SANDBOX
30 private:
31 std::unique_ptr<v8::ArrayBuffer::Allocator> wrapped_;
32#endif // V8_ENABLE_SANDBOX
33};
34
35#endif // FXJS_CFX_V8_ARRAY_BUFFER_ALLOCATOR_H_
void Free(void *data, size_t length) override
void * AllocateUninitialized(size_t length) override
CFX_V8ArrayBufferAllocator(CFX_V8ArrayBufferAllocator &&)=delete
void * Allocate(size_t length) override
CFX_V8ArrayBufferAllocator(const CFX_V8ArrayBufferAllocator &)=delete
~CFX_V8ArrayBufferAllocator() override
void FX_ArrayBufferFree(void *data)