blob: e780154c4654027107157548839be01c946be53a [file] [log] [blame]
/*
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 "JSAudioListener.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDOMConvert.h"
#include <runtime/Error.h>
#include <runtime/FunctionPrototype.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsAudioListenerPrototypeFunctionSetPosition(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsAudioListenerPrototypeFunctionSetOrientation(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsAudioListenerPrototypeFunctionSetVelocity(JSC::ExecState*);
// Attributes
JSC::EncodedJSValue jsAudioListenerDopplerFactor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSAudioListenerDopplerFactor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsAudioListenerSpeedOfSound(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSAudioListenerSpeedOfSound(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsAudioListenerConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSAudioListenerConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSAudioListenerPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSAudioListenerPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSAudioListenerPrototype* ptr = new (NotNull, JSC::allocateCell<JSAudioListenerPrototype>(vm.heap)) JSAudioListenerPrototype(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:
JSAudioListenerPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSAudioListener> JSAudioListenerConstructor;
template<> JSValue JSAudioListenerConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
UNUSED_PARAM(vm);
return globalObject.functionPrototype();
}
template<> void JSAudioListenerConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSAudioListener::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("AudioListener"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
}
template<> const ClassInfo JSAudioListenerConstructor::s_info = { "AudioListener", &Base::s_info, 0, CREATE_METHOD_TABLE(JSAudioListenerConstructor) };
/* Hash table for prototype */
static const HashTableValue JSAudioListenerPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioListenerConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioListenerConstructor) } },
{ "dopplerFactor", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioListenerDopplerFactor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioListenerDopplerFactor) } },
{ "speedOfSound", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioListenerSpeedOfSound), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioListenerSpeedOfSound) } },
{ "setPosition", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsAudioListenerPrototypeFunctionSetPosition), (intptr_t) (3) } },
{ "setOrientation", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsAudioListenerPrototypeFunctionSetOrientation), (intptr_t) (6) } },
{ "setVelocity", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsAudioListenerPrototypeFunctionSetVelocity), (intptr_t) (3) } },
};
const ClassInfo JSAudioListenerPrototype::s_info = { "AudioListenerPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSAudioListenerPrototype) };
void JSAudioListenerPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSAudioListenerPrototypeTableValues, *this);
}
const ClassInfo JSAudioListener::s_info = { "AudioListener", &Base::s_info, 0, CREATE_METHOD_TABLE(JSAudioListener) };
JSAudioListener::JSAudioListener(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AudioListener>&& impl)
: JSDOMWrapper<AudioListener>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSAudioListener::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSAudioListenerPrototype::create(vm, globalObject, JSAudioListenerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSAudioListener::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSAudioListener>(vm, globalObject);
}
void JSAudioListener::destroy(JSC::JSCell* cell)
{
JSAudioListener* thisObject = static_cast<JSAudioListener*>(cell);
thisObject->JSAudioListener::~JSAudioListener();
}
EncodedJSValue jsAudioListenerDopplerFactor(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<JSAudioListener*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "AudioListener", "dopplerFactor");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.dopplerFactor());
return JSValue::encode(result);
}
EncodedJSValue jsAudioListenerSpeedOfSound(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<JSAudioListener*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "AudioListener", "speedOfSound");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.speedOfSound());
return JSValue::encode(result);
}
EncodedJSValue jsAudioListenerConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSAudioListenerPrototype* domObject = jsDynamicCast<JSAudioListenerPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSAudioListener::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSAudioListenerConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSAudioListenerPrototype* domObject = jsDynamicCast<JSAudioListenerPrototype*>(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 setJSAudioListenerDopplerFactor(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);
JSAudioListener* castedThis = jsDynamicCast<JSAudioListener*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "AudioListener", "dopplerFactor");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<float>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setDopplerFactor(WTFMove(nativeValue));
return true;
}
bool setJSAudioListenerSpeedOfSound(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);
JSAudioListener* castedThis = jsDynamicCast<JSAudioListener*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "AudioListener", "speedOfSound");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<float>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setSpeedOfSound(WTFMove(nativeValue));
return true;
}
JSValue JSAudioListener::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSAudioListenerConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
EncodedJSValue JSC_HOST_CALL jsAudioListenerPrototypeFunctionSetPosition(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSAudioListener*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "AudioListener", "setPosition");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSAudioListener::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto x = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto y = convert<float>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto z = convert<float>(*state, state->uncheckedArgument(2), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.setPosition(WTFMove(x), WTFMove(y), WTFMove(z));
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL jsAudioListenerPrototypeFunctionSetOrientation(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSAudioListener*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "AudioListener", "setOrientation");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSAudioListener::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 6))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto x = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto y = convert<float>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto z = convert<float>(*state, state->uncheckedArgument(2), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto xUp = convert<float>(*state, state->uncheckedArgument(3), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto yUp = convert<float>(*state, state->uncheckedArgument(4), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto zUp = convert<float>(*state, state->uncheckedArgument(5), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.setOrientation(WTFMove(x), WTFMove(y), WTFMove(z), WTFMove(xUp), WTFMove(yUp), WTFMove(zUp));
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL jsAudioListenerPrototypeFunctionSetVelocity(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSAudioListener*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "AudioListener", "setVelocity");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSAudioListener::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto x = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto y = convert<float>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto z = convert<float>(*state, state->uncheckedArgument(2), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.setVelocity(WTFMove(x), WTFMove(y), WTFMove(z));
return JSValue::encode(jsUndefined());
}
bool JSAudioListenerOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
UNUSED_PARAM(handle);
UNUSED_PARAM(visitor);
return false;
}
void JSAudioListenerOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsAudioListener = jsCast<JSAudioListener*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsAudioListener->wrapped(), jsAudioListener);
}
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<AudioListener>&& impl)
{
#if COMPILER(CLANG)
// If you hit this failure the interface definition has the ImplementationLacksVTable
// attribute. You should remove that attribute. If the class has subclasses
// that may be passed through this toJS() function you should use the SkipVTableValidation
// attribute to AudioListener.
static_assert(!__is_polymorphic(AudioListener), "AudioListener is polymorphic but the IDL claims it is not");
#endif
return createWrapper<AudioListener>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, AudioListener& impl)
{
return wrap(state, globalObject, impl);
}
AudioListener* JSAudioListener::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSAudioListener*>(value))
return &wrapper->wrapped();
return nullptr;
}
}
#endif // ENABLE(WEB_AUDIO)