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 "JSAudioBufferSourceNode.h" |
26 | |
27 | #include "EventNames.h" |
28 | #include "JSAudioBuffer.h" |
29 | #include "JSAudioParam.h" |
30 | #include "JSDOMAttribute.h" |
31 | #include "JSDOMBinding.h" |
32 | #include "JSDOMConstructorNotConstructable.h" |
33 | #include "JSDOMConvertBoolean.h" |
34 | #include "JSDOMConvertInterface.h" |
35 | #include "JSDOMConvertNullable.h" |
36 | #include "JSDOMConvertNumbers.h" |
37 | #include "JSDOMExceptionHandling.h" |
38 | #include "JSDOMGlobalObject.h" |
39 | #include "JSDOMOperation.h" |
40 | #include "JSDOMWrapperCache.h" |
41 | #include "JSEventListener.h" |
42 | #include "ScriptExecutionContext.h" |
43 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
44 | #include <JavaScriptCore/JSCInlines.h> |
45 | #include <wtf/GetPtr.h> |
46 | #include <wtf/PointerPreparations.h> |
47 | #include <wtf/URL.h> |
48 | |
49 | |
50 | namespace WebCore { |
51 | using namespace JSC; |
52 | |
53 | // Functions |
54 | |
55 | JSC::EncodedJSValue JSC_HOST_CALL jsAudioBufferSourceNodePrototypeFunctionStart(JSC::ExecState*); |
56 | JSC::EncodedJSValue JSC_HOST_CALL jsAudioBufferSourceNodePrototypeFunctionStop(JSC::ExecState*); |
57 | |
58 | // Attributes |
59 | |
60 | JSC::EncodedJSValue jsAudioBufferSourceNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
61 | bool setJSAudioBufferSourceNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
62 | JSC::EncodedJSValue jsAudioBufferSourceNodeBuffer(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | bool setJSAudioBufferSourceNodeBuffer(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
64 | JSC::EncodedJSValue jsAudioBufferSourceNodePlaybackState(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
65 | JSC::EncodedJSValue jsAudioBufferSourceNodeGain(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
66 | JSC::EncodedJSValue jsAudioBufferSourceNodePlaybackRate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
67 | JSC::EncodedJSValue jsAudioBufferSourceNodeLoop(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
68 | bool setJSAudioBufferSourceNodeLoop(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
69 | JSC::EncodedJSValue jsAudioBufferSourceNodeLoopStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
70 | bool setJSAudioBufferSourceNodeLoopStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
71 | JSC::EncodedJSValue jsAudioBufferSourceNodeLoopEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
72 | bool setJSAudioBufferSourceNodeLoopEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
73 | JSC::EncodedJSValue jsAudioBufferSourceNodeOnended(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
74 | bool setJSAudioBufferSourceNodeOnended(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
75 | |
76 | class JSAudioBufferSourceNodePrototype : public JSC::JSNonFinalObject { |
77 | public: |
78 | using Base = JSC::JSNonFinalObject; |
79 | static JSAudioBufferSourceNodePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
80 | { |
81 | JSAudioBufferSourceNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSAudioBufferSourceNodePrototype>(vm.heap)) JSAudioBufferSourceNodePrototype(vm, globalObject, structure); |
82 | ptr->finishCreation(vm); |
83 | return ptr; |
84 | } |
85 | |
86 | DECLARE_INFO; |
87 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
88 | { |
89 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
90 | } |
91 | |
92 | private: |
93 | JSAudioBufferSourceNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
94 | : JSC::JSNonFinalObject(vm, structure) |
95 | { |
96 | } |
97 | |
98 | void finishCreation(JSC::VM&); |
99 | }; |
100 | |
101 | using JSAudioBufferSourceNodeConstructor = JSDOMConstructorNotConstructable<JSAudioBufferSourceNode>; |
102 | |
103 | /* Hash table for constructor */ |
104 | |
105 | static const HashTableValue JSAudioBufferSourceNodeConstructorTableValues[] = |
106 | { |
107 | { "UNSCHEDULED_STATE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
108 | { "SCHEDULED_STATE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
109 | { "PLAYING_STATE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
110 | { "FINISHED_STATE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
111 | }; |
112 | |
113 | static_assert(AudioBufferSourceNode::UNSCHEDULED_STATE == 0, "UNSCHEDULED_STATE in AudioBufferSourceNode does not match value from IDL" ); |
114 | static_assert(AudioBufferSourceNode::SCHEDULED_STATE == 1, "SCHEDULED_STATE in AudioBufferSourceNode does not match value from IDL" ); |
115 | static_assert(AudioBufferSourceNode::PLAYING_STATE == 2, "PLAYING_STATE in AudioBufferSourceNode does not match value from IDL" ); |
116 | static_assert(AudioBufferSourceNode::FINISHED_STATE == 3, "FINISHED_STATE in AudioBufferSourceNode does not match value from IDL" ); |
117 | |
118 | template<> JSValue JSAudioBufferSourceNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
119 | { |
120 | return JSAudioNode::getConstructor(vm, &globalObject); |
121 | } |
122 | |
123 | template<> void JSAudioBufferSourceNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
124 | { |
125 | putDirect(vm, vm.propertyNames->prototype, JSAudioBufferSourceNode::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
126 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("AudioBufferSourceNode"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
127 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
128 | reifyStaticProperties(vm, JSAudioBufferSourceNode::info(), JSAudioBufferSourceNodeConstructorTableValues, *this); |
129 | } |
130 | |
131 | template<> const ClassInfo JSAudioBufferSourceNodeConstructor::s_info = { "AudioBufferSourceNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioBufferSourceNodeConstructor) }; |
132 | |
133 | /* Hash table for prototype */ |
134 | |
135 | static const HashTableValue JSAudioBufferSourceNodePrototypeTableValues[] = |
136 | { |
137 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioBufferSourceNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioBufferSourceNodeConstructor) } }, |
138 | { "buffer" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioBufferSourceNodeBuffer), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioBufferSourceNodeBuffer) } }, |
139 | { "playbackState" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioBufferSourceNodePlaybackState), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
140 | { "gain" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioBufferSourceNodeGain), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
141 | { "playbackRate" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioBufferSourceNodePlaybackRate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
142 | { "loop" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioBufferSourceNodeLoop), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioBufferSourceNodeLoop) } }, |
143 | { "loopStart" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioBufferSourceNodeLoopStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioBufferSourceNodeLoopStart) } }, |
144 | { "loopEnd" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioBufferSourceNodeLoopEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioBufferSourceNodeLoopEnd) } }, |
145 | { "onended" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioBufferSourceNodeOnended), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioBufferSourceNodeOnended) } }, |
146 | { "start" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioBufferSourceNodePrototypeFunctionStart), (intptr_t) (0) } }, |
147 | { "stop" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAudioBufferSourceNodePrototypeFunctionStop), (intptr_t) (0) } }, |
148 | { "UNSCHEDULED_STATE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
149 | { "SCHEDULED_STATE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
150 | { "PLAYING_STATE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
151 | { "FINISHED_STATE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
152 | }; |
153 | |
154 | const ClassInfo JSAudioBufferSourceNodePrototype::s_info = { "AudioBufferSourceNodePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioBufferSourceNodePrototype) }; |
155 | |
156 | void JSAudioBufferSourceNodePrototype::finishCreation(VM& vm) |
157 | { |
158 | Base::finishCreation(vm); |
159 | reifyStaticProperties(vm, JSAudioBufferSourceNode::info(), JSAudioBufferSourceNodePrototypeTableValues, *this); |
160 | } |
161 | |
162 | const ClassInfo JSAudioBufferSourceNode::s_info = { "AudioBufferSourceNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioBufferSourceNode) }; |
163 | |
164 | JSAudioBufferSourceNode::JSAudioBufferSourceNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AudioBufferSourceNode>&& impl) |
165 | : JSAudioNode(structure, globalObject, WTFMove(impl)) |
166 | { |
167 | } |
168 | |
169 | void JSAudioBufferSourceNode::finishCreation(VM& vm) |
170 | { |
171 | Base::finishCreation(vm); |
172 | ASSERT(inherits(vm, info())); |
173 | |
174 | } |
175 | |
176 | JSObject* JSAudioBufferSourceNode::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
177 | { |
178 | return JSAudioBufferSourceNodePrototype::create(vm, &globalObject, JSAudioBufferSourceNodePrototype::createStructure(vm, &globalObject, JSAudioNode::prototype(vm, globalObject))); |
179 | } |
180 | |
181 | JSObject* JSAudioBufferSourceNode::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
182 | { |
183 | return getDOMPrototype<JSAudioBufferSourceNode>(vm, globalObject); |
184 | } |
185 | |
186 | JSValue JSAudioBufferSourceNode::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
187 | { |
188 | return getDOMConstructor<JSAudioBufferSourceNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
189 | } |
190 | |
191 | template<> inline JSAudioBufferSourceNode* IDLAttribute<JSAudioBufferSourceNode>::cast(ExecState& state, EncodedJSValue thisValue) |
192 | { |
193 | return jsDynamicCast<JSAudioBufferSourceNode*>(state.vm(), JSValue::decode(thisValue)); |
194 | } |
195 | |
196 | template<> inline JSAudioBufferSourceNode* IDLOperation<JSAudioBufferSourceNode>::cast(ExecState& state) |
197 | { |
198 | return jsDynamicCast<JSAudioBufferSourceNode*>(state.vm(), state.thisValue()); |
199 | } |
200 | |
201 | EncodedJSValue jsAudioBufferSourceNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
202 | { |
203 | VM& vm = state->vm(); |
204 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
205 | auto* prototype = jsDynamicCast<JSAudioBufferSourceNodePrototype*>(vm, JSValue::decode(thisValue)); |
206 | if (UNLIKELY(!prototype)) |
207 | return throwVMTypeError(state, throwScope); |
208 | return JSValue::encode(JSAudioBufferSourceNode::getConstructor(state->vm(), prototype->globalObject())); |
209 | } |
210 | |
211 | bool setJSAudioBufferSourceNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
212 | { |
213 | VM& vm = state->vm(); |
214 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
215 | auto* prototype = jsDynamicCast<JSAudioBufferSourceNodePrototype*>(vm, JSValue::decode(thisValue)); |
216 | if (UNLIKELY(!prototype)) { |
217 | throwVMTypeError(state, throwScope); |
218 | return false; |
219 | } |
220 | // Shadowing a built-in constructor |
221 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
222 | } |
223 | |
224 | static inline JSValue jsAudioBufferSourceNodeBufferGetter(ExecState& state, JSAudioBufferSourceNode& thisObject, ThrowScope& throwScope) |
225 | { |
226 | UNUSED_PARAM(throwScope); |
227 | UNUSED_PARAM(state); |
228 | auto& impl = thisObject.wrapped(); |
229 | JSValue result = toJS<IDLNullable<IDLInterface<AudioBuffer>>>(state, *thisObject.globalObject(), throwScope, impl.buffer()); |
230 | return result; |
231 | } |
232 | |
233 | EncodedJSValue jsAudioBufferSourceNodeBuffer(ExecState* state, EncodedJSValue thisValue, PropertyName) |
234 | { |
235 | return IDLAttribute<JSAudioBufferSourceNode>::get<jsAudioBufferSourceNodeBufferGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "buffer" ); |
236 | } |
237 | |
238 | static inline bool setJSAudioBufferSourceNodeBufferSetter(ExecState& state, JSAudioBufferSourceNode& thisObject, JSValue value, ThrowScope& throwScope) |
239 | { |
240 | UNUSED_PARAM(throwScope); |
241 | auto& impl = thisObject.wrapped(); |
242 | auto nativeValue = convert<IDLNullable<IDLInterface<AudioBuffer>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "AudioBufferSourceNode" , "buffer" , "AudioBuffer" ); }); |
243 | RETURN_IF_EXCEPTION(throwScope, false); |
244 | AttributeSetter::call(state, throwScope, [&] { |
245 | return impl.setBuffer(WTFMove(nativeValue)); |
246 | }); |
247 | return true; |
248 | } |
249 | |
250 | bool setJSAudioBufferSourceNodeBuffer(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
251 | { |
252 | return IDLAttribute<JSAudioBufferSourceNode>::set<setJSAudioBufferSourceNodeBufferSetter>(*state, thisValue, encodedValue, "buffer" ); |
253 | } |
254 | |
255 | static inline JSValue jsAudioBufferSourceNodePlaybackStateGetter(ExecState& state, JSAudioBufferSourceNode& thisObject, ThrowScope& throwScope) |
256 | { |
257 | UNUSED_PARAM(throwScope); |
258 | UNUSED_PARAM(state); |
259 | auto& impl = thisObject.wrapped(); |
260 | JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.playbackState()); |
261 | return result; |
262 | } |
263 | |
264 | EncodedJSValue jsAudioBufferSourceNodePlaybackState(ExecState* state, EncodedJSValue thisValue, PropertyName) |
265 | { |
266 | return IDLAttribute<JSAudioBufferSourceNode>::get<jsAudioBufferSourceNodePlaybackStateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "playbackState" ); |
267 | } |
268 | |
269 | static inline JSValue jsAudioBufferSourceNodeGainGetter(ExecState& state, JSAudioBufferSourceNode& thisObject, ThrowScope& throwScope) |
270 | { |
271 | UNUSED_PARAM(throwScope); |
272 | UNUSED_PARAM(state); |
273 | auto& impl = thisObject.wrapped(); |
274 | JSValue result = toJS<IDLInterface<AudioParam>>(state, *thisObject.globalObject(), throwScope, impl.gain()); |
275 | return result; |
276 | } |
277 | |
278 | EncodedJSValue jsAudioBufferSourceNodeGain(ExecState* state, EncodedJSValue thisValue, PropertyName) |
279 | { |
280 | return IDLAttribute<JSAudioBufferSourceNode>::get<jsAudioBufferSourceNodeGainGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "gain" ); |
281 | } |
282 | |
283 | static inline JSValue jsAudioBufferSourceNodePlaybackRateGetter(ExecState& state, JSAudioBufferSourceNode& thisObject, ThrowScope& throwScope) |
284 | { |
285 | UNUSED_PARAM(throwScope); |
286 | UNUSED_PARAM(state); |
287 | auto& impl = thisObject.wrapped(); |
288 | JSValue result = toJS<IDLInterface<AudioParam>>(state, *thisObject.globalObject(), throwScope, impl.playbackRate()); |
289 | return result; |
290 | } |
291 | |
292 | EncodedJSValue jsAudioBufferSourceNodePlaybackRate(ExecState* state, EncodedJSValue thisValue, PropertyName) |
293 | { |
294 | return IDLAttribute<JSAudioBufferSourceNode>::get<jsAudioBufferSourceNodePlaybackRateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "playbackRate" ); |
295 | } |
296 | |
297 | static inline JSValue jsAudioBufferSourceNodeLoopGetter(ExecState& state, JSAudioBufferSourceNode& thisObject, ThrowScope& throwScope) |
298 | { |
299 | UNUSED_PARAM(throwScope); |
300 | UNUSED_PARAM(state); |
301 | auto& impl = thisObject.wrapped(); |
302 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.loop()); |
303 | return result; |
304 | } |
305 | |
306 | EncodedJSValue jsAudioBufferSourceNodeLoop(ExecState* state, EncodedJSValue thisValue, PropertyName) |
307 | { |
308 | return IDLAttribute<JSAudioBufferSourceNode>::get<jsAudioBufferSourceNodeLoopGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "loop" ); |
309 | } |
310 | |
311 | static inline bool setJSAudioBufferSourceNodeLoopSetter(ExecState& state, JSAudioBufferSourceNode& thisObject, JSValue value, ThrowScope& throwScope) |
312 | { |
313 | UNUSED_PARAM(throwScope); |
314 | auto& impl = thisObject.wrapped(); |
315 | auto nativeValue = convert<IDLBoolean>(state, value); |
316 | RETURN_IF_EXCEPTION(throwScope, false); |
317 | AttributeSetter::call(state, throwScope, [&] { |
318 | return impl.setLoop(WTFMove(nativeValue)); |
319 | }); |
320 | return true; |
321 | } |
322 | |
323 | bool setJSAudioBufferSourceNodeLoop(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
324 | { |
325 | return IDLAttribute<JSAudioBufferSourceNode>::set<setJSAudioBufferSourceNodeLoopSetter>(*state, thisValue, encodedValue, "loop" ); |
326 | } |
327 | |
328 | static inline JSValue jsAudioBufferSourceNodeLoopStartGetter(ExecState& state, JSAudioBufferSourceNode& thisObject, ThrowScope& throwScope) |
329 | { |
330 | UNUSED_PARAM(throwScope); |
331 | UNUSED_PARAM(state); |
332 | auto& impl = thisObject.wrapped(); |
333 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.loopStart()); |
334 | return result; |
335 | } |
336 | |
337 | EncodedJSValue jsAudioBufferSourceNodeLoopStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
338 | { |
339 | return IDLAttribute<JSAudioBufferSourceNode>::get<jsAudioBufferSourceNodeLoopStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "loopStart" ); |
340 | } |
341 | |
342 | static inline bool setJSAudioBufferSourceNodeLoopStartSetter(ExecState& state, JSAudioBufferSourceNode& thisObject, JSValue value, ThrowScope& throwScope) |
343 | { |
344 | UNUSED_PARAM(throwScope); |
345 | auto& impl = thisObject.wrapped(); |
346 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
347 | RETURN_IF_EXCEPTION(throwScope, false); |
348 | AttributeSetter::call(state, throwScope, [&] { |
349 | return impl.setLoopStart(WTFMove(nativeValue)); |
350 | }); |
351 | return true; |
352 | } |
353 | |
354 | bool setJSAudioBufferSourceNodeLoopStart(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
355 | { |
356 | return IDLAttribute<JSAudioBufferSourceNode>::set<setJSAudioBufferSourceNodeLoopStartSetter>(*state, thisValue, encodedValue, "loopStart" ); |
357 | } |
358 | |
359 | static inline JSValue jsAudioBufferSourceNodeLoopEndGetter(ExecState& state, JSAudioBufferSourceNode& thisObject, ThrowScope& throwScope) |
360 | { |
361 | UNUSED_PARAM(throwScope); |
362 | UNUSED_PARAM(state); |
363 | auto& impl = thisObject.wrapped(); |
364 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.loopEnd()); |
365 | return result; |
366 | } |
367 | |
368 | EncodedJSValue jsAudioBufferSourceNodeLoopEnd(ExecState* state, EncodedJSValue thisValue, PropertyName) |
369 | { |
370 | return IDLAttribute<JSAudioBufferSourceNode>::get<jsAudioBufferSourceNodeLoopEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "loopEnd" ); |
371 | } |
372 | |
373 | static inline bool setJSAudioBufferSourceNodeLoopEndSetter(ExecState& state, JSAudioBufferSourceNode& thisObject, JSValue value, ThrowScope& throwScope) |
374 | { |
375 | UNUSED_PARAM(throwScope); |
376 | auto& impl = thisObject.wrapped(); |
377 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
378 | RETURN_IF_EXCEPTION(throwScope, false); |
379 | AttributeSetter::call(state, throwScope, [&] { |
380 | return impl.setLoopEnd(WTFMove(nativeValue)); |
381 | }); |
382 | return true; |
383 | } |
384 | |
385 | bool setJSAudioBufferSourceNodeLoopEnd(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
386 | { |
387 | return IDLAttribute<JSAudioBufferSourceNode>::set<setJSAudioBufferSourceNodeLoopEndSetter>(*state, thisValue, encodedValue, "loopEnd" ); |
388 | } |
389 | |
390 | static inline JSValue jsAudioBufferSourceNodeOnendedGetter(ExecState& state, JSAudioBufferSourceNode& thisObject, ThrowScope& throwScope) |
391 | { |
392 | UNUSED_PARAM(throwScope); |
393 | UNUSED_PARAM(state); |
394 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().endedEvent, worldForDOMObject(thisObject)); |
395 | } |
396 | |
397 | EncodedJSValue jsAudioBufferSourceNodeOnended(ExecState* state, EncodedJSValue thisValue, PropertyName) |
398 | { |
399 | return IDLAttribute<JSAudioBufferSourceNode>::get<jsAudioBufferSourceNodeOnendedGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onended" ); |
400 | } |
401 | |
402 | static inline bool setJSAudioBufferSourceNodeOnendedSetter(ExecState& state, JSAudioBufferSourceNode& thisObject, JSValue value, ThrowScope& throwScope) |
403 | { |
404 | UNUSED_PARAM(throwScope); |
405 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().endedEvent, value); |
406 | return true; |
407 | } |
408 | |
409 | bool setJSAudioBufferSourceNodeOnended(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
410 | { |
411 | return IDLAttribute<JSAudioBufferSourceNode>::set<setJSAudioBufferSourceNodeOnendedSetter>(*state, thisValue, encodedValue, "onended" ); |
412 | } |
413 | |
414 | static inline JSC::EncodedJSValue jsAudioBufferSourceNodePrototypeFunctionStartBody(JSC::ExecState* state, typename IDLOperation<JSAudioBufferSourceNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
415 | { |
416 | UNUSED_PARAM(state); |
417 | UNUSED_PARAM(throwScope); |
418 | auto& impl = castedThis->wrapped(); |
419 | auto when = state->argument(0).isUndefined() ? 0 : convert<IDLUnrestrictedDouble>(*state, state->uncheckedArgument(0)); |
420 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
421 | auto grainOffset = state->argument(1).isUndefined() ? 0 : convert<IDLUnrestrictedDouble>(*state, state->uncheckedArgument(1)); |
422 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
423 | auto grainDuration = state->argument(2).isUndefined() ? Optional<Converter<IDLUnrestrictedDouble>::ReturnType>() : Optional<Converter<IDLUnrestrictedDouble>::ReturnType>(convert<IDLUnrestrictedDouble>(*state, state->uncheckedArgument(2))); |
424 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
425 | propagateException(*state, throwScope, impl.start(WTFMove(when), WTFMove(grainOffset), WTFMove(grainDuration))); |
426 | return JSValue::encode(jsUndefined()); |
427 | } |
428 | |
429 | EncodedJSValue JSC_HOST_CALL jsAudioBufferSourceNodePrototypeFunctionStart(ExecState* state) |
430 | { |
431 | return IDLOperation<JSAudioBufferSourceNode>::call<jsAudioBufferSourceNodePrototypeFunctionStartBody>(*state, "start" ); |
432 | } |
433 | |
434 | static inline JSC::EncodedJSValue jsAudioBufferSourceNodePrototypeFunctionStopBody(JSC::ExecState* state, typename IDLOperation<JSAudioBufferSourceNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
435 | { |
436 | UNUSED_PARAM(state); |
437 | UNUSED_PARAM(throwScope); |
438 | auto& impl = castedThis->wrapped(); |
439 | auto when = state->argument(0).isUndefined() ? 0 : convert<IDLUnrestrictedDouble>(*state, state->uncheckedArgument(0)); |
440 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
441 | propagateException(*state, throwScope, impl.stop(WTFMove(when))); |
442 | return JSValue::encode(jsUndefined()); |
443 | } |
444 | |
445 | EncodedJSValue JSC_HOST_CALL jsAudioBufferSourceNodePrototypeFunctionStop(ExecState* state) |
446 | { |
447 | return IDLOperation<JSAudioBufferSourceNode>::call<jsAudioBufferSourceNodePrototypeFunctionStopBody>(*state, "stop" ); |
448 | } |
449 | |
450 | void JSAudioBufferSourceNode::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
451 | { |
452 | auto* thisObject = jsCast<JSAudioBufferSourceNode*>(cell); |
453 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
454 | if (thisObject->scriptExecutionContext()) |
455 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
456 | Base::heapSnapshot(cell, builder); |
457 | } |
458 | |
459 | #if ENABLE(BINDING_INTEGRITY) |
460 | #if PLATFORM(WIN) |
461 | #pragma warning(disable: 4483) |
462 | extern "C" { extern void (*const __identifier("??_7AudioBufferSourceNode@WebCore@@6B@" )[])(); } |
463 | #else |
464 | extern "C" { extern void* _ZTVN7WebCore21AudioBufferSourceNodeE[]; } |
465 | #endif |
466 | #endif |
467 | |
468 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<AudioBufferSourceNode>&& impl) |
469 | { |
470 | |
471 | #if ENABLE(BINDING_INTEGRITY) |
472 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
473 | #if PLATFORM(WIN) |
474 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7AudioBufferSourceNode@WebCore@@6B@" )); |
475 | #else |
476 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore21AudioBufferSourceNodeE[2]); |
477 | #endif |
478 | |
479 | // If this fails AudioBufferSourceNode does not have a vtable, so you need to add the |
480 | // ImplementationLacksVTable attribute to the interface definition |
481 | static_assert(std::is_polymorphic<AudioBufferSourceNode>::value, "AudioBufferSourceNode is not polymorphic" ); |
482 | |
483 | // If you hit this assertion you either have a use after free bug, or |
484 | // AudioBufferSourceNode has subclasses. If AudioBufferSourceNode has subclasses that get passed |
485 | // to toJS() we currently require AudioBufferSourceNode you to opt out of binding hardening |
486 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
487 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
488 | #endif |
489 | return createWrapper<AudioBufferSourceNode>(globalObject, WTFMove(impl)); |
490 | } |
491 | |
492 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, AudioBufferSourceNode& impl) |
493 | { |
494 | return wrap(state, globalObject, impl); |
495 | } |
496 | |
497 | |
498 | } |
499 | |
500 | #endif // ENABLE(WEB_AUDIO) |
501 | |