| // 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 "config.h" |
| #if ENABLE(CONDITION) |
| #include "V8TestInterface5.h" |
| |
| #include "bindings/core/v8/ExceptionState.h" |
| #include "bindings/core/v8/ScriptState.h" |
| #include "bindings/core/v8/ScriptValue.h" |
| #include "bindings/core/v8/V8DOMConfiguration.h" |
| #include "bindings/core/v8/V8Iterator.h" |
| #include "bindings/core/v8/V8ObjectConstructor.h" |
| #include "bindings/core/v8/V8TestInterfaceEmpty.h" |
| #include "bindings/modules/v8/UnionTypesModules.h" |
| #include "bindings/modules/v8/V8TestInterface5.h" |
| #include "core/dom/ContextFeatures.h" |
| #include "core/dom/Document.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| #include "platform/TraceEvent.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 V8TestInterface5::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface5::domTemplate, V8TestInterface5::refObject, V8TestInterface5::derefObject, V8TestInterface5::trace, V8TestInterface5::toActiveDOMObject, V8TestInterface5::visitDOMWrapper, V8TestInterface5::preparePrototypeObject, V8TestInterface5::installConditionallyEnabledProperties, "TestInterface5", &V8TestInterfaceEmpty::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Dependent, WrapperTypeInfo::RefCountedObject }; |
| #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| #pragma clang diagnostic pop |
| #endif |
| |
| // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterface5Implementation.h. |
| // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
| // bindings/core/v8/ScriptWrappable.h. |
| const WrapperTypeInfo& TestInterface5Implementation::s_wrapperTypeInfo = V8TestInterface5::wrapperTypeInfo; |
| |
| namespace TestInterface5ImplementationV8Internal { |
| |
| template<class CallbackInfo> |
| static bool TestInterface5ImplementationCreateDataProperty(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const CallbackInfo& info) |
| { |
| ASSERT(info.This()->IsObject()); |
| return v8CallBoolean(v8::Local<v8::Object>::Cast(info.This())->CreateDataProperty(info.GetIsolate()->GetCurrentContext(), name, v8Value)); |
| } |
| |
| static void TestInterface5ImplementationConstructorAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| do { |
| v8::Local<v8::Value> data = info.Data(); |
| ASSERT(data->IsExternal()); |
| V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext()); |
| if (!perContextData) |
| break; |
| const WrapperTypeInfo* wrapperTypeInfo = WrapperTypeInfo::unwrap(data); |
| if (!wrapperTypeInfo) |
| break; |
| TestInterface5ImplementationCreateDataProperty(v8String(info.GetIsolate(), wrapperTypeInfo->interfaceName), v8Value, info); |
| } while (false); // do ... while (false) just for use of break |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void testInterfaceAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| v8SetReturnValueFast(info, WTF::getPtr(impl->testInterfaceAttribute()), impl); |
| } |
| |
| static void testInterfaceAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void testInterfaceAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "testInterfaceAttribute", "TestInterface5", holder, info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| TestInterface5Implementation* cppValue = V8TestInterface5::toImplWithTypeCheck(info.GetIsolate(), v8Value); |
| if (!cppValue) { |
| exceptionState.throwTypeError("The provided value is not of type 'TestInterface5'."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| impl->setTestInterfaceAttribute(WTF::getPtr(cppValue)); |
| } |
| |
| static void testInterfaceAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void testInterfaceConstructorAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "testInterfaceConstructorAttribute"); |
| TestInterface5ImplementationCreateDataProperty(propertyName, v8Value, info); |
| } |
| |
| static void testInterfaceConstructorAttributeAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::testInterfaceConstructorAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void doubleAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| v8SetReturnValue(info, impl->doubleAttribute()); |
| } |
| |
| static void doubleAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterface5ImplementationV8Internal::doubleAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| 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", "TestInterface5", holder, info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| double cppValue = toRestrictedDouble(info.GetIsolate(), v8Value, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| impl->setDoubleAttribute(cppValue); |
| } |
| |
| static void doubleAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::doubleAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void floatAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| v8SetReturnValue(info, impl->floatAttribute()); |
| } |
| |
| static void floatAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterface5ImplementationV8Internal::floatAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "floatAttribute", "TestInterface5", holder, info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| float cppValue = toRestrictedFloat(info.GetIsolate(), v8Value, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| impl->setFloatAttribute(cppValue); |
| } |
| |
| static void floatAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::floatAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void unrestrictedDoubleAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| v8SetReturnValue(info, impl->unrestrictedDoubleAttribute()); |
| } |
| |
| static void unrestrictedDoubleAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedDoubleAttribute", "TestInterface5", holder, info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| double cppValue = toDouble(info.GetIsolate(), v8Value, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| impl->setUnrestrictedDoubleAttribute(cppValue); |
| } |
| |
| static void unrestrictedDoubleAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void unrestrictedFloatAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| v8SetReturnValue(info, impl->unrestrictedFloatAttribute()); |
| } |
| |
| static void unrestrictedFloatAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedFloatAttribute", "TestInterface5", holder, info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| float cppValue = toFloat(info.GetIsolate(), v8Value, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| impl->setUnrestrictedFloatAttribute(cppValue); |
| } |
| |
| static void unrestrictedFloatAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void staticStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueString(info, TestInterface5Implementation::staticStringAttribute(), info.GetIsolate()); |
| } |
| |
| static void staticStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterface5ImplementationV8Internal::staticStringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void staticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| V8StringResource<> cppValue = v8Value; |
| if (!cppValue.prepare()) |
| return; |
| TestInterface5Implementation::setStaticStringAttribute(cppValue); |
| } |
| |
| static void staticStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::staticStringAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void alwaysExposedAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| v8SetReturnValueInt(info, impl->alwaysExposedAttribute()); |
| } |
| |
| static void alwaysExposedAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void alwaysExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "alwaysExposedAttribute", "TestInterface5", holder, info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| impl->setAlwaysExposedAttribute(cppValue); |
| } |
| |
| static void alwaysExposedAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void workerExposedAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| v8SetReturnValueInt(info, impl->workerExposedAttribute()); |
| } |
| |
| static void workerExposedAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void workerExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "workerExposedAttribute", "TestInterface5", holder, info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| impl->setWorkerExposedAttribute(cppValue); |
| } |
| |
| static void workerExposedAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowExposedAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| v8SetReturnValueInt(info, impl->windowExposedAttribute()); |
| } |
| |
| static void windowExposedAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "windowExposedAttribute", "TestInterface5", holder, info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); |
| int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| impl->setWindowExposedAttribute(cppValue); |
| } |
| |
| static void windowExposedAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8::Local<v8::Value> v8Value = info[0]; |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| if (UNLIKELY(info.Length() < 1)) { |
| V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "voidMethodTestInterfaceEmptyArg", "TestInterface5", 1, info.Length()), info.GetIsolate()); |
| return; |
| } |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| TestInterfaceEmpty* testInterfaceEmptyArg; |
| { |
| testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[0]); |
| if (!testInterfaceEmptyArg) { |
| V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodTestInterfaceEmptyArg", "TestInterface5", "parameter 1 is not of type 'TestInterfaceEmpty'.")); |
| return; |
| } |
| } |
| impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); |
| } |
| |
| static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodDoubleArgFloatArg", "TestInterface5", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 2)) { |
| setMinimumArityTypeError(exceptionState, 2, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| double doubleArg; |
| float floatArg; |
| { |
| doubleArg = toRestrictedDouble(info.GetIsolate(), info[0], exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| floatArg = toRestrictedFloat(info.GetIsolate(), info[1], exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| } |
| impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg); |
| } |
| |
| static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface5", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 2)) { |
| setMinimumArityTypeError(exceptionState, 2, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| double unrestrictedDoubleArg; |
| float unrestrictedFloatArg; |
| { |
| unrestrictedDoubleArg = toDouble(info.GetIsolate(), info[0], exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| unrestrictedFloatArg = toFloat(info.GetIsolate(), info[1], exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| } |
| impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDoubleArg, unrestrictedFloatArg); |
| } |
| |
| static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| impl->voidMethod(); |
| } |
| |
| static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::voidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| impl->voidMethod(); |
| } |
| |
| static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::voidMethodMethodForMainWorld(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void alwaysExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| impl->alwaysExposedMethod(); |
| } |
| |
| static void alwaysExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::alwaysExposedMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void workerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| impl->workerExposedMethod(); |
| } |
| |
| static void workerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::workerExposedMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| impl->windowExposedMethod(); |
| } |
| |
| static void windowExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::windowExposedMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void alwaysExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation::alwaysExposedStaticMethod(); |
| } |
| |
| static void alwaysExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::alwaysExposedStaticMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void workerExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation::workerExposedStaticMethod(); |
| } |
| |
| static void workerExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::workerExposedStaticMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation::windowExposedStaticMethod(); |
| } |
| |
| static void windowExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::windowExposedStaticMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowAndServiceWorkerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| impl->windowAndServiceWorkerExposedMethod(); |
| } |
| |
| static void windowAndServiceWorkerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodBooleanOrDOMStringArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodBooleanOrDOMStringArg", "TestInterface5", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 1)) { |
| setMinimumArityTypeError(exceptionState, 1, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| BooleanOrString arg; |
| { |
| V8BooleanOrString::toImpl(info.GetIsolate(), info[0], arg, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| } |
| impl->voidMethodBooleanOrDOMStringArg(arg); |
| } |
| |
| static void voidMethodBooleanOrDOMStringArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::voidMethodBooleanOrDOMStringArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodDoubleOrDOMStringArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodDoubleOrDOMStringArg", "TestInterface5", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 1)) { |
| setMinimumArityTypeError(exceptionState, 1, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| DoubleOrString arg; |
| { |
| V8DoubleOrString::toImpl(info.GetIsolate(), info[0], arg, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| } |
| impl->voidMethodDoubleOrDOMStringArg(arg); |
| } |
| |
| static void voidMethodDoubleOrDOMStringArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::voidMethodDoubleOrDOMStringArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void keysMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "keys", "TestInterface5", info.Holder(), info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| RawPtr<Iterator> result = impl->keysForBinding(scriptState, exceptionState); |
| if (exceptionState.hadException()) { |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| v8SetReturnValue(info, result.release()); |
| } |
| |
| static void keysMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::keysMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void valuesMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "values", "TestInterface5", info.Holder(), info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| RawPtr<Iterator> result = impl->valuesForBinding(scriptState, exceptionState); |
| if (exceptionState.hadException()) { |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| v8SetReturnValue(info, result.release()); |
| } |
| |
| static void valuesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::valuesMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void entriesMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "entries", "TestInterface5", info.Holder(), info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| RawPtr<Iterator> result = impl->entriesForBinding(scriptState, exceptionState); |
| if (exceptionState.hadException()) { |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| v8SetReturnValue(info, result.release()); |
| } |
| |
| static void entriesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::entriesMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void forEachMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "forEach", "TestInterface5", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 1)) { |
| setMinimumArityTypeError(exceptionState, 1, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| ScriptValue callback; |
| ScriptValue thisArg; |
| { |
| if (!info[0]->IsFunction()) { |
| exceptionState.throwTypeError("The callback provided as parameter 1 is not a function."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]); |
| thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]); |
| } |
| ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.This()), callback, thisArg, exceptionState); |
| if (exceptionState.hadException()) { |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| } |
| |
| static void forEachMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::forEachMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| v8SetReturnValueString(info, impl->toString(), info.GetIsolate()); |
| } |
| |
| static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::toStringMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterface5", info.Holder(), info.GetIsolate()); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState); |
| if (exceptionState.hadException()) { |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| v8SetReturnValue(info, result.release()); |
| } |
| |
| static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterface5ImplementationV8Internal::iteratorMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| String result = impl->anonymousIndexedGetter(index); |
| if (result.isNull()) |
| return; |
| v8SetReturnValueString(info, result, info.GetIsolate()); |
| } |
| |
| static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| TestInterface5ImplementationV8Internal::indexedPropertyGetter(index, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| V8StringResource<> propertyValue = v8Value; |
| if (!propertyValue.prepare()) |
| return; |
| bool result = impl->anonymousIndexedSetter(index, propertyValue); |
| if (!result) |
| return; |
| v8SetReturnValue(info, v8Value); |
| } |
| |
| static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| DeleteResult result = impl->anonymousIndexedDeleter(index); |
| if (result != DeleteUnknownProperty) |
| return v8SetReturnValueBool(info, result == DeleteSuccess); |
| } |
| |
| static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| auto nameString = name.As<v8::String>(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| AtomicString propertyName = toCoreAtomicString(nameString); |
| String result = impl->anonymousNamedGetter(propertyName); |
| if (result.isNull()) |
| return; |
| v8SetReturnValueString(info, result, info.GetIsolate()); |
| } |
| |
| static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterface5ImplementationV8Internal::namedPropertyGetter(name, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| auto nameString = name.As<v8::String>(); |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| V8StringResource<> propertyName(nameString); |
| if (!propertyName.prepare()) |
| return; |
| V8StringResource<> propertyValue = v8Value; |
| if (!propertyValue.prepare()) |
| return; |
| bool result = impl->anonymousNamedSetter(propertyName, propertyValue); |
| if (!result) |
| return; |
| v8SetReturnValue(info, v8Value); |
| } |
| |
| static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterface5ImplementationV8Internal::namedPropertySetter(name, v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); |
| v8::String::Utf8Value namedProperty(name); |
| ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface5", info.Holder(), info.GetIsolate()); |
| bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| if (!result) |
| return; |
| v8SetReturnValueInt(info, v8::None); |
| } |
| |
| static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterface5ImplementationV8Internal::namedPropertyQuery(name, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); |
| DeleteResult result = impl->anonymousNamedDeleter(propertyName); |
| if (result != DeleteUnknownProperty) |
| return v8SetReturnValueBool(info, result == DeleteSuccess); |
| } |
| |
| static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterface5ImplementationV8Internal::namedPropertyDeleter(name, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) |
| { |
| TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| Vector<String> names; |
| ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInterface5", info.Holder(), info.GetIsolate()); |
| impl->namedPropertyEnumerator(names, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| v8::Local<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size()); |
| for (size_t i = 0; i < names.size(); ++i) { |
| if (!v8CallBoolean(v8names->Set(info.GetIsolate()->GetCurrentContext(), v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIsolate(), names[i])))) |
| return; |
| } |
| v8SetReturnValue(info, v8names); |
| } |
| |
| static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterface5ImplementationV8Internal::namedPropertyEnumerator(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| } // namespace TestInterface5ImplementationV8Internal |
| |
| void V8TestInterface5::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent<v8::Object>& wrapper) |
| { |
| TestInterface5Implementation* impl = scriptWrappable->toImpl<TestInterface5Implementation>(); |
| v8::Local<v8::Object> context = v8::Local<v8::Object>::New(isolate, wrapper); |
| v8::Context::Scope scope(context->CreationContext()); |
| TestInterface5Implementation* referencedName = impl->referencedName(); |
| if (referencedName) { |
| if (DOMDataStore::containsWrapper(referencedName, isolate)) |
| DOMDataStore::setWrapperReference(wrapper, referencedName, isolate); |
| } |
| } |
| |
| // Suppress warning: global constructors, because AttributeConfiguration 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 V8DOMConfiguration::AttributeConfiguration V8TestInterface5Attributes[] = { |
| {"testInterfaceConstructorAttribute", v8ConstructorAttributeGetter, TestInterface5ImplementationV8Internal::testInterfaceConstructorAttributeAttributeSetterCallback, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestInterface5::wrapperTypeInfo), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder}, |
| }; |
| #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| #pragma clang diagnostic pop |
| #endif |
| |
| const V8DOMConfiguration::AccessorConfiguration V8TestInterface5Accessors[] = { |
| {"testInterfaceAttribute", TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
| {"doubleAttribute", TestInterface5ImplementationV8Internal::doubleAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::doubleAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
| {"floatAttribute", TestInterface5ImplementationV8Internal::floatAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::floatAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
| {"unrestrictedDoubleAttribute", TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
| {"unrestrictedFloatAttribute", TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
| {"staticStringAttribute", TestInterface5ImplementationV8Internal::staticStringAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::staticStringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder}, |
| {"alwaysExposedAttribute", TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
| }; |
| |
| const V8DOMConfiguration::MethodConfiguration V8TestInterface5Methods[] = { |
| {"voidMethodTestInterfaceEmptyArg", TestInterface5ImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"voidMethodDoubleArgFloatArg", TestInterface5ImplementationV8Internal::voidMethodDoubleArgFloatArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", TestInterface5ImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"voidMethod", TestInterface5ImplementationV8Internal::voidMethodMethodCallback, TestInterface5ImplementationV8Internal::voidMethodMethodCallbackForMainWorld, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"alwaysExposedMethod", TestInterface5ImplementationV8Internal::alwaysExposedMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"voidMethodBooleanOrDOMStringArg", TestInterface5ImplementationV8Internal::voidMethodBooleanOrDOMStringArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"voidMethodDoubleOrDOMStringArg", TestInterface5ImplementationV8Internal::voidMethodDoubleOrDOMStringArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"keys", TestInterface5ImplementationV8Internal::keysMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"values", TestInterface5ImplementationV8Internal::valuesMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"entries", TestInterface5ImplementationV8Internal::entriesMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| {"forEach", TestInterface5ImplementationV8Internal::forEachMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| }; |
| |
| static void installV8TestInterface5Template(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) |
| { |
| functionTemplate->ReadOnlyPrototype(); |
| |
| v8::Local<v8::Signature> defaultSignature; |
| if (!RuntimeEnabledFeatures::featureNameEnabled()) |
| defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterface5", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface5::internalFieldCount, 0, 0, 0, 0, 0, 0); |
| else |
| defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterface5", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface5::internalFieldCount, |
| V8TestInterface5Attributes, WTF_ARRAY_LENGTH(V8TestInterface5Attributes), |
| V8TestInterface5Accessors, WTF_ARRAY_LENGTH(V8TestInterface5Accessors), |
| V8TestInterface5Methods, WTF_ARRAY_LENGTH(V8TestInterface5Methods)); |
| v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate(); |
| ALLOW_UNUSED_LOCAL(instanceTemplate); |
| v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate(); |
| ALLOW_UNUSED_LOCAL(prototypeTemplate); |
| ExecutionContext* context = currentExecutionContext(isolate); |
| ALLOW_UNUSED_LOCAL(context); |
| const V8DOMConfiguration::ConstantConfiguration V8TestInterface5Constants[] = { |
| {"UNSIGNED_LONG", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong}, |
| {"CONST_JAVASCRIPT", 1, 0, V8DOMConfiguration::ConstantTypeShort}, |
| }; |
| V8DOMConfiguration::installConstants(isolate, functionTemplate, prototypeTemplate, V8TestInterface5Constants, WTF_ARRAY_LENGTH(V8TestInterface5Constants)); |
| { |
| v8::IndexedPropertyHandlerConfiguration config(TestInterface5ImplementationV8Internal::indexedPropertyGetterCallback, TestInterface5ImplementationV8Internal::indexedPropertySetterCallback, 0, TestInterface5ImplementationV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterface5Implementation>); |
| functionTemplate->InstanceTemplate()->SetHandler(config); |
| } |
| { |
| int flags = static_cast<int>(v8::PropertyHandlerFlags::kOnlyInterceptStrings); |
| flags |= static_cast<int>(v8::PropertyHandlerFlags::kNonMasking); |
| v8::NamedPropertyHandlerConfiguration config(TestInterface5ImplementationV8Internal::namedPropertyGetterCallback, TestInterface5ImplementationV8Internal::namedPropertySetterCallback, TestInterface5ImplementationV8Internal::namedPropertyQueryCallback, TestInterface5ImplementationV8Internal::namedPropertyDeleterCallback, TestInterface5ImplementationV8Internal::namedPropertyEnumeratorCallback, v8::Handle<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(flags)); |
| functionTemplate->InstanceTemplate()->SetHandler(config); |
| } |
| const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, TestInterface5ImplementationV8Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype }; |
| V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignature, v8::DontDelete, symbolKeyedIteratorConfiguration); |
| functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterface5::legacyCallCustom); |
| const V8DOMConfiguration::MethodConfiguration alwaysExposedStaticMethodMethodConfiguration = {"alwaysExposedStaticMethod", TestInterface5ImplementationV8Internal::alwaysExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface}; |
| V8DOMConfiguration::installMethod(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, v8::None, alwaysExposedStaticMethodMethodConfiguration); |
| if (context && (context->isWorkerGlobalScope())) { |
| const V8DOMConfiguration::MethodConfiguration workerExposedStaticMethodMethodConfiguration = {"workerExposedStaticMethod", TestInterface5ImplementationV8Internal::workerExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface}; |
| V8DOMConfiguration::installMethod(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, v8::None, workerExposedStaticMethodMethodConfiguration); |
| } |
| if (context && (context->isDocument())) { |
| const V8DOMConfiguration::MethodConfiguration windowExposedStaticMethodMethodConfiguration = {"windowExposedStaticMethod", TestInterface5ImplementationV8Internal::windowExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface}; |
| V8DOMConfiguration::installMethod(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, v8::None, windowExposedStaticMethodMethodConfiguration); |
| } |
| const V8DOMConfiguration::MethodConfiguration toStringMethodConfiguration = {"toString", TestInterface5ImplementationV8Internal::toStringMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}; |
| V8DOMConfiguration::installMethod(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontEnum), toStringMethodConfiguration); |
| |
| // Custom toString template |
| functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); |
| } |
| |
| v8::Local<v8::FunctionTemplate> V8TestInterface5::domTemplate(v8::Isolate* isolate) |
| { |
| return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterface5Template); |
| } |
| |
| bool V8TestInterface5::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) |
| { |
| return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); |
| } |
| |
| v8::Local<v8::Object> V8TestInterface5::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) |
| { |
| return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); |
| } |
| |
| TestInterface5Implementation* V8TestInterface5::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) |
| { |
| return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0; |
| } |
| |
| void V8TestInterface5::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) |
| { |
| ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext()); |
| v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate); |
| if (context && (context->isWorkerGlobalScope())) { |
| const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"workerExposedAttribute", TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}; |
| V8DOMConfiguration::installAccessor(isolate, v8::Local<v8::Object>(), prototypeObject, v8::Local<v8::Function>(), signature, accessorConfiguration); |
| } |
| if (context && (context->isDocument())) { |
| const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"windowExposedAttribute", TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}; |
| V8DOMConfiguration::installAccessor(isolate, v8::Local<v8::Object>(), prototypeObject, v8::Local<v8::Function>(), signature, accessorConfiguration); |
| } |
| v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate)); |
| ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext()); |
| ASSERT(context); |
| if (context && (context->isWorkerGlobalScope())) { |
| v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::workerExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0); |
| v8::Local<v8::Function> function = v8CallOrCrash(functionTemplate->GetFunction(isolate->GetCurrentContext())); |
| v8CallOrCrash(prototypeObject->Set(isolate->GetCurrentContext(), v8AtomicString(isolate, "workerExposedMethod"), function)); |
| } |
| if (context && (context->isDocument())) { |
| v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::windowExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0); |
| v8::Local<v8::Function> function = v8CallOrCrash(functionTemplate->GetFunction(isolate->GetCurrentContext())); |
| v8CallOrCrash(prototypeObject->Set(isolate->GetCurrentContext(), v8AtomicString(isolate, "windowExposedMethod"), function)); |
| } |
| if (context && (context->isDocument() || context->isServiceWorkerGlobalScope())) { |
| v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0); |
| v8::Local<v8::Function> function = v8CallOrCrash(functionTemplate->GetFunction(isolate->GetCurrentContext())); |
| v8CallOrCrash(prototypeObject->Set(isolate->GetCurrentContext(), v8AtomicString(isolate, "windowAndServiceWorkerExposedMethod"), function)); |
| } |
| } |
| |
| ActiveDOMObject* V8TestInterface5::toActiveDOMObject(v8::Local<v8::Object> wrapper) |
| { |
| return toImpl(wrapper); |
| } |
| |
| void V8TestInterface5::refObject(ScriptWrappable* scriptWrappable) |
| { |
| scriptWrappable->toImpl<TestInterface5Implementation>()->ref(); |
| } |
| |
| void V8TestInterface5::derefObject(ScriptWrappable* scriptWrappable) |
| { |
| scriptWrappable->toImpl<TestInterface5Implementation>()->deref(); |
| } |
| |
| } // namespace blink |
| #endif // ENABLE(CONDITION) |