// Copyright 2021 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef INCLUDE_V8_ARRAY_BUFFER_H_ #define INCLUDE_V8_ARRAY_BUFFER_H_ #include <stddef.h> #include <memory> #include "v8-local-handle.h" // NOLINT(build/include_directory) #include "v8-object.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory) namespace v8 { class SharedArrayBuffer; #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT // Defined using gn arg `v8_array_buffer_internal_field_count`. #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT … #endif enum class ArrayBufferCreationMode { … }; enum class BackingStoreInitializationMode { … }; /** * A wrapper around the backing store (i.e. the raw memory) of an array buffer. * See a document linked in http://crbug.com/v8/9908 for more information. * * The allocation and destruction of backing stores is generally managed by * V8. Clients should always use standard C++ memory ownership types (i.e. * std::unique_ptr and std::shared_ptr) to manage lifetimes of backing stores * properly, since V8 internal objects may alias backing stores. * * This object does not keep the underlying |ArrayBuffer::Allocator| alive by * default. Use Isolate::CreateParams::array_buffer_allocator_shared when * creating the Isolate to make it hold a reference to the allocator itself. */ class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase { … }; #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS) // Use v8::BackingStore::DeleterCallback instead. BackingStoreDeleterCallback; #endif /** * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). */ class V8_EXPORT ArrayBuffer : public Object { … }; #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT // Defined using gn arg `v8_array_buffer_view_internal_field_count`. #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT … #endif /** * A base class for an instance of one of "views" over ArrayBuffer, * including TypedArrays and DataView (ES6 draft 15.13). */ class V8_EXPORT ArrayBufferView : public Object { … }; /** * An instance of DataView constructor (ES6 draft 15.13.7). */ class V8_EXPORT DataView : public ArrayBufferView { … }; /** * An instance of the built-in SharedArrayBuffer constructor. */ class V8_EXPORT SharedArrayBuffer : public Object { … }; } // namespace v8 #endif // INCLUDE_V8_ARRAY_BUFFER_H_