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 "JSAudioNode.h" |
26 | |
27 | #include "JSAudioContext.h" |
28 | #include "JSAudioNode.h" |
29 | #include "JSAudioParam.h" |
30 | #include "JSDOMAttribute.h" |
31 | #include "JSDOMBinding.h" |
32 | #include "JSDOMConstructorNotConstructable.h" |
33 | #include "JSDOMConvertInterface.h" |
34 | #include "JSDOMConvertNumbers.h" |
35 | #include "JSDOMConvertStrings.h" |
36 | #include "JSDOMExceptionHandling.h" |
37 | #include "JSDOMGlobalObject.h" |
38 | #include "JSDOMOperation.h" |
39 | #include "JSDOMWrapperCache.h" |
40 | #include "ScriptExecutionContext.h" |
41 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
42 | #include <JavaScriptCore/JSCInlines.h> |
43 | #include <wtf/GetPtr.h> |
44 | #include <wtf/PointerPreparations.h> |
45 | #include <wtf/URL.h> |
46 | |
47 | |
48 | namespace WebCore { |
49 | using namespace JSC; |
50 | |
51 | // Functions |
52 | |
53 | JSC::EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionConnect(JSC::ExecState*); |
54 | JSC::EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionDisconnect(JSC::ExecState*); |
55 | |
56 | // Attributes |
57 | |
58 | JSC::EncodedJSValue jsAudioNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
59 | bool setJSAudioNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
60 | JSC::EncodedJSValue jsAudioNodeContext(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
61 | JSC::EncodedJSValue jsAudioNodeNumberOfInputs(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
62 | JSC::EncodedJSValue jsAudioNodeNumberOfOutputs(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | JSC::EncodedJSValue jsAudioNodeChannelCount(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
64 | bool setJSAudioNodeChannelCount(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
65 | JSC::EncodedJSValue jsAudioNodeChannelCountMode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
66 | bool setJSAudioNodeChannelCountMode(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
67 | JSC::EncodedJSValue jsAudioNodeChannelInterpretation(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
68 | bool setJSAudioNodeChannelInterpretation(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
69 | |
70 | class JSAudioNodePrototype : public JSC::JSNonFinalObject { |
71 | public: |
72 | using Base = JSC::JSNonFinalObject; |
73 | static JSAudioNodePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
74 | { |
75 | JSAudioNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSAudioNodePrototype>(vm.heap)) JSAudioNodePrototype(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 | |
86 | private: |
87 | JSAudioNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
88 | : JSC::JSNonFinalObject(vm, structure) |
89 | { |
90 | } |
91 | |
92 | void finishCreation(JSC::VM&); |
93 | }; |
94 | |
95 | using JSAudioNodeConstructor = JSDOMConstructorNotConstructable<JSAudioNode>; |
96 | |
97 | template<> JSValue JSAudioNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
98 | { |
99 | return JSEventTarget::getConstructor(vm, &globalObject); |
100 | } |
101 | |
102 | template<> void JSAudioNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
103 | { |
104 | putDirect(vm, vm.propertyNames->prototype, JSAudioNode::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
105 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("AudioNode"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
106 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
107 | } |
108 | |
109 | template<> const ClassInfo JSAudioNodeConstructor::s_info = { "AudioNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioNodeConstructor) }; |
110 | |
111 | /* Hash table for prototype */ |
112 | |
113 | static const HashTableValue JSAudioNodePrototypeTableValues[] = |
114 | { |
115 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioNodeConstructor) } }, |
116 | { "context" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeContext), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
117 | { "numberOfInputs" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeNumberOfInputs), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
118 | { "numberOfOutputs" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeNumberOfOutputs), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
119 | { "channelCount" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeChannelCount), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioNodeChannelCount) } }, |
120 | { "channelCountMode" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeChannelCountMode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioNodeChannelCountMode) } }, |
121 | { "channelInterpretation" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeChannelInterpretation), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioNodeChannelInterpretation) } }, |
122 | { "connect" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioNodePrototypeFunctionConnect), (intptr_t) (1) } }, |
123 | { "disconnect" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioNodePrototypeFunctionDisconnect), (intptr_t) (0) } }, |
124 | }; |
125 | |
126 | const ClassInfo JSAudioNodePrototype::s_info = { "AudioNodePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioNodePrototype) }; |
127 | |
128 | void JSAudioNodePrototype::finishCreation(VM& vm) |
129 | { |
130 | Base::finishCreation(vm); |
131 | reifyStaticProperties(vm, JSAudioNode::info(), JSAudioNodePrototypeTableValues, *this); |
132 | } |
133 | |
134 | const ClassInfo JSAudioNode::s_info = { "AudioNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioNode) }; |
135 | |
136 | JSAudioNode::JSAudioNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AudioNode>&& impl) |
137 | : JSEventTarget(structure, globalObject, WTFMove(impl)) |
138 | { |
139 | } |
140 | |
141 | void JSAudioNode::finishCreation(VM& vm) |
142 | { |
143 | Base::finishCreation(vm); |
144 | ASSERT(inherits(vm, info())); |
145 | |
146 | } |
147 | |
148 | JSObject* JSAudioNode::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
149 | { |
150 | return JSAudioNodePrototype::create(vm, &globalObject, JSAudioNodePrototype::createStructure(vm, &globalObject, JSEventTarget::prototype(vm, globalObject))); |
151 | } |
152 | |
153 | JSObject* JSAudioNode::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
154 | { |
155 | return getDOMPrototype<JSAudioNode>(vm, globalObject); |
156 | } |
157 | |
158 | JSValue JSAudioNode::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
159 | { |
160 | return getDOMConstructor<JSAudioNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
161 | } |
162 | |
163 | template<> inline JSAudioNode* IDLAttribute<JSAudioNode>::cast(ExecState& state, EncodedJSValue thisValue) |
164 | { |
165 | return jsDynamicCast<JSAudioNode*>(state.vm(), JSValue::decode(thisValue)); |
166 | } |
167 | |
168 | template<> inline JSAudioNode* IDLOperation<JSAudioNode>::cast(ExecState& state) |
169 | { |
170 | return jsDynamicCast<JSAudioNode*>(state.vm(), state.thisValue()); |
171 | } |
172 | |
173 | EncodedJSValue jsAudioNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
174 | { |
175 | VM& vm = state->vm(); |
176 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
177 | auto* prototype = jsDynamicCast<JSAudioNodePrototype*>(vm, JSValue::decode(thisValue)); |
178 | if (UNLIKELY(!prototype)) |
179 | return throwVMTypeError(state, throwScope); |
180 | return JSValue::encode(JSAudioNode::getConstructor(state->vm(), prototype->globalObject())); |
181 | } |
182 | |
183 | bool setJSAudioNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
184 | { |
185 | VM& vm = state->vm(); |
186 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
187 | auto* prototype = jsDynamicCast<JSAudioNodePrototype*>(vm, JSValue::decode(thisValue)); |
188 | if (UNLIKELY(!prototype)) { |
189 | throwVMTypeError(state, throwScope); |
190 | return false; |
191 | } |
192 | // Shadowing a built-in constructor |
193 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
194 | } |
195 | |
196 | static inline JSValue jsAudioNodeContextGetter(ExecState& state, JSAudioNode& thisObject, ThrowScope& throwScope) |
197 | { |
198 | UNUSED_PARAM(throwScope); |
199 | UNUSED_PARAM(state); |
200 | auto& impl = thisObject.wrapped(); |
201 | JSValue result = toJS<IDLInterface<AudioContext>>(state, *thisObject.globalObject(), throwScope, impl.context()); |
202 | return result; |
203 | } |
204 | |
205 | EncodedJSValue jsAudioNodeContext(ExecState* state, EncodedJSValue thisValue, PropertyName) |
206 | { |
207 | return IDLAttribute<JSAudioNode>::get<jsAudioNodeContextGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "context" ); |
208 | } |
209 | |
210 | static inline JSValue jsAudioNodeNumberOfInputsGetter(ExecState& state, JSAudioNode& thisObject, ThrowScope& throwScope) |
211 | { |
212 | UNUSED_PARAM(throwScope); |
213 | UNUSED_PARAM(state); |
214 | auto& impl = thisObject.wrapped(); |
215 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.numberOfInputs()); |
216 | return result; |
217 | } |
218 | |
219 | EncodedJSValue jsAudioNodeNumberOfInputs(ExecState* state, EncodedJSValue thisValue, PropertyName) |
220 | { |
221 | return IDLAttribute<JSAudioNode>::get<jsAudioNodeNumberOfInputsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "numberOfInputs" ); |
222 | } |
223 | |
224 | static inline JSValue jsAudioNodeNumberOfOutputsGetter(ExecState& state, JSAudioNode& thisObject, ThrowScope& throwScope) |
225 | { |
226 | UNUSED_PARAM(throwScope); |
227 | UNUSED_PARAM(state); |
228 | auto& impl = thisObject.wrapped(); |
229 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.numberOfOutputs()); |
230 | return result; |
231 | } |
232 | |
233 | EncodedJSValue jsAudioNodeNumberOfOutputs(ExecState* state, EncodedJSValue thisValue, PropertyName) |
234 | { |
235 | return IDLAttribute<JSAudioNode>::get<jsAudioNodeNumberOfOutputsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "numberOfOutputs" ); |
236 | } |
237 | |
238 | static inline JSValue jsAudioNodeChannelCountGetter(ExecState& state, JSAudioNode& thisObject, ThrowScope& throwScope) |
239 | { |
240 | UNUSED_PARAM(throwScope); |
241 | UNUSED_PARAM(state); |
242 | auto& impl = thisObject.wrapped(); |
243 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.channelCount()); |
244 | return result; |
245 | } |
246 | |
247 | EncodedJSValue jsAudioNodeChannelCount(ExecState* state, EncodedJSValue thisValue, PropertyName) |
248 | { |
249 | return IDLAttribute<JSAudioNode>::get<jsAudioNodeChannelCountGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "channelCount" ); |
250 | } |
251 | |
252 | static inline bool setJSAudioNodeChannelCountSetter(ExecState& state, JSAudioNode& thisObject, JSValue value, ThrowScope& throwScope) |
253 | { |
254 | UNUSED_PARAM(throwScope); |
255 | auto& impl = thisObject.wrapped(); |
256 | auto nativeValue = convert<IDLUnsignedLong>(state, value); |
257 | RETURN_IF_EXCEPTION(throwScope, false); |
258 | AttributeSetter::call(state, throwScope, [&] { |
259 | return impl.setChannelCount(WTFMove(nativeValue)); |
260 | }); |
261 | return true; |
262 | } |
263 | |
264 | bool setJSAudioNodeChannelCount(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
265 | { |
266 | return IDLAttribute<JSAudioNode>::set<setJSAudioNodeChannelCountSetter>(*state, thisValue, encodedValue, "channelCount" ); |
267 | } |
268 | |
269 | static inline JSValue jsAudioNodeChannelCountModeGetter(ExecState& state, JSAudioNode& thisObject, ThrowScope& throwScope) |
270 | { |
271 | UNUSED_PARAM(throwScope); |
272 | UNUSED_PARAM(state); |
273 | auto& impl = thisObject.wrapped(); |
274 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.channelCountMode()); |
275 | return result; |
276 | } |
277 | |
278 | EncodedJSValue jsAudioNodeChannelCountMode(ExecState* state, EncodedJSValue thisValue, PropertyName) |
279 | { |
280 | return IDLAttribute<JSAudioNode>::get<jsAudioNodeChannelCountModeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "channelCountMode" ); |
281 | } |
282 | |
283 | static inline bool setJSAudioNodeChannelCountModeSetter(ExecState& state, JSAudioNode& thisObject, JSValue value, ThrowScope& throwScope) |
284 | { |
285 | UNUSED_PARAM(throwScope); |
286 | auto& impl = thisObject.wrapped(); |
287 | auto nativeValue = convert<IDLDOMString>(state, value); |
288 | RETURN_IF_EXCEPTION(throwScope, false); |
289 | AttributeSetter::call(state, throwScope, [&] { |
290 | return impl.setChannelCountMode(WTFMove(nativeValue)); |
291 | }); |
292 | return true; |
293 | } |
294 | |
295 | bool setJSAudioNodeChannelCountMode(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
296 | { |
297 | return IDLAttribute<JSAudioNode>::set<setJSAudioNodeChannelCountModeSetter>(*state, thisValue, encodedValue, "channelCountMode" ); |
298 | } |
299 | |
300 | static inline JSValue jsAudioNodeChannelInterpretationGetter(ExecState& state, JSAudioNode& thisObject, ThrowScope& throwScope) |
301 | { |
302 | UNUSED_PARAM(throwScope); |
303 | UNUSED_PARAM(state); |
304 | auto& impl = thisObject.wrapped(); |
305 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.channelInterpretation()); |
306 | return result; |
307 | } |
308 | |
309 | EncodedJSValue jsAudioNodeChannelInterpretation(ExecState* state, EncodedJSValue thisValue, PropertyName) |
310 | { |
311 | return IDLAttribute<JSAudioNode>::get<jsAudioNodeChannelInterpretationGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "channelInterpretation" ); |
312 | } |
313 | |
314 | static inline bool setJSAudioNodeChannelInterpretationSetter(ExecState& state, JSAudioNode& thisObject, JSValue value, ThrowScope& throwScope) |
315 | { |
316 | UNUSED_PARAM(throwScope); |
317 | auto& impl = thisObject.wrapped(); |
318 | auto nativeValue = convert<IDLDOMString>(state, value); |
319 | RETURN_IF_EXCEPTION(throwScope, false); |
320 | AttributeSetter::call(state, throwScope, [&] { |
321 | return impl.setChannelInterpretation(WTFMove(nativeValue)); |
322 | }); |
323 | return true; |
324 | } |
325 | |
326 | bool setJSAudioNodeChannelInterpretation(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
327 | { |
328 | return IDLAttribute<JSAudioNode>::set<setJSAudioNodeChannelInterpretationSetter>(*state, thisValue, encodedValue, "channelInterpretation" ); |
329 | } |
330 | |
331 | static inline JSC::EncodedJSValue jsAudioNodePrototypeFunctionConnect1Body(JSC::ExecState* state, typename IDLOperation<JSAudioNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
332 | { |
333 | UNUSED_PARAM(state); |
334 | UNUSED_PARAM(throwScope); |
335 | auto& impl = castedThis->wrapped(); |
336 | auto returnValue = state->uncheckedArgument(0); |
337 | auto destination = convert<IDLInterface<AudioNode>>(*state, returnValue, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "destination" , "AudioNode" , "connect" , "AudioNode" ); }); |
338 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
339 | auto output = convert<IDLUnsignedLong>(*state, state->argument(1)); |
340 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
341 | auto input = convert<IDLUnsignedLong>(*state, state->argument(2)); |
342 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
343 | propagateException(*state, throwScope, impl.connect(*destination, WTFMove(output), WTFMove(input))); |
344 | return JSValue::encode(returnValue); |
345 | } |
346 | |
347 | static inline JSC::EncodedJSValue jsAudioNodePrototypeFunctionConnect2Body(JSC::ExecState* state, typename IDLOperation<JSAudioNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
348 | { |
349 | UNUSED_PARAM(state); |
350 | UNUSED_PARAM(throwScope); |
351 | auto& impl = castedThis->wrapped(); |
352 | auto destination = convert<IDLInterface<AudioParam>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "destination" , "AudioNode" , "connect" , "AudioParam" ); }); |
353 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
354 | auto output = convert<IDLUnsignedLong>(*state, state->argument(1)); |
355 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
356 | propagateException(*state, throwScope, impl.connect(*destination, WTFMove(output))); |
357 | return JSValue::encode(jsUndefined()); |
358 | } |
359 | |
360 | static inline JSC::EncodedJSValue jsAudioNodePrototypeFunctionConnectOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSAudioNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
361 | { |
362 | UNUSED_PARAM(state); |
363 | UNUSED_PARAM(throwScope); |
364 | VM& vm = state->vm(); |
365 | UNUSED_PARAM(vm); |
366 | size_t argsCount = std::min<size_t>(3, state->argumentCount()); |
367 | if (argsCount == 1) { |
368 | JSValue distinguishingArg = state->uncheckedArgument(0); |
369 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSAudioNode>(vm)) |
370 | return jsAudioNodePrototypeFunctionConnect1Body(state, castedThis, throwScope); |
371 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSAudioParam>(vm)) |
372 | return jsAudioNodePrototypeFunctionConnect2Body(state, castedThis, throwScope); |
373 | } |
374 | if (argsCount == 2) { |
375 | JSValue distinguishingArg = state->uncheckedArgument(0); |
376 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSAudioNode>(vm)) |
377 | return jsAudioNodePrototypeFunctionConnect1Body(state, castedThis, throwScope); |
378 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSAudioParam>(vm)) |
379 | return jsAudioNodePrototypeFunctionConnect2Body(state, castedThis, throwScope); |
380 | } |
381 | if (argsCount == 3) { |
382 | return jsAudioNodePrototypeFunctionConnect1Body(state, castedThis, throwScope); |
383 | } |
384 | return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope); |
385 | } |
386 | |
387 | EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionConnect(ExecState* state) |
388 | { |
389 | return IDLOperation<JSAudioNode>::call<jsAudioNodePrototypeFunctionConnectOverloadDispatcher>(*state, "connect" ); |
390 | } |
391 | |
392 | static inline JSC::EncodedJSValue jsAudioNodePrototypeFunctionDisconnectBody(JSC::ExecState* state, typename IDLOperation<JSAudioNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
393 | { |
394 | UNUSED_PARAM(state); |
395 | UNUSED_PARAM(throwScope); |
396 | auto& impl = castedThis->wrapped(); |
397 | auto output = convert<IDLUnsignedLong>(*state, state->argument(0)); |
398 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
399 | propagateException(*state, throwScope, impl.disconnect(WTFMove(output))); |
400 | return JSValue::encode(jsUndefined()); |
401 | } |
402 | |
403 | EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionDisconnect(ExecState* state) |
404 | { |
405 | return IDLOperation<JSAudioNode>::call<jsAudioNodePrototypeFunctionDisconnectBody>(*state, "disconnect" ); |
406 | } |
407 | |
408 | void JSAudioNode::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
409 | { |
410 | auto* thisObject = jsCast<JSAudioNode*>(cell); |
411 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
412 | if (thisObject->scriptExecutionContext()) |
413 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
414 | Base::heapSnapshot(cell, builder); |
415 | } |
416 | |
417 | void JSAudioNodeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
418 | { |
419 | auto* jsAudioNode = static_cast<JSAudioNode*>(handle.slot()->asCell()); |
420 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
421 | uncacheWrapper(world, &jsAudioNode->wrapped(), jsAudioNode); |
422 | } |
423 | |
424 | #if ENABLE(BINDING_INTEGRITY) |
425 | #if PLATFORM(WIN) |
426 | #pragma warning(disable: 4483) |
427 | extern "C" { extern void (*const __identifier("??_7AudioNode@WebCore@@6B@" )[])(); } |
428 | #else |
429 | extern "C" { extern void* _ZTVN7WebCore9AudioNodeE[]; } |
430 | #endif |
431 | #endif |
432 | |
433 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<AudioNode>&& impl) |
434 | { |
435 | |
436 | #if ENABLE(BINDING_INTEGRITY) |
437 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
438 | #if PLATFORM(WIN) |
439 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7AudioNode@WebCore@@6B@" )); |
440 | #else |
441 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore9AudioNodeE[2]); |
442 | #endif |
443 | |
444 | // If this fails AudioNode does not have a vtable, so you need to add the |
445 | // ImplementationLacksVTable attribute to the interface definition |
446 | static_assert(std::is_polymorphic<AudioNode>::value, "AudioNode is not polymorphic" ); |
447 | |
448 | // If you hit this assertion you either have a use after free bug, or |
449 | // AudioNode has subclasses. If AudioNode has subclasses that get passed |
450 | // to toJS() we currently require AudioNode you to opt out of binding hardening |
451 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
452 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
453 | #endif |
454 | return createWrapper<AudioNode>(globalObject, WTFMove(impl)); |
455 | } |
456 | |
457 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, AudioNode& impl) |
458 | { |
459 | return wrap(state, globalObject, impl); |
460 | } |
461 | |
462 | AudioNode* JSAudioNode::toWrapped(JSC::VM& vm, JSC::JSValue value) |
463 | { |
464 | if (auto* wrapper = jsDynamicCast<JSAudioNode*>(vm, value)) |
465 | return &wrapper->wrapped(); |
466 | return nullptr; |
467 | } |
468 | |
469 | } |
470 | |
471 | #endif // ENABLE(WEB_AUDIO) |
472 | |