| // 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 by code_generator_v8.py. DO NOT MODIFY! |
| |
| #include "V8TestInterfaceOriginTrialEnabled.h" |
| |
| #include "bindings/core/v8/ExceptionState.h" |
| #include "bindings/core/v8/GeneratedCodeHelper.h" |
| #include "bindings/core/v8/V8DOMConfiguration.h" |
| #include "bindings/core/v8/V8ObjectConstructor.h" |
| #include "core/dom/Document.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| #include "wtf/GetPtr.h" |
| #include "wtf/RefPtr.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) && COMPILER(CLANG) |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wglobal-constructors" |
| #endif |
| const WrapperTypeInfo V8TestInterfaceOriginTrialEnabled::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceOriginTrialEnabled::domTemplate, V8TestInterfaceOriginTrialEnabled::trace, V8TestInterfaceOriginTrialEnabled::traceWrappers, 0, nullptr, "TestInterfaceOriginTrialEnabled", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromActiveScriptWrappable, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Independent }; |
| #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| #pragma clang diagnostic pop |
| #endif |
| |
| // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfaceOriginTrialEnabled.h. |
| // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
| // bindings/core/v8/ScriptWrappable.h. |
| const WrapperTypeInfo& TestInterfaceOriginTrialEnabled::s_wrapperTypeInfo = V8TestInterfaceOriginTrialEnabled::wrapperTypeInfo; |
| |
| // not [ActiveScriptWrappable] |
| static_assert( |
| !std::is_base_of<ActiveScriptWrappable, TestInterfaceOriginTrialEnabled>::value, |
| "TestInterfaceOriginTrialEnabled inherits from ActiveScriptWrappable, but is not specifying " |
| "[ActiveScriptWrappable] extended attribute in the IDL file. " |
| "Be consistent."); |
| static_assert( |
| std::is_same<decltype(&TestInterfaceOriginTrialEnabled::hasPendingActivity), |
| decltype(&ScriptWrappable::hasPendingActivity)>::value, |
| "TestInterfaceOriginTrialEnabled is overriding hasPendingActivity(), but is not specifying " |
| "[ActiveScriptWrappable] extended attribute in the IDL file. " |
| "Be consistent."); |
| |
| namespace TestInterfaceOriginTrialEnabledV8Internal { |
| |
| static void doubleAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterfaceOriginTrialEnabled* impl = V8TestInterfaceOriginTrialEnabled::toImpl(holder); |
| v8SetReturnValue(info, impl->doubleAttribute()); |
| } |
| |
| void doubleAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceOriginTrialEnabledV8Internal::doubleAttributeAttributeGetter(info); |
| } |
| |
| static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "doubleAttribute", "TestInterfaceOriginTrialEnabled", holder, info.GetIsolate()); |
| TestInterfaceOriginTrialEnabled* impl = V8TestInterfaceOriginTrialEnabled::toImpl(holder); |
| double cppValue = toRestrictedDouble(info.GetIsolate(), v8Value, exceptionState); |
| if (exceptionState.hadException()) |
| return; |
| impl->setDoubleAttribute(cppValue); |
| } |
| |
| void doubleAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TestInterfaceOriginTrialEnabledV8Internal::doubleAttributeAttributeSetter(v8Value, info); |
| } |
| |
| static void conditionalLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterfaceOriginTrialEnabled* impl = V8TestInterfaceOriginTrialEnabled::toImpl(holder); |
| v8SetReturnValueInt(info, impl->conditionalLongAttribute()); |
| } |
| |
| void conditionalLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceOriginTrialEnabledV8Internal::conditionalLongAttributeAttributeGetter(info); |
| } |
| |
| static void conditionalLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "conditionalLongAttribute", "TestInterfaceOriginTrialEnabled", holder, info.GetIsolate()); |
| TestInterfaceOriginTrialEnabled* impl = V8TestInterfaceOriginTrialEnabled::toImpl(holder); |
| int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState); |
| if (exceptionState.hadException()) |
| return; |
| impl->setConditionalLongAttribute(cppValue); |
| } |
| |
| void conditionalLongAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TestInterfaceOriginTrialEnabledV8Internal::conditionalLongAttributeAttributeSetter(v8Value, info); |
| } |
| |
| static void conditionalReadOnlyLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterfaceOriginTrialEnabled* impl = V8TestInterfaceOriginTrialEnabled::toImpl(holder); |
| v8SetReturnValueInt(info, impl->conditionalReadOnlyLongAttribute()); |
| } |
| |
| void conditionalReadOnlyLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceOriginTrialEnabledV8Internal::conditionalReadOnlyLongAttributeAttributeGetter(info); |
| } |
| |
| static void staticStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueString(info, TestInterfaceOriginTrialEnabled::staticStringAttribute(), info.GetIsolate()); |
| } |
| |
| void staticStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceOriginTrialEnabledV8Internal::staticStringAttributeAttributeGetter(info); |
| } |
| |
| static void staticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| V8StringResource<> cppValue = v8Value; |
| if (!cppValue.prepare()) |
| return; |
| TestInterfaceOriginTrialEnabled::setStaticStringAttribute(cppValue); |
| } |
| |
| void staticStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TestInterfaceOriginTrialEnabledV8Internal::staticStringAttributeAttributeSetter(v8Value, info); |
| } |
| |
| static void staticConditionalReadOnlyLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueInt(info, TestInterfaceOriginTrialEnabled::staticConditionalReadOnlyLongAttribute()); |
| } |
| |
| void staticConditionalReadOnlyLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceOriginTrialEnabledV8Internal::staticConditionalReadOnlyLongAttributeAttributeGetter(info); |
| } |
| |
| static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterfaceOriginTrialEnabled", "voidMethodDoubleArgFloatArg"); |
| |
| TestInterfaceOriginTrialEnabled* impl = V8TestInterfaceOriginTrialEnabled::toImpl(info.Holder()); |
| |
| if (UNLIKELY(info.Length() < 2)) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length())); |
| return; |
| } |
| |
| double doubleArg; |
| float floatArg; |
| doubleArg = toRestrictedDouble(info.GetIsolate(), info[0], exceptionState); |
| if (exceptionState.hadException()) |
| return; |
| |
| floatArg = toRestrictedFloat(info.GetIsolate(), info[1], exceptionState); |
| if (exceptionState.hadException()) |
| return; |
| |
| impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg); |
| } |
| |
| static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceOriginTrialEnabledV8Internal::voidMethodDoubleArgFloatArgMethod(info); |
| } |
| |
| static void voidMethodPartialOverload1Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceOriginTrialEnabled* impl = V8TestInterfaceOriginTrialEnabled::toImpl(info.Holder()); |
| |
| impl->voidMethodPartialOverload(); |
| } |
| |
| static void voidMethodPartialOverload2Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterfaceOriginTrialEnabled", "voidMethodPartialOverload"); |
| |
| TestInterfaceOriginTrialEnabled* impl = V8TestInterfaceOriginTrialEnabled::toImpl(info.Holder()); |
| |
| double doubleArg; |
| doubleArg = toRestrictedDouble(info.GetIsolate(), info[0], exceptionState); |
| if (exceptionState.hadException()) |
| return; |
| |
| impl->voidMethodPartialOverload(doubleArg); |
| } |
| |
| static void voidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| bool isArityError = false; |
| switch (std::min(1, info.Length())) { |
| case 0: |
| if (true) { |
| voidMethodPartialOverload1Method(info); |
| return; |
| } |
| break; |
| case 1: |
| if (true) { |
| voidMethodPartialOverload2Method(info); |
| return; |
| } |
| break; |
| default: |
| isArityError = true; |
| } |
| |
| ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterfaceOriginTrialEnabled", "voidMethodPartialOverload"); |
| |
| if (isArityError) { |
| } |
| exceptionState.throwTypeError("No function was found that matched the signature provided."); |
| } |
| |
| static void voidMethodPartialOverloadMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceOriginTrialEnabledV8Internal::voidMethodPartialOverloadMethod(info); |
| } |
| |
| } // namespace TestInterfaceOriginTrialEnabledV8Internal |
| |
| const V8DOMConfiguration::AccessorConfiguration V8TestInterfaceOriginTrialEnabledAccessors[] = { |
| {"doubleAttribute", TestInterfaceOriginTrialEnabledV8Internal::doubleAttributeAttributeGetterCallback, TestInterfaceOriginTrialEnabledV8Internal::doubleAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
| {"staticStringAttribute", TestInterfaceOriginTrialEnabledV8Internal::staticStringAttributeAttributeGetterCallback, TestInterfaceOriginTrialEnabledV8Internal::staticStringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder}, |
| }; |
| |
| const V8DOMConfiguration::MethodConfiguration V8TestInterfaceOriginTrialEnabledMethods[] = { |
| {"voidMethodDoubleArgFloatArg", TestInterfaceOriginTrialEnabledV8Internal::voidMethodDoubleArgFloatArgMethodCallback, 0, 2, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"voidMethodPartialOverload", TestInterfaceOriginTrialEnabledV8Internal::voidMethodPartialOverloadMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| }; |
| |
| static void installV8TestInterfaceOriginTrialEnabledTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate) |
| { |
| // Initialize the interface object's template. |
| V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, V8TestInterfaceOriginTrialEnabled::wrapperTypeInfo.interfaceName, v8::Local<v8::FunctionTemplate>(), V8TestInterfaceOriginTrialEnabled::internalFieldCount); |
| v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate); |
| ALLOW_UNUSED_LOCAL(signature); |
| v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTemplate(); |
| ALLOW_UNUSED_LOCAL(instanceTemplate); |
| v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->PrototypeTemplate(); |
| ALLOW_UNUSED_LOCAL(prototypeTemplate); |
| // Register DOM constants, attributes and operations. |
| const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceOriginTrialEnabledConstants[] = { |
| {"UNSIGNED_LONG", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong}, |
| {"CONST_JAVASCRIPT", 1, 0, V8DOMConfiguration::ConstantTypeShort}, |
| }; |
| V8DOMConfiguration::installConstants(isolate, interfaceTemplate, prototypeTemplate, V8TestInterfaceOriginTrialEnabledConstants, WTF_ARRAY_LENGTH(V8TestInterfaceOriginTrialEnabledConstants)); |
| static_assert(0 == TestInterfaceOriginTrialEnabled::kUnsignedLong, "the value of TestInterfaceOriginTrialEnabled_kUnsignedLong does not match with implementation"); |
| static_assert(1 == TestInterfaceOriginTrialEnabled::kConstJavascript, "the value of TestInterfaceOriginTrialEnabled_kConstJavascript does not match with implementation"); |
| V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestInterfaceOriginTrialEnabledAccessors, WTF_ARRAY_LENGTH(V8TestInterfaceOriginTrialEnabledAccessors)); |
| V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestInterfaceOriginTrialEnabledMethods, WTF_ARRAY_LENGTH(V8TestInterfaceOriginTrialEnabledMethods)); |
| |
| if (RuntimeEnabledFeatures::featureNameEnabled()) { |
| const V8DOMConfiguration::AccessorConfiguration accessorconditionalReadOnlyLongAttributeConfiguration = \ |
| {"conditionalReadOnlyLongAttribute", TestInterfaceOriginTrialEnabledV8Internal::conditionalReadOnlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}; |
| V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorconditionalReadOnlyLongAttributeConfiguration); |
| const V8DOMConfiguration::AccessorConfiguration accessorstaticConditionalReadOnlyLongAttributeConfiguration = \ |
| {"staticConditionalReadOnlyLongAttribute", TestInterfaceOriginTrialEnabledV8Internal::staticConditionalReadOnlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder}; |
| V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorstaticConditionalReadOnlyLongAttributeConfiguration); |
| const V8DOMConfiguration::AccessorConfiguration accessorconditionalLongAttributeConfiguration = \ |
| {"conditionalLongAttribute", TestInterfaceOriginTrialEnabledV8Internal::conditionalLongAttributeAttributeGetterCallback, TestInterfaceOriginTrialEnabledV8Internal::conditionalLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}; |
| V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorconditionalLongAttributeConfiguration); |
| } |
| } |
| |
| v8::Local<v8::FunctionTemplate> V8TestInterfaceOriginTrialEnabled::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) |
| { |
| return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceOriginTrialEnabledTemplate); |
| } |
| |
| bool V8TestInterfaceOriginTrialEnabled::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) |
| { |
| return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); |
| } |
| |
| v8::Local<v8::Object> V8TestInterfaceOriginTrialEnabled::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) |
| { |
| return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); |
| } |
| |
| TestInterfaceOriginTrialEnabled* V8TestInterfaceOriginTrialEnabled::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) |
| { |
| return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr; |
| } |
| |
| } // namespace blink |