chromium/third_party/blink/renderer/bindings/core/v8/frozen_array.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_FROZEN_ARRAY_H_
#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_FROZEN_ARRAY_H_

#include "third_party/blink/renderer/bindings/core/v8/idl_types.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/platform/bindings/frozen_array_base.h"
#include "third_party/blink/renderer/platform/heap/heap_traits.h"

namespace blink {

// FrozenArray<IDLType> implements IDL frozen array types. The instances of
// this class behave as an immutable object, and provide read-only access to
// the internal vector object.
//
// V8 wrapper objects for each world are created from the immutable internal
// vector object. It's guaranteed that, given a frozen_array,
//   ToV8Traits<IDLArray<IDLType>>::ToV8(script_state, frozen_array)
//   == ToV8Traits<IDLArray<IDLType>>::ToV8(script_state, frozen_array)
// i.e. repeated conversions from a Blink object to a V8 value return the same
// V8 value. (Note that IDLSequence<IDLType> doesn't support this equivalence.)
//
// About NativeValueTraits<FrozenArray<IDLType>>, see the class comment of
// `FrozenArrayBase`.
template <typename IDLType>
class FrozenArray final : public bindings::FrozenArrayBase {};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_FROZEN_ARRAY_H_