blob: 058857dc62c11563385b4d3468345a11b9290dec [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 by code_generator_v8.py.
// DO NOT MODIFY!
// clang-format off
#include "V8TestCallbackFunctions.h"
#include "bindings/core/v8/AnyCallbackFunctionOptionalAnyArg.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/GeneratedCodeHelper.h"
#include "bindings/core/v8/LongCallbackFunction.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "bindings/core/v8/VoidCallbackFunction.h"
#include "core/dom/Document.h"
#include "core/dom/custom/V0CustomElementProcessingStack.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 V8TestCallbackFunctions::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestCallbackFunctions::domTemplate, V8TestCallbackFunctions::trace, V8TestCallbackFunctions::traceWrappers, 0, nullptr, "TestCallbackFunctions", 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 TestCallbackFunctions.h.
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
// bindings/core/v8/ScriptWrappable.h.
const WrapperTypeInfo& TestCallbackFunctions::s_wrapperTypeInfo = V8TestCallbackFunctions::wrapperTypeInfo;
// not [ActiveScriptWrappable]
static_assert(
!std::is_base_of<ActiveScriptWrappable, TestCallbackFunctions>::value,
"TestCallbackFunctions inherits from ActiveScriptWrappable, but is not specifying "
"[ActiveScriptWrappable] extended attribute in the IDL file. "
"Be consistent.");
static_assert(
std::is_same<decltype(&TestCallbackFunctions::hasPendingActivity),
decltype(&ScriptWrappable::hasPendingActivity)>::value,
"TestCallbackFunctions is overriding hasPendingActivity(), but is not specifying "
"[ActiveScriptWrappable] extended attribute in the IDL file. "
"Be consistent.");
namespace TestCallbackFunctionsV8Internal {
static void voidCallbackFunctionAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(holder);
v8SetReturnValueFast(info, impl->voidCallbackFunctionAttribute(), impl);
}
void voidCallbackFunctionAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::voidCallbackFunctionAttributeAttributeGetter(info);
}
static void voidCallbackFunctionAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(holder);
// Prepare the value to be set.
VoidCallbackFunction* cppValue = VoidCallbackFunction::create(ScriptState::current(info.GetIsolate()), v8::Local<v8::Function>::Cast(v8Value));
impl->setVoidCallbackFunctionAttribute(cppValue);
}
void voidCallbackFunctionAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Value> v8Value = info[0];
TestCallbackFunctionsV8Internal::voidCallbackFunctionAttributeAttributeSetter(v8Value, info);
}
static void anyCallbackFunctionOptionalAnyArgAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(holder);
v8SetReturnValueFast(info, impl->anyCallbackFunctionOptionalAnyArgAttribute(), impl);
}
void anyCallbackFunctionOptionalAnyArgAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::anyCallbackFunctionOptionalAnyArgAttributeAttributeGetter(info);
}
static void anyCallbackFunctionOptionalAnyArgAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(holder);
// Prepare the value to be set.
AnyCallbackFunctionOptionalAnyArg* cppValue = AnyCallbackFunctionOptionalAnyArg::create(ScriptState::current(info.GetIsolate()), v8::Local<v8::Function>::Cast(v8Value));
impl->setAnyCallbackFunctionOptionalAnyArgAttribute(cppValue);
}
void anyCallbackFunctionOptionalAnyArgAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Value> v8Value = info[0];
TestCallbackFunctionsV8Internal::anyCallbackFunctionOptionalAnyArgAttributeAttributeSetter(v8Value, info);
}
static void customElementsCallbacksReadonlyAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(holder);
v8SetReturnValueInt(info, impl->customElementsCallbacksReadonlyAttribute());
}
void customElementsCallbacksReadonlyAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::customElementsCallbacksReadonlyAttributeAttributeGetter(info);
}
static void returnCallbackFunctionMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(info.Holder());
v8SetReturnValue(info, impl->returnCallbackFunctionMethod());
}
void returnCallbackFunctionMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::returnCallbackFunctionMethodMethod(info);
}
static void returnCallbackFunctionMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(info.Holder());
v8SetReturnValue(info, impl->returnCallbackFunctionMethod2());
}
void returnCallbackFunctionMethod2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::returnCallbackFunctionMethod2Method(info);
}
static void voidMethodCallbackFunctionInArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodCallbackFunctionInArg", "TestCallbackFunctions", ExceptionMessages::notEnoughArguments(1, info.Length())));
return;
}
VoidCallbackFunction* voidCallbackFunctionArg;
if (!info[0]->IsFunction()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodCallbackFunctionInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;
}
voidCallbackFunctionArg = VoidCallbackFunction::create(ScriptState::current(info.GetIsolate()), v8::Local<v8::Function>::Cast(info[0]));
impl->voidMethodCallbackFunctionInArg(voidCallbackFunctionArg);
}
void voidMethodCallbackFunctionInArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::voidMethodCallbackFunctionInArgMethod(info);
}
static void voidMethodCallbackFunctionInArg2Method(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodCallbackFunctionInArg2", "TestCallbackFunctions", ExceptionMessages::notEnoughArguments(1, info.Length())));
return;
}
AnyCallbackFunctionOptionalAnyArg* anyCallbackFunctionOptionalAnyArgArg;
if (!info[0]->IsFunction()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodCallbackFunctionInArg2", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;
}
anyCallbackFunctionOptionalAnyArgArg = AnyCallbackFunctionOptionalAnyArg::create(ScriptState::current(info.GetIsolate()), v8::Local<v8::Function>::Cast(info[0]));
impl->voidMethodCallbackFunctionInArg2(anyCallbackFunctionOptionalAnyArgArg);
}
void voidMethodCallbackFunctionInArg2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::voidMethodCallbackFunctionInArg2Method(info);
}
static void voidMethodCallbackFunctionWithReturnValueInArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodCallbackFunctionWithReturnValueInArg", "TestCallbackFunctions", ExceptionMessages::notEnoughArguments(1, info.Length())));
return;
}
LongCallbackFunction* longCallbackFunctionArg;
if (!info[0]->IsFunction()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodCallbackFunctionWithReturnValueInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;
}
longCallbackFunctionArg = LongCallbackFunction::create(ScriptState::current(info.GetIsolate()), v8::Local<v8::Function>::Cast(info[0]));
impl->voidMethodCallbackFunctionWithReturnValueInArg(longCallbackFunctionArg);
}
void voidMethodCallbackFunctionWithReturnValueInArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::voidMethodCallbackFunctionWithReturnValueInArgMethod(info);
}
static void voidMethodOptionalCallbackFunctionInArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(info.Holder());
VoidCallbackFunction* voidCallbackFunctionArg;
int numArgsPassed = info.Length();
while (numArgsPassed > 0) {
if (!info[numArgsPassed - 1]->IsUndefined())
break;
--numArgsPassed;
}
if (UNLIKELY(numArgsPassed <= 0)) {
impl->voidMethodOptionalCallbackFunctionInArg();
return;
}
if (!info[0]->IsFunction()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodOptionalCallbackFunctionInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;
}
voidCallbackFunctionArg = VoidCallbackFunction::create(ScriptState::current(info.GetIsolate()), v8::Local<v8::Function>::Cast(info[0]));
impl->voidMethodOptionalCallbackFunctionInArg(voidCallbackFunctionArg);
}
void voidMethodOptionalCallbackFunctionInArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::voidMethodOptionalCallbackFunctionInArgMethod(info);
}
static void voidMethodNullableCallbackFunctionInArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodNullableCallbackFunctionInArg", "TestCallbackFunctions", ExceptionMessages::notEnoughArguments(1, info.Length())));
return;
}
Nullable<VoidCallbackFunction*> voidCallbackFunctionArg;
if (!info[0]->IsFunction() && !info[0]->IsNull()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodNullableCallbackFunctionInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;
}
voidCallbackFunctionArg = VoidCallbackFunction::create(ScriptState::current(info.GetIsolate()), v8::Local<v8::Function>::Cast(info[0]));
impl->voidMethodNullableCallbackFunctionInArg(voidCallbackFunctionArg);
}
void voidMethodNullableCallbackFunctionInArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::voidMethodNullableCallbackFunctionInArgMethod(info);
}
static void customElementCallbacksMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctions* impl = V8TestCallbackFunctions::toImpl(info.Holder());
V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
impl->customElementCallbacksMethod();
}
void customElementCallbacksMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestCallbackFunctionsV8Internal::customElementCallbacksMethodMethod(info);
}
} // namespace TestCallbackFunctionsV8Internal
const V8DOMConfiguration::AccessorConfiguration V8TestCallbackFunctionsAccessors[] = {
{"voidCallbackFunctionAttribute", TestCallbackFunctionsV8Internal::voidCallbackFunctionAttributeAttributeGetterCallback, TestCallbackFunctionsV8Internal::voidCallbackFunctionAttributeAttributeSetterCallback, 0, 0, nullptr, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"anyCallbackFunctionOptionalAnyArgAttribute", TestCallbackFunctionsV8Internal::anyCallbackFunctionOptionalAnyArgAttributeAttributeGetterCallback, TestCallbackFunctionsV8Internal::anyCallbackFunctionOptionalAnyArgAttributeAttributeSetterCallback, 0, 0, nullptr, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"customElementsCallbacksReadonlyAttribute", TestCallbackFunctionsV8Internal::customElementsCallbacksReadonlyAttributeAttributeGetterCallback, 0, 0, 0, nullptr, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
};
const V8DOMConfiguration::MethodConfiguration V8TestCallbackFunctionsMethods[] = {
{"returnCallbackFunctionMethod", TestCallbackFunctionsV8Internal::returnCallbackFunctionMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"returnCallbackFunctionMethod2", TestCallbackFunctionsV8Internal::returnCallbackFunctionMethod2MethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"voidMethodCallbackFunctionInArg", TestCallbackFunctionsV8Internal::voidMethodCallbackFunctionInArgMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"voidMethodCallbackFunctionInArg2", TestCallbackFunctionsV8Internal::voidMethodCallbackFunctionInArg2MethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"voidMethodCallbackFunctionWithReturnValueInArg", TestCallbackFunctionsV8Internal::voidMethodCallbackFunctionWithReturnValueInArgMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"voidMethodOptionalCallbackFunctionInArg", TestCallbackFunctionsV8Internal::voidMethodOptionalCallbackFunctionInArgMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"voidMethodNullableCallbackFunctionInArg", TestCallbackFunctionsV8Internal::voidMethodNullableCallbackFunctionInArgMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"customElementCallbacksMethod", TestCallbackFunctionsV8Internal::customElementCallbacksMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
};
static void installV8TestCallbackFunctionsTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate) {
// Initialize the interface object's template.
V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, V8TestCallbackFunctions::wrapperTypeInfo.interfaceName, v8::Local<v8::FunctionTemplate>(), V8TestCallbackFunctions::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.
V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestCallbackFunctionsAccessors, WTF_ARRAY_LENGTH(V8TestCallbackFunctionsAccessors));
V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestCallbackFunctionsMethods, WTF_ARRAY_LENGTH(V8TestCallbackFunctionsMethods));
}
v8::Local<v8::FunctionTemplate> V8TestCallbackFunctions::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) {
return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestCallbackFunctionsTemplate);
}
bool V8TestCallbackFunctions::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}
v8::Local<v8::Object> V8TestCallbackFunctions::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}
TestCallbackFunctions* V8TestCallbackFunctions::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) {
return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr;
}
} // namespace blink