summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc89
1 files changed, 38 insertions, 51 deletions
diff --git a/chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc b/chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc
index ac23996a992..abe04a2c466 100644
--- a/chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc
+++ b/chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc
@@ -5,18 +5,6 @@
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_array_buffer.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_big_int_64_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_big_uint_64_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_float32_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_float64_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_int16_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_int32_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_int8_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_uint16_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_uint32_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_uint8_array.h"
-#include "third_party/blink/renderer/bindings/core/v8/v8_uint8_clamped_array.h"
#include "third_party/blink/renderer/platform/bindings/dom_data_store.h"
namespace blink {
@@ -51,47 +39,46 @@ v8::MaybeLocal<v8::Value> DOMTypedArray<T, V8TypedArray, clamped>::Wrap(
wrapper);
}
-// TODO(tasak): The following traits should be auto-generated by binding
-// script and should be placed in bindings/core/v8/V8*Array.h.
-template <typename ArrayType>
-struct DOMTypedArrayTraits {};
+#define DOMTYPEDARRAY_FOREACH_VIEW_TYPE(V) \
+ V(int8_t, Int8, false) \
+ V(int16_t, Int16, false) \
+ V(int32_t, Int32, false) \
+ V(uint8_t, Uint8, false) \
+ V(uint8_t, Uint8Clamped, true) \
+ V(uint16_t, Uint16, false) \
+ V(uint32_t, Uint32, false) \
+ V(float, Float32, false) \
+ V(double, Float64, false) \
+ V(int64_t, BigInt64, false) \
+ V(uint64_t, BigUint64, false)
-#define DEFINE_DOMTYPEDARRAY_TRAITS(ArrayType, V8BindingType) \
- template <> \
- struct DOMTypedArrayTraits<ArrayType> { \
- typedef V8BindingType Type; \
- }
-
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMInt8Array, V8Int8Array);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMInt16Array, V8Int16Array);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMInt32Array, V8Int32Array);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMUint8Array, V8Uint8Array);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMUint8ClampedArray, V8Uint8ClampedArray);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMUint16Array, V8Uint16Array);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMUint32Array, V8Uint32Array);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMBigInt64Array, V8BigInt64Array);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMBigUint64Array, V8BigUint64Array);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMFloat32Array, V8Float32Array);
-DEFINE_DOMTYPEDARRAY_TRAITS(DOMFloat64Array, V8Float64Array);
+#define DOMTYPEDARRAY_DEFINE_WRAPPERTYPEINFO(val_t, Type, clamped) \
+ template <> \
+ const WrapperTypeInfo \
+ DOMTypedArray<val_t, v8::Type##Array, clamped>::wrapper_type_info_body_{ \
+ gin::kEmbedderBlink, \
+ nullptr, \
+ nullptr, \
+ #Type "Array", \
+ nullptr, \
+ WrapperTypeInfo::kWrapperTypeObjectPrototype, \
+ WrapperTypeInfo::kObjectClassId, \
+ WrapperTypeInfo::kNotInheritFromActiveScriptWrappable, \
+ WrapperTypeInfo::kIdlBufferSourceType, \
+ }; \
+ template <> \
+ const WrapperTypeInfo& DOMTypedArray<val_t, v8::Type##Array, \
+ clamped>::wrapper_type_info_ = \
+ DOMTypedArray<val_t, v8::Type##Array, clamped>::wrapper_type_info_body_;
+DOMTYPEDARRAY_FOREACH_VIEW_TYPE(DOMTYPEDARRAY_DEFINE_WRAPPERTYPEINFO)
+#undef DOMTYPEDARRAY_DEFINE_WRAPPERTYPEINFO
-template <typename T, typename V8TypedArray, bool clamped>
-const WrapperTypeInfo*
-DOMTypedArray<T, V8TypedArray, clamped>::GetWrapperTypeInfo() const {
- return DOMTypedArrayTraits<
- DOMTypedArray<T, V8TypedArray, clamped>>::Type::GetWrapperTypeInfo();
-}
+#define DOMTYPEDARRAY_EXPLICITLY_INSTANTIATE(val_t, Type, clamped) \
+ template class CORE_TEMPLATE_EXPORT \
+ DOMTypedArray<val_t, v8::Type##Array, clamped>;
+DOMTYPEDARRAY_FOREACH_VIEW_TYPE(DOMTYPEDARRAY_EXPLICITLY_INSTANTIATE)
+#undef DOMTYPEDARRAY_EXPLICITLY_INSTANTIATE
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<int8_t, v8::Int8Array>;
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<int16_t, v8::Int16Array>;
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<int32_t, v8::Int32Array>;
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<uint8_t, v8::Uint8Array>;
-template class CORE_TEMPLATE_EXPORT
- DOMTypedArray<uint8_t, v8::Uint8ClampedArray, /*clamped=*/true>;
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<uint16_t, v8::Uint16Array>;
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<uint32_t, v8::Uint32Array>;
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<int64_t, v8::BigInt64Array>;
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<uint64_t, v8::BigUint64Array>;
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<float, v8::Float32Array>;
-template class CORE_TEMPLATE_EXPORT DOMTypedArray<double, v8::Float64Array>;
+#undef DOMTYPEDARRAY_FOREACH_VIEW_TYPE
} // namespace blink