blob: 2be1008f4e8f3680d9a8b2632f45c4f2ed1bbd73 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file has been auto-generated from the Jinja2 template
// third_party/blink/renderer/bindings/templates/interface.cc.tmpl
// by the script code_generator_v8.py.
// DO NOT MODIFY!
// clang-format off
#include "third_party/blink/renderer/bindings/tests/results/core/v8_array_buffer_view.h"
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/bindings/core/v8/idl_types.h"
#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.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_data_view.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_dom_configuration.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_shared_array_buffer.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/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/runtime_call_stats.h"
#include "third_party/blink/renderer/platform/bindings/v8_object_constructor.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
#include "third_party/blink/renderer/platform/wtf/get_ptr.h"
namespace blink {
// Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
const WrapperTypeInfo V8ArrayBufferView::wrapperTypeInfo = {
gin::kEmbedderBlink,
nullptr,
nullptr,
"ArrayBufferView",
nullptr,
WrapperTypeInfo::kWrapperTypeObjectPrototype,
WrapperTypeInfo::kObjectClassId,
WrapperTypeInfo::kNotInheritFromActiveScriptWrappable,
};
#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__)
#pragma clang diagnostic pop
#endif
// This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestArrayBufferView.h.
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
// platform/bindings/ScriptWrappable.h.
const WrapperTypeInfo& TestArrayBufferView::wrapper_type_info_ = V8ArrayBufferView::wrapperTypeInfo;
// not [ActiveScriptWrappable]
static_assert(
!std::is_base_of<ActiveScriptWrappableBase, TestArrayBufferView>::value,
"TestArrayBufferView inherits from ActiveScriptWrappable<>, but is not specifying "
"[ActiveScriptWrappable] extended attribute in the IDL file. "
"Be consistent.");
static_assert(
std::is_same<decltype(&TestArrayBufferView::HasPendingActivity),
decltype(&ScriptWrappable::HasPendingActivity)>::value,
"TestArrayBufferView is overriding hasPendingActivity(), but is not specifying "
"[ActiveScriptWrappable] extended attribute in the IDL file. "
"Be consistent.");
TestArrayBufferView* V8ArrayBufferView::ToImpl(v8::Local<v8::Object> object) {
DCHECK(object->IsArrayBufferView());
ScriptWrappable* scriptWrappable = ToScriptWrappable(object);
if (scriptWrappable)
return scriptWrappable->ToImpl<TestArrayBufferView>();
if (object->IsInt8Array())
return V8Int8Array::ToImpl(object);
if (object->IsInt16Array())
return V8Int16Array::ToImpl(object);
if (object->IsInt32Array())
return V8Int32Array::ToImpl(object);
if (object->IsUint8Array())
return V8Uint8Array::ToImpl(object);
if (object->IsUint8ClampedArray())
return V8Uint8ClampedArray::ToImpl(object);
if (object->IsUint16Array())
return V8Uint16Array::ToImpl(object);
if (object->IsUint32Array())
return V8Uint32Array::ToImpl(object);
if (object->IsBigInt64Array())
return V8BigInt64Array::ToImpl(object);
if (object->IsBigUint64Array())
return V8BigUint64Array::ToImpl(object);
if (object->IsFloat32Array())
return V8Float32Array::ToImpl(object);
if (object->IsFloat64Array())
return V8Float64Array::ToImpl(object);
if (object->IsDataView())
return V8DataView::ToImpl(object);
NOTREACHED();
return 0;
}
TestArrayBufferView* V8ArrayBufferView::ToImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) {
return value->IsArrayBufferView() ? ToImpl(v8::Local<v8::Object>::Cast(value)) : nullptr;
}
TestArrayBufferView* NativeValueTraits<TestArrayBufferView>::NativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
TestArrayBufferView* nativeValue = V8ArrayBufferView::ToImplWithTypeCheck(isolate, value);
if (!nativeValue) {
exceptionState.ThrowTypeError(ExceptionMessages::FailedToConvertJSValue(
"ArrayBufferView"));
}
return nativeValue;
}
} // namespace blink