| /* |
| This file is part of the WebKit open source project. |
| This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| |
| This library is free software; you can redistribute it and/or |
| modify it under the terms of the GNU Library General Public |
| License as published by the Free Software Foundation; either |
| version 2 of the License, or (at your option) any later version. |
| |
| This library is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| Library General Public License for more details. |
| |
| You should have received a copy of the GNU Library General Public License |
| along with this library; see the file COPYING.LIB. If not, write to |
| the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| Boston, MA 02110-1301, USA. |
| */ |
| |
| #include "config.h" |
| |
| #if ENABLE(WEB_AUDIO) |
| |
| #include "JSAudioNode.h" |
| |
| #include "ExceptionCode.h" |
| #include "JSAudioContext.h" |
| #include "JSAudioNode.h" |
| #include "JSAudioParam.h" |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include "JSDOMConvert.h" |
| #include "URL.h" |
| #include <runtime/Error.h> |
| #include <runtime/JSString.h> |
| #include <wtf/GetPtr.h> |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| // Functions |
| |
| JSC::EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionConnect(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionDisconnect(JSC::ExecState*); |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsAudioNodeContext(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsAudioNodeNumberOfInputs(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsAudioNodeNumberOfOutputs(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsAudioNodeChannelCount(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSAudioNodeChannelCount(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsAudioNodeChannelCountMode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSAudioNodeChannelCountMode(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsAudioNodeChannelInterpretation(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSAudioNodeChannelInterpretation(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsAudioNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSAudioNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSAudioNodePrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSAudioNodePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSAudioNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSAudioNodePrototype>(vm.heap)) JSAudioNodePrototype(vm, globalObject, structure); |
| ptr->finishCreation(vm); |
| return ptr; |
| } |
| |
| DECLARE_INFO; |
| static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| { |
| return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| } |
| |
| private: |
| JSAudioNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructorNotConstructable<JSAudioNode> JSAudioNodeConstructor; |
| |
| template<> JSValue JSAudioNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| return JSEventTarget::getConstructor(vm, &globalObject); |
| } |
| |
| template<> void JSAudioNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSAudioNode::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("AudioNode"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| } |
| |
| template<> const ClassInfo JSAudioNodeConstructor::s_info = { "AudioNode", &Base::s_info, 0, CREATE_METHOD_TABLE(JSAudioNodeConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSAudioNodePrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioNodeConstructor) } }, |
| { "context", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeContext), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "numberOfInputs", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeNumberOfInputs), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "numberOfOutputs", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeNumberOfOutputs), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "channelCount", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeChannelCount), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioNodeChannelCount) } }, |
| { "channelCountMode", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeChannelCountMode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioNodeChannelCountMode) } }, |
| { "channelInterpretation", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeChannelInterpretation), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioNodeChannelInterpretation) } }, |
| { "connect", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsAudioNodePrototypeFunctionConnect), (intptr_t) (1) } }, |
| { "disconnect", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsAudioNodePrototypeFunctionDisconnect), (intptr_t) (0) } }, |
| }; |
| |
| const ClassInfo JSAudioNodePrototype::s_info = { "AudioNodePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSAudioNodePrototype) }; |
| |
| void JSAudioNodePrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSAudioNodePrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSAudioNode::s_info = { "AudioNode", &Base::s_info, 0, CREATE_METHOD_TABLE(JSAudioNode) }; |
| |
| JSAudioNode::JSAudioNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AudioNode>&& impl) |
| : JSEventTarget(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSAudioNode::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSAudioNodePrototype::create(vm, globalObject, JSAudioNodePrototype::createStructure(vm, globalObject, JSEventTarget::prototype(vm, globalObject))); |
| } |
| |
| JSObject* JSAudioNode::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSAudioNode>(vm, globalObject); |
| } |
| |
| EncodedJSValue jsAudioNodeContext(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSAudioNode*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "AudioNode", "context"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = toJS(state, castedThis->globalObject(), impl.context()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsAudioNodeNumberOfInputs(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSAudioNode*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "AudioNode", "numberOfInputs"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.numberOfInputs()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsAudioNodeNumberOfOutputs(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSAudioNode*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "AudioNode", "numberOfOutputs"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.numberOfOutputs()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsAudioNodeChannelCount(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSAudioNode*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "AudioNode", "channelCount"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.channelCount()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsAudioNodeChannelCountMode(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSAudioNode*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "AudioNode", "channelCountMode"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.channelCountMode()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsAudioNodeChannelInterpretation(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSAudioNode*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "AudioNode", "channelInterpretation"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.channelInterpretation()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsAudioNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSAudioNodePrototype* domObject = jsDynamicCast<JSAudioNodePrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSAudioNode::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSAudioNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSAudioNodePrototype* domObject = jsDynamicCast<JSAudioNodePrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) { |
| throwVMTypeError(state, throwScope); |
| return false; |
| } |
| // Shadowing a built-in constructor |
| return domObject->putDirect(state->vm(), state->propertyNames().constructor, value); |
| } |
| |
| bool setJSAudioNodeChannelCount(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue value = JSValue::decode(encodedValue); |
| UNUSED_PARAM(thisValue); |
| JSAudioNode* castedThis = jsDynamicCast<JSAudioNode*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "AudioNode", "channelCount"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = convert<uint32_t>(*state, value, NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setChannelCount(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| bool setJSAudioNodeChannelCountMode(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue value = JSValue::decode(encodedValue); |
| UNUSED_PARAM(thisValue); |
| JSAudioNode* castedThis = jsDynamicCast<JSAudioNode*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "AudioNode", "channelCountMode"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = value.toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setChannelCountMode(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| bool setJSAudioNodeChannelInterpretation(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue value = JSValue::decode(encodedValue); |
| UNUSED_PARAM(thisValue); |
| JSAudioNode* castedThis = jsDynamicCast<JSAudioNode*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "AudioNode", "channelInterpretation"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = value.toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setChannelInterpretation(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| JSValue JSAudioNode::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSAudioNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| static inline EncodedJSValue jsAudioNodePrototypeFunctionConnect1(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSAudioNode*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "AudioNode", "connect"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSAudioNode::info()); |
| auto& impl = castedThis->wrapped(); |
| if (UNLIKELY(state->argumentCount() < 1)) |
| return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| ExceptionCode ec = 0; |
| AudioNode* destination = nullptr; |
| if (!state->uncheckedArgument(0).isUndefinedOrNull()) { |
| destination = JSAudioNode::toWrapped(state->uncheckedArgument(0)); |
| if (UNLIKELY(!destination)) |
| return throwArgumentTypeError(*state, throwScope, 0, "destination", "AudioNode", "connect", "AudioNode"); |
| } |
| auto output = convert<uint32_t>(*state, state->argument(1), NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| auto input = convert<uint32_t>(*state, state->argument(2), NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| impl.connect(WTFMove(destination), WTFMove(output), WTFMove(input), ec); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(jsUndefined()); |
| } |
| |
| static inline EncodedJSValue jsAudioNodePrototypeFunctionConnect2(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSAudioNode*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "AudioNode", "connect"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSAudioNode::info()); |
| auto& impl = castedThis->wrapped(); |
| if (UNLIKELY(state->argumentCount() < 1)) |
| return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| ExceptionCode ec = 0; |
| AudioParam* destination = nullptr; |
| if (!state->uncheckedArgument(0).isUndefinedOrNull()) { |
| destination = JSAudioParam::toWrapped(state->uncheckedArgument(0)); |
| if (UNLIKELY(!destination)) |
| return throwArgumentTypeError(*state, throwScope, 0, "destination", "AudioNode", "connect", "AudioParam"); |
| } |
| auto output = convert<uint32_t>(*state, state->argument(1), NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| impl.connect(WTFMove(destination), WTFMove(output), ec); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(jsUndefined()); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionConnect(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| size_t argsCount = std::min<size_t>(3, state->argumentCount()); |
| if (argsCount == 1) { |
| JSValue distinguishingArg = state->uncheckedArgument(0); |
| if (distinguishingArg.isUndefinedOrNull()) |
| return jsAudioNodePrototypeFunctionConnect1(state); |
| if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits(JSAudioNode::info())) |
| return jsAudioNodePrototypeFunctionConnect1(state); |
| if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits(JSAudioParam::info())) |
| return jsAudioNodePrototypeFunctionConnect2(state); |
| } |
| if (argsCount == 2) { |
| JSValue distinguishingArg = state->uncheckedArgument(0); |
| if (distinguishingArg.isUndefinedOrNull()) |
| return jsAudioNodePrototypeFunctionConnect1(state); |
| if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits(JSAudioNode::info())) |
| return jsAudioNodePrototypeFunctionConnect1(state); |
| if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits(JSAudioParam::info())) |
| return jsAudioNodePrototypeFunctionConnect2(state); |
| } |
| if (argsCount == 3) { |
| return jsAudioNodePrototypeFunctionConnect1(state); |
| } |
| return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionDisconnect(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSAudioNode*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "AudioNode", "disconnect"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSAudioNode::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto output = convert<uint32_t>(*state, state->argument(0), NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| impl.disconnect(WTFMove(output), ec); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(jsUndefined()); |
| } |
| |
| void JSAudioNode::visitChildren(JSCell* cell, SlotVisitor& visitor) |
| { |
| auto* thisObject = jsCast<JSAudioNode*>(cell); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
| Base::visitChildren(thisObject, visitor); |
| thisObject->wrapped().visitJSEventListeners(visitor); |
| } |
| |
| bool JSAudioNodeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) |
| { |
| auto* jsAudioNode = jsCast<JSAudioNode*>(handle.slot()->asCell()); |
| if (jsAudioNode->wrapped().isFiringEventListeners()) |
| return true; |
| AudioNode* root = &jsAudioNode->wrapped(); |
| return visitor.containsOpaqueRoot(root); |
| } |
| |
| void JSAudioNodeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| { |
| auto* jsAudioNode = jsCast<JSAudioNode*>(handle.slot()->asCell()); |
| auto& world = *static_cast<DOMWrapperWorld*>(context); |
| uncacheWrapper(world, &jsAudioNode->wrapped(), jsAudioNode); |
| } |
| |
| #if ENABLE(BINDING_INTEGRITY) |
| #if PLATFORM(WIN) |
| #pragma warning(disable: 4483) |
| extern "C" { extern void (*const __identifier("??_7AudioNode@WebCore@@6B@")[])(); } |
| #else |
| extern "C" { extern void* _ZTVN7WebCore9AudioNodeE[]; } |
| #endif |
| #endif |
| |
| JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<AudioNode>&& impl) |
| { |
| |
| #if ENABLE(BINDING_INTEGRITY) |
| void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| #if PLATFORM(WIN) |
| void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7AudioNode@WebCore@@6B@")); |
| #else |
| void* expectedVTablePointer = &_ZTVN7WebCore9AudioNodeE[2]; |
| #if COMPILER(CLANG) |
| // If this fails AudioNode does not have a vtable, so you need to add the |
| // ImplementationLacksVTable attribute to the interface definition |
| static_assert(__is_polymorphic(AudioNode), "AudioNode is not polymorphic"); |
| #endif |
| #endif |
| // If you hit this assertion you either have a use after free bug, or |
| // AudioNode has subclasses. If AudioNode has subclasses that get passed |
| // to toJS() we currently require AudioNode you to opt out of binding hardening |
| // by adding the SkipVTableValidation attribute to the interface IDL definition |
| RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| #endif |
| return createWrapper<AudioNode>(globalObject, WTFMove(impl)); |
| } |
| |
| JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, AudioNode& impl) |
| { |
| return wrap(state, globalObject, impl); |
| } |
| |
| AudioNode* JSAudioNode::toWrapped(JSC::JSValue value) |
| { |
| if (auto* wrapper = jsDynamicCast<JSAudioNode*>(value)) |
| return &wrapper->wrapped(); |
| return nullptr; |
| } |
| |
| } |
| |
| #endif // ENABLE(WEB_AUDIO) |