1/*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "config.h"
22
23#if ENABLE(WEB_AUDIO)
24
25#include "JSAudioParam.h"
26
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructorNotConstructable.h"
30#include "JSDOMConvertBufferSource.h"
31#include "JSDOMConvertNullable.h"
32#include "JSDOMConvertNumbers.h"
33#include "JSDOMConvertStrings.h"
34#include "JSDOMExceptionHandling.h"
35#include "JSDOMOperation.h"
36#include "JSDOMWrapperCache.h"
37#include "ScriptExecutionContext.h"
38#include <JavaScriptCore/FunctionPrototype.h>
39#include <JavaScriptCore/HeapSnapshotBuilder.h>
40#include <JavaScriptCore/JSCInlines.h>
41#include <wtf/GetPtr.h>
42#include <wtf/PointerPreparations.h>
43#include <wtf/URL.h>
44
45
46namespace WebCore {
47using namespace JSC;
48
49// Functions
50
51JSC::EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionSetValueAtTime(JSC::ExecState*);
52JSC::EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionLinearRampToValueAtTime(JSC::ExecState*);
53JSC::EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionExponentialRampToValueAtTime(JSC::ExecState*);
54JSC::EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionSetTargetAtTime(JSC::ExecState*);
55JSC::EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionSetValueCurveAtTime(JSC::ExecState*);
56JSC::EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionCancelScheduledValues(JSC::ExecState*);
57
58// Attributes
59
60JSC::EncodedJSValue jsAudioParamConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
61bool setJSAudioParamConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
62JSC::EncodedJSValue jsAudioParamValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
63bool setJSAudioParamValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
64JSC::EncodedJSValue jsAudioParamMinValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
65JSC::EncodedJSValue jsAudioParamMaxValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
66JSC::EncodedJSValue jsAudioParamDefaultValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
67JSC::EncodedJSValue jsAudioParamName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
68JSC::EncodedJSValue jsAudioParamUnits(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
69
70class JSAudioParamPrototype : public JSC::JSNonFinalObject {
71public:
72 using Base = JSC::JSNonFinalObject;
73 static JSAudioParamPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
74 {
75 JSAudioParamPrototype* ptr = new (NotNull, JSC::allocateCell<JSAudioParamPrototype>(vm.heap)) JSAudioParamPrototype(vm, globalObject, structure);
76 ptr->finishCreation(vm);
77 return ptr;
78 }
79
80 DECLARE_INFO;
81 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
82 {
83 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
84 }
85
86private:
87 JSAudioParamPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
88 : JSC::JSNonFinalObject(vm, structure)
89 {
90 }
91
92 void finishCreation(JSC::VM&);
93};
94
95using JSAudioParamConstructor = JSDOMConstructorNotConstructable<JSAudioParam>;
96
97template<> JSValue JSAudioParamConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
98{
99 UNUSED_PARAM(vm);
100 return globalObject.functionPrototype();
101}
102
103template<> void JSAudioParamConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
104{
105 putDirect(vm, vm.propertyNames->prototype, JSAudioParam::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
106 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("AudioParam"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
107 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
108}
109
110template<> const ClassInfo JSAudioParamConstructor::s_info = { "AudioParam", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioParamConstructor) };
111
112/* Hash table for prototype */
113
114static const HashTableValue JSAudioParamPrototypeTableValues[] =
115{
116 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioParamConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioParamConstructor) } },
117 { "value", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioParamValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioParamValue) } },
118 { "minValue", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioParamMinValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
119 { "maxValue", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioParamMaxValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
120 { "defaultValue", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioParamDefaultValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
121 { "name", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioParamName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
122 { "units", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioParamUnits), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
123 { "setValueAtTime", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioParamPrototypeFunctionSetValueAtTime), (intptr_t) (2) } },
124 { "linearRampToValueAtTime", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioParamPrototypeFunctionLinearRampToValueAtTime), (intptr_t) (2) } },
125 { "exponentialRampToValueAtTime", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioParamPrototypeFunctionExponentialRampToValueAtTime), (intptr_t) (2) } },
126 { "setTargetAtTime", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioParamPrototypeFunctionSetTargetAtTime), (intptr_t) (3) } },
127 { "setValueCurveAtTime", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioParamPrototypeFunctionSetValueCurveAtTime), (intptr_t) (3) } },
128 { "cancelScheduledValues", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioParamPrototypeFunctionCancelScheduledValues), (intptr_t) (1) } },
129};
130
131const ClassInfo JSAudioParamPrototype::s_info = { "AudioParamPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioParamPrototype) };
132
133void JSAudioParamPrototype::finishCreation(VM& vm)
134{
135 Base::finishCreation(vm);
136 reifyStaticProperties(vm, JSAudioParam::info(), JSAudioParamPrototypeTableValues, *this);
137}
138
139const ClassInfo JSAudioParam::s_info = { "AudioParam", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioParam) };
140
141JSAudioParam::JSAudioParam(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AudioParam>&& impl)
142 : JSDOMWrapper<AudioParam>(structure, globalObject, WTFMove(impl))
143{
144}
145
146void JSAudioParam::finishCreation(VM& vm)
147{
148 Base::finishCreation(vm);
149 ASSERT(inherits(vm, info()));
150
151}
152
153JSObject* JSAudioParam::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
154{
155 return JSAudioParamPrototype::create(vm, &globalObject, JSAudioParamPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
156}
157
158JSObject* JSAudioParam::prototype(VM& vm, JSDOMGlobalObject& globalObject)
159{
160 return getDOMPrototype<JSAudioParam>(vm, globalObject);
161}
162
163JSValue JSAudioParam::getConstructor(VM& vm, const JSGlobalObject* globalObject)
164{
165 return getDOMConstructor<JSAudioParamConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
166}
167
168void JSAudioParam::destroy(JSC::JSCell* cell)
169{
170 JSAudioParam* thisObject = static_cast<JSAudioParam*>(cell);
171 thisObject->JSAudioParam::~JSAudioParam();
172}
173
174template<> inline JSAudioParam* IDLAttribute<JSAudioParam>::cast(ExecState& state, EncodedJSValue thisValue)
175{
176 return jsDynamicCast<JSAudioParam*>(state.vm(), JSValue::decode(thisValue));
177}
178
179template<> inline JSAudioParam* IDLOperation<JSAudioParam>::cast(ExecState& state)
180{
181 return jsDynamicCast<JSAudioParam*>(state.vm(), state.thisValue());
182}
183
184EncodedJSValue jsAudioParamConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
185{
186 VM& vm = state->vm();
187 auto throwScope = DECLARE_THROW_SCOPE(vm);
188 auto* prototype = jsDynamicCast<JSAudioParamPrototype*>(vm, JSValue::decode(thisValue));
189 if (UNLIKELY(!prototype))
190 return throwVMTypeError(state, throwScope);
191 return JSValue::encode(JSAudioParam::getConstructor(state->vm(), prototype->globalObject()));
192}
193
194bool setJSAudioParamConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
195{
196 VM& vm = state->vm();
197 auto throwScope = DECLARE_THROW_SCOPE(vm);
198 auto* prototype = jsDynamicCast<JSAudioParamPrototype*>(vm, JSValue::decode(thisValue));
199 if (UNLIKELY(!prototype)) {
200 throwVMTypeError(state, throwScope);
201 return false;
202 }
203 // Shadowing a built-in constructor
204 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
205}
206
207static inline JSValue jsAudioParamValueGetter(ExecState& state, JSAudioParam& thisObject, ThrowScope& throwScope)
208{
209 UNUSED_PARAM(throwScope);
210 UNUSED_PARAM(state);
211 auto& impl = thisObject.wrapped();
212 JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.value());
213 return result;
214}
215
216EncodedJSValue jsAudioParamValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
217{
218 return IDLAttribute<JSAudioParam>::get<jsAudioParamValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "value");
219}
220
221static inline bool setJSAudioParamValueSetter(ExecState& state, JSAudioParam& thisObject, JSValue value, ThrowScope& throwScope)
222{
223 UNUSED_PARAM(throwScope);
224 auto& impl = thisObject.wrapped();
225 auto nativeValue = convert<IDLUnrestrictedFloat>(state, value);
226 RETURN_IF_EXCEPTION(throwScope, false);
227 AttributeSetter::call(state, throwScope, [&] {
228 return impl.setValue(WTFMove(nativeValue));
229 });
230 return true;
231}
232
233bool setJSAudioParamValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
234{
235 return IDLAttribute<JSAudioParam>::set<setJSAudioParamValueSetter>(*state, thisValue, encodedValue, "value");
236}
237
238static inline JSValue jsAudioParamMinValueGetter(ExecState& state, JSAudioParam& thisObject, ThrowScope& throwScope)
239{
240 UNUSED_PARAM(throwScope);
241 UNUSED_PARAM(state);
242 auto& impl = thisObject.wrapped();
243 JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.minValue());
244 return result;
245}
246
247EncodedJSValue jsAudioParamMinValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
248{
249 return IDLAttribute<JSAudioParam>::get<jsAudioParamMinValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "minValue");
250}
251
252static inline JSValue jsAudioParamMaxValueGetter(ExecState& state, JSAudioParam& thisObject, ThrowScope& throwScope)
253{
254 UNUSED_PARAM(throwScope);
255 UNUSED_PARAM(state);
256 auto& impl = thisObject.wrapped();
257 JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.maxValue());
258 return result;
259}
260
261EncodedJSValue jsAudioParamMaxValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
262{
263 return IDLAttribute<JSAudioParam>::get<jsAudioParamMaxValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "maxValue");
264}
265
266static inline JSValue jsAudioParamDefaultValueGetter(ExecState& state, JSAudioParam& thisObject, ThrowScope& throwScope)
267{
268 UNUSED_PARAM(throwScope);
269 UNUSED_PARAM(state);
270 auto& impl = thisObject.wrapped();
271 JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.defaultValue());
272 return result;
273}
274
275EncodedJSValue jsAudioParamDefaultValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
276{
277 return IDLAttribute<JSAudioParam>::get<jsAudioParamDefaultValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "defaultValue");
278}
279
280static inline JSValue jsAudioParamNameGetter(ExecState& state, JSAudioParam& thisObject, ThrowScope& throwScope)
281{
282 UNUSED_PARAM(throwScope);
283 UNUSED_PARAM(state);
284 auto& impl = thisObject.wrapped();
285 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.name());
286 return result;
287}
288
289EncodedJSValue jsAudioParamName(ExecState* state, EncodedJSValue thisValue, PropertyName)
290{
291 return IDLAttribute<JSAudioParam>::get<jsAudioParamNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "name");
292}
293
294static inline JSValue jsAudioParamUnitsGetter(ExecState& state, JSAudioParam& thisObject, ThrowScope& throwScope)
295{
296 UNUSED_PARAM(throwScope);
297 UNUSED_PARAM(state);
298 auto& impl = thisObject.wrapped();
299 JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.units());
300 return result;
301}
302
303EncodedJSValue jsAudioParamUnits(ExecState* state, EncodedJSValue thisValue, PropertyName)
304{
305 return IDLAttribute<JSAudioParam>::get<jsAudioParamUnitsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "units");
306}
307
308static inline JSC::EncodedJSValue jsAudioParamPrototypeFunctionSetValueAtTimeBody(JSC::ExecState* state, typename IDLOperation<JSAudioParam>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
309{
310 UNUSED_PARAM(state);
311 UNUSED_PARAM(throwScope);
312 auto& impl = castedThis->wrapped();
313 if (UNLIKELY(state->argumentCount() < 2))
314 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
315 auto value = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0));
316 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
317 auto time = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1));
318 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
319 impl.setValueAtTime(WTFMove(value), WTFMove(time));
320 return JSValue::encode(jsUndefined());
321}
322
323EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionSetValueAtTime(ExecState* state)
324{
325 return IDLOperation<JSAudioParam>::call<jsAudioParamPrototypeFunctionSetValueAtTimeBody>(*state, "setValueAtTime");
326}
327
328static inline JSC::EncodedJSValue jsAudioParamPrototypeFunctionLinearRampToValueAtTimeBody(JSC::ExecState* state, typename IDLOperation<JSAudioParam>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
329{
330 UNUSED_PARAM(state);
331 UNUSED_PARAM(throwScope);
332 auto& impl = castedThis->wrapped();
333 if (UNLIKELY(state->argumentCount() < 2))
334 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
335 auto value = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0));
336 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
337 auto time = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1));
338 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
339 impl.linearRampToValueAtTime(WTFMove(value), WTFMove(time));
340 return JSValue::encode(jsUndefined());
341}
342
343EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionLinearRampToValueAtTime(ExecState* state)
344{
345 return IDLOperation<JSAudioParam>::call<jsAudioParamPrototypeFunctionLinearRampToValueAtTimeBody>(*state, "linearRampToValueAtTime");
346}
347
348static inline JSC::EncodedJSValue jsAudioParamPrototypeFunctionExponentialRampToValueAtTimeBody(JSC::ExecState* state, typename IDLOperation<JSAudioParam>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
349{
350 UNUSED_PARAM(state);
351 UNUSED_PARAM(throwScope);
352 auto& impl = castedThis->wrapped();
353 if (UNLIKELY(state->argumentCount() < 2))
354 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
355 auto value = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0));
356 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
357 auto time = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1));
358 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
359 impl.exponentialRampToValueAtTime(WTFMove(value), WTFMove(time));
360 return JSValue::encode(jsUndefined());
361}
362
363EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionExponentialRampToValueAtTime(ExecState* state)
364{
365 return IDLOperation<JSAudioParam>::call<jsAudioParamPrototypeFunctionExponentialRampToValueAtTimeBody>(*state, "exponentialRampToValueAtTime");
366}
367
368static inline JSC::EncodedJSValue jsAudioParamPrototypeFunctionSetTargetAtTimeBody(JSC::ExecState* state, typename IDLOperation<JSAudioParam>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
369{
370 UNUSED_PARAM(state);
371 UNUSED_PARAM(throwScope);
372 auto& impl = castedThis->wrapped();
373 if (UNLIKELY(state->argumentCount() < 3))
374 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
375 auto target = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0));
376 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
377 auto time = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1));
378 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
379 auto timeConstant = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(2));
380 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
381 impl.setTargetAtTime(WTFMove(target), WTFMove(time), WTFMove(timeConstant));
382 return JSValue::encode(jsUndefined());
383}
384
385EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionSetTargetAtTime(ExecState* state)
386{
387 return IDLOperation<JSAudioParam>::call<jsAudioParamPrototypeFunctionSetTargetAtTimeBody>(*state, "setTargetAtTime");
388}
389
390static inline JSC::EncodedJSValue jsAudioParamPrototypeFunctionSetValueCurveAtTimeBody(JSC::ExecState* state, typename IDLOperation<JSAudioParam>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
391{
392 UNUSED_PARAM(state);
393 UNUSED_PARAM(throwScope);
394 auto& impl = castedThis->wrapped();
395 if (UNLIKELY(state->argumentCount() < 3))
396 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
397 auto values = convert<IDLNullable<IDLFloat32Array>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "values", "AudioParam", "setValueCurveAtTime", "Float32Array"); });
398 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
399 auto time = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1));
400 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
401 auto duration = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(2));
402 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
403 impl.setValueCurveAtTime(WTFMove(values), WTFMove(time), WTFMove(duration));
404 return JSValue::encode(jsUndefined());
405}
406
407EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionSetValueCurveAtTime(ExecState* state)
408{
409 return IDLOperation<JSAudioParam>::call<jsAudioParamPrototypeFunctionSetValueCurveAtTimeBody>(*state, "setValueCurveAtTime");
410}
411
412static inline JSC::EncodedJSValue jsAudioParamPrototypeFunctionCancelScheduledValuesBody(JSC::ExecState* state, typename IDLOperation<JSAudioParam>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
413{
414 UNUSED_PARAM(state);
415 UNUSED_PARAM(throwScope);
416 auto& impl = castedThis->wrapped();
417 if (UNLIKELY(state->argumentCount() < 1))
418 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
419 auto startTime = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0));
420 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
421 impl.cancelScheduledValues(WTFMove(startTime));
422 return JSValue::encode(jsUndefined());
423}
424
425EncodedJSValue JSC_HOST_CALL jsAudioParamPrototypeFunctionCancelScheduledValues(ExecState* state)
426{
427 return IDLOperation<JSAudioParam>::call<jsAudioParamPrototypeFunctionCancelScheduledValuesBody>(*state, "cancelScheduledValues");
428}
429
430void JSAudioParam::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
431{
432 auto* thisObject = jsCast<JSAudioParam*>(cell);
433 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
434 if (thisObject->scriptExecutionContext())
435 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
436 Base::heapSnapshot(cell, builder);
437}
438
439bool JSAudioParamOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
440{
441 UNUSED_PARAM(handle);
442 UNUSED_PARAM(visitor);
443 UNUSED_PARAM(reason);
444 return false;
445}
446
447void JSAudioParamOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
448{
449 auto* jsAudioParam = static_cast<JSAudioParam*>(handle.slot()->asCell());
450 auto& world = *static_cast<DOMWrapperWorld*>(context);
451 uncacheWrapper(world, &jsAudioParam->wrapped(), jsAudioParam);
452}
453
454#if ENABLE(BINDING_INTEGRITY)
455#if PLATFORM(WIN)
456#pragma warning(disable: 4483)
457extern "C" { extern void (*const __identifier("??_7AudioParam@WebCore@@6B@")[])(); }
458#else
459extern "C" { extern void* _ZTVN7WebCore10AudioParamE[]; }
460#endif
461#endif
462
463JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<AudioParam>&& impl)
464{
465
466#if ENABLE(BINDING_INTEGRITY)
467 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
468#if PLATFORM(WIN)
469 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7AudioParam@WebCore@@6B@"));
470#else
471 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore10AudioParamE[2]);
472#endif
473
474 // If this fails AudioParam does not have a vtable, so you need to add the
475 // ImplementationLacksVTable attribute to the interface definition
476 static_assert(std::is_polymorphic<AudioParam>::value, "AudioParam is not polymorphic");
477
478 // If you hit this assertion you either have a use after free bug, or
479 // AudioParam has subclasses. If AudioParam has subclasses that get passed
480 // to toJS() we currently require AudioParam you to opt out of binding hardening
481 // by adding the SkipVTableValidation attribute to the interface IDL definition
482 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
483#endif
484 return createWrapper<AudioParam>(globalObject, WTFMove(impl));
485}
486
487JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, AudioParam& impl)
488{
489 return wrap(state, globalObject, impl);
490}
491
492AudioParam* JSAudioParam::toWrapped(JSC::VM& vm, JSC::JSValue value)
493{
494 if (auto* wrapper = jsDynamicCast<JSAudioParam*>(vm, value))
495 return &wrapper->wrapped();
496 return nullptr;
497}
498
499}
500
501#endif // ENABLE(WEB_AUDIO)
502