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 "JSAnalyserNode.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 "JSDOMExceptionHandling.h" |
34 | #include "JSDOMOperation.h" |
35 | #include "JSDOMWrapperCache.h" |
36 | #include "ScriptExecutionContext.h" |
37 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
38 | #include <JavaScriptCore/JSCInlines.h> |
39 | #include <wtf/GetPtr.h> |
40 | #include <wtf/PointerPreparations.h> |
41 | #include <wtf/URL.h> |
42 | |
43 | |
44 | namespace WebCore { |
45 | using namespace JSC; |
46 | |
47 | // Functions |
48 | |
49 | JSC::EncodedJSValue JSC_HOST_CALL jsAnalyserNodePrototypeFunctionGetFloatFrequencyData(JSC::ExecState*); |
50 | JSC::EncodedJSValue JSC_HOST_CALL jsAnalyserNodePrototypeFunctionGetByteFrequencyData(JSC::ExecState*); |
51 | JSC::EncodedJSValue JSC_HOST_CALL jsAnalyserNodePrototypeFunctionGetByteTimeDomainData(JSC::ExecState*); |
52 | |
53 | // Attributes |
54 | |
55 | JSC::EncodedJSValue jsAnalyserNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
56 | bool setJSAnalyserNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
57 | JSC::EncodedJSValue jsAnalyserNodeFftSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
58 | bool setJSAnalyserNodeFftSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
59 | JSC::EncodedJSValue jsAnalyserNodeFrequencyBinCount(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
60 | JSC::EncodedJSValue jsAnalyserNodeMinDecibels(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
61 | bool setJSAnalyserNodeMinDecibels(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
62 | JSC::EncodedJSValue jsAnalyserNodeMaxDecibels(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | bool setJSAnalyserNodeMaxDecibels(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
64 | JSC::EncodedJSValue jsAnalyserNodeSmoothingTimeConstant(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
65 | bool setJSAnalyserNodeSmoothingTimeConstant(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
66 | |
67 | class JSAnalyserNodePrototype : public JSC::JSNonFinalObject { |
68 | public: |
69 | using Base = JSC::JSNonFinalObject; |
70 | static JSAnalyserNodePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
71 | { |
72 | JSAnalyserNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSAnalyserNodePrototype>(vm.heap)) JSAnalyserNodePrototype(vm, globalObject, structure); |
73 | ptr->finishCreation(vm); |
74 | return ptr; |
75 | } |
76 | |
77 | DECLARE_INFO; |
78 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
79 | { |
80 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
81 | } |
82 | |
83 | private: |
84 | JSAnalyserNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
85 | : JSC::JSNonFinalObject(vm, structure) |
86 | { |
87 | } |
88 | |
89 | void finishCreation(JSC::VM&); |
90 | }; |
91 | |
92 | using JSAnalyserNodeConstructor = JSDOMConstructorNotConstructable<JSAnalyserNode>; |
93 | |
94 | template<> JSValue JSAnalyserNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
95 | { |
96 | return JSAudioNode::getConstructor(vm, &globalObject); |
97 | } |
98 | |
99 | template<> void JSAnalyserNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
100 | { |
101 | putDirect(vm, vm.propertyNames->prototype, JSAnalyserNode::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
102 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("AnalyserNode"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
103 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
104 | } |
105 | |
106 | template<> const ClassInfo JSAnalyserNodeConstructor::s_info = { "AnalyserNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAnalyserNodeConstructor) }; |
107 | |
108 | /* Hash table for prototype */ |
109 | |
110 | static const HashTableValue JSAnalyserNodePrototypeTableValues[] = |
111 | { |
112 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnalyserNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAnalyserNodeConstructor) } }, |
113 | { "fftSize" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnalyserNodeFftSize), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAnalyserNodeFftSize) } }, |
114 | { "frequencyBinCount" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnalyserNodeFrequencyBinCount), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
115 | { "minDecibels" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnalyserNodeMinDecibels), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAnalyserNodeMinDecibels) } }, |
116 | { "maxDecibels" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnalyserNodeMaxDecibels), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAnalyserNodeMaxDecibels) } }, |
117 | { "smoothingTimeConstant" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnalyserNodeSmoothingTimeConstant), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAnalyserNodeSmoothingTimeConstant) } }, |
118 | { "getFloatFrequencyData" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAnalyserNodePrototypeFunctionGetFloatFrequencyData), (intptr_t) (1) } }, |
119 | { "getByteFrequencyData" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAnalyserNodePrototypeFunctionGetByteFrequencyData), (intptr_t) (1) } }, |
120 | { "getByteTimeDomainData" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsAnalyserNodePrototypeFunctionGetByteTimeDomainData), (intptr_t) (1) } }, |
121 | }; |
122 | |
123 | const ClassInfo JSAnalyserNodePrototype::s_info = { "AnalyserNodePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAnalyserNodePrototype) }; |
124 | |
125 | void JSAnalyserNodePrototype::finishCreation(VM& vm) |
126 | { |
127 | Base::finishCreation(vm); |
128 | reifyStaticProperties(vm, JSAnalyserNode::info(), JSAnalyserNodePrototypeTableValues, *this); |
129 | } |
130 | |
131 | const ClassInfo JSAnalyserNode::s_info = { "AnalyserNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAnalyserNode) }; |
132 | |
133 | JSAnalyserNode::JSAnalyserNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AnalyserNode>&& impl) |
134 | : JSAudioNode(structure, globalObject, WTFMove(impl)) |
135 | { |
136 | } |
137 | |
138 | void JSAnalyserNode::finishCreation(VM& vm) |
139 | { |
140 | Base::finishCreation(vm); |
141 | ASSERT(inherits(vm, info())); |
142 | |
143 | } |
144 | |
145 | JSObject* JSAnalyserNode::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
146 | { |
147 | return JSAnalyserNodePrototype::create(vm, &globalObject, JSAnalyserNodePrototype::createStructure(vm, &globalObject, JSAudioNode::prototype(vm, globalObject))); |
148 | } |
149 | |
150 | JSObject* JSAnalyserNode::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
151 | { |
152 | return getDOMPrototype<JSAnalyserNode>(vm, globalObject); |
153 | } |
154 | |
155 | JSValue JSAnalyserNode::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
156 | { |
157 | return getDOMConstructor<JSAnalyserNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
158 | } |
159 | |
160 | template<> inline JSAnalyserNode* IDLAttribute<JSAnalyserNode>::cast(ExecState& state, EncodedJSValue thisValue) |
161 | { |
162 | return jsDynamicCast<JSAnalyserNode*>(state.vm(), JSValue::decode(thisValue)); |
163 | } |
164 | |
165 | template<> inline JSAnalyserNode* IDLOperation<JSAnalyserNode>::cast(ExecState& state) |
166 | { |
167 | return jsDynamicCast<JSAnalyserNode*>(state.vm(), state.thisValue()); |
168 | } |
169 | |
170 | EncodedJSValue jsAnalyserNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
171 | { |
172 | VM& vm = state->vm(); |
173 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
174 | auto* prototype = jsDynamicCast<JSAnalyserNodePrototype*>(vm, JSValue::decode(thisValue)); |
175 | if (UNLIKELY(!prototype)) |
176 | return throwVMTypeError(state, throwScope); |
177 | return JSValue::encode(JSAnalyserNode::getConstructor(state->vm(), prototype->globalObject())); |
178 | } |
179 | |
180 | bool setJSAnalyserNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
181 | { |
182 | VM& vm = state->vm(); |
183 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
184 | auto* prototype = jsDynamicCast<JSAnalyserNodePrototype*>(vm, JSValue::decode(thisValue)); |
185 | if (UNLIKELY(!prototype)) { |
186 | throwVMTypeError(state, throwScope); |
187 | return false; |
188 | } |
189 | // Shadowing a built-in constructor |
190 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
191 | } |
192 | |
193 | static inline JSValue jsAnalyserNodeFftSizeGetter(ExecState& state, JSAnalyserNode& thisObject, ThrowScope& throwScope) |
194 | { |
195 | UNUSED_PARAM(throwScope); |
196 | UNUSED_PARAM(state); |
197 | auto& impl = thisObject.wrapped(); |
198 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.fftSize()); |
199 | return result; |
200 | } |
201 | |
202 | EncodedJSValue jsAnalyserNodeFftSize(ExecState* state, EncodedJSValue thisValue, PropertyName) |
203 | { |
204 | return IDLAttribute<JSAnalyserNode>::get<jsAnalyserNodeFftSizeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "fftSize" ); |
205 | } |
206 | |
207 | static inline bool setJSAnalyserNodeFftSizeSetter(ExecState& state, JSAnalyserNode& thisObject, JSValue value, ThrowScope& throwScope) |
208 | { |
209 | UNUSED_PARAM(throwScope); |
210 | auto& impl = thisObject.wrapped(); |
211 | auto nativeValue = convert<IDLUnsignedLong>(state, value); |
212 | RETURN_IF_EXCEPTION(throwScope, false); |
213 | AttributeSetter::call(state, throwScope, [&] { |
214 | return impl.setFftSize(WTFMove(nativeValue)); |
215 | }); |
216 | return true; |
217 | } |
218 | |
219 | bool setJSAnalyserNodeFftSize(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
220 | { |
221 | return IDLAttribute<JSAnalyserNode>::set<setJSAnalyserNodeFftSizeSetter>(*state, thisValue, encodedValue, "fftSize" ); |
222 | } |
223 | |
224 | static inline JSValue jsAnalyserNodeFrequencyBinCountGetter(ExecState& state, JSAnalyserNode& 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.frequencyBinCount()); |
230 | return result; |
231 | } |
232 | |
233 | EncodedJSValue jsAnalyserNodeFrequencyBinCount(ExecState* state, EncodedJSValue thisValue, PropertyName) |
234 | { |
235 | return IDLAttribute<JSAnalyserNode>::get<jsAnalyserNodeFrequencyBinCountGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "frequencyBinCount" ); |
236 | } |
237 | |
238 | static inline JSValue jsAnalyserNodeMinDecibelsGetter(ExecState& state, JSAnalyserNode& thisObject, ThrowScope& throwScope) |
239 | { |
240 | UNUSED_PARAM(throwScope); |
241 | UNUSED_PARAM(state); |
242 | auto& impl = thisObject.wrapped(); |
243 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.minDecibels()); |
244 | return result; |
245 | } |
246 | |
247 | EncodedJSValue jsAnalyserNodeMinDecibels(ExecState* state, EncodedJSValue thisValue, PropertyName) |
248 | { |
249 | return IDLAttribute<JSAnalyserNode>::get<jsAnalyserNodeMinDecibelsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "minDecibels" ); |
250 | } |
251 | |
252 | static inline bool setJSAnalyserNodeMinDecibelsSetter(ExecState& state, JSAnalyserNode& thisObject, JSValue value, ThrowScope& throwScope) |
253 | { |
254 | UNUSED_PARAM(throwScope); |
255 | auto& impl = thisObject.wrapped(); |
256 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
257 | RETURN_IF_EXCEPTION(throwScope, false); |
258 | AttributeSetter::call(state, throwScope, [&] { |
259 | return impl.setMinDecibels(WTFMove(nativeValue)); |
260 | }); |
261 | return true; |
262 | } |
263 | |
264 | bool setJSAnalyserNodeMinDecibels(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
265 | { |
266 | return IDLAttribute<JSAnalyserNode>::set<setJSAnalyserNodeMinDecibelsSetter>(*state, thisValue, encodedValue, "minDecibels" ); |
267 | } |
268 | |
269 | static inline JSValue jsAnalyserNodeMaxDecibelsGetter(ExecState& state, JSAnalyserNode& thisObject, ThrowScope& throwScope) |
270 | { |
271 | UNUSED_PARAM(throwScope); |
272 | UNUSED_PARAM(state); |
273 | auto& impl = thisObject.wrapped(); |
274 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.maxDecibels()); |
275 | return result; |
276 | } |
277 | |
278 | EncodedJSValue jsAnalyserNodeMaxDecibels(ExecState* state, EncodedJSValue thisValue, PropertyName) |
279 | { |
280 | return IDLAttribute<JSAnalyserNode>::get<jsAnalyserNodeMaxDecibelsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "maxDecibels" ); |
281 | } |
282 | |
283 | static inline bool setJSAnalyserNodeMaxDecibelsSetter(ExecState& state, JSAnalyserNode& thisObject, JSValue value, ThrowScope& throwScope) |
284 | { |
285 | UNUSED_PARAM(throwScope); |
286 | auto& impl = thisObject.wrapped(); |
287 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
288 | RETURN_IF_EXCEPTION(throwScope, false); |
289 | AttributeSetter::call(state, throwScope, [&] { |
290 | return impl.setMaxDecibels(WTFMove(nativeValue)); |
291 | }); |
292 | return true; |
293 | } |
294 | |
295 | bool setJSAnalyserNodeMaxDecibels(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
296 | { |
297 | return IDLAttribute<JSAnalyserNode>::set<setJSAnalyserNodeMaxDecibelsSetter>(*state, thisValue, encodedValue, "maxDecibels" ); |
298 | } |
299 | |
300 | static inline JSValue jsAnalyserNodeSmoothingTimeConstantGetter(ExecState& state, JSAnalyserNode& thisObject, ThrowScope& throwScope) |
301 | { |
302 | UNUSED_PARAM(throwScope); |
303 | UNUSED_PARAM(state); |
304 | auto& impl = thisObject.wrapped(); |
305 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.smoothingTimeConstant()); |
306 | return result; |
307 | } |
308 | |
309 | EncodedJSValue jsAnalyserNodeSmoothingTimeConstant(ExecState* state, EncodedJSValue thisValue, PropertyName) |
310 | { |
311 | return IDLAttribute<JSAnalyserNode>::get<jsAnalyserNodeSmoothingTimeConstantGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "smoothingTimeConstant" ); |
312 | } |
313 | |
314 | static inline bool setJSAnalyserNodeSmoothingTimeConstantSetter(ExecState& state, JSAnalyserNode& thisObject, JSValue value, ThrowScope& throwScope) |
315 | { |
316 | UNUSED_PARAM(throwScope); |
317 | auto& impl = thisObject.wrapped(); |
318 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
319 | RETURN_IF_EXCEPTION(throwScope, false); |
320 | AttributeSetter::call(state, throwScope, [&] { |
321 | return impl.setSmoothingTimeConstant(WTFMove(nativeValue)); |
322 | }); |
323 | return true; |
324 | } |
325 | |
326 | bool setJSAnalyserNodeSmoothingTimeConstant(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
327 | { |
328 | return IDLAttribute<JSAnalyserNode>::set<setJSAnalyserNodeSmoothingTimeConstantSetter>(*state, thisValue, encodedValue, "smoothingTimeConstant" ); |
329 | } |
330 | |
331 | static inline JSC::EncodedJSValue jsAnalyserNodePrototypeFunctionGetFloatFrequencyDataBody(JSC::ExecState* state, typename IDLOperation<JSAnalyserNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
332 | { |
333 | UNUSED_PARAM(state); |
334 | UNUSED_PARAM(throwScope); |
335 | auto& impl = castedThis->wrapped(); |
336 | if (UNLIKELY(state->argumentCount() < 1)) |
337 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
338 | auto array = convert<IDLNullable<IDLFloat32Array>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "array" , "AnalyserNode" , "getFloatFrequencyData" , "Float32Array" ); }); |
339 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
340 | impl.getFloatFrequencyData(WTFMove(array)); |
341 | return JSValue::encode(jsUndefined()); |
342 | } |
343 | |
344 | EncodedJSValue JSC_HOST_CALL jsAnalyserNodePrototypeFunctionGetFloatFrequencyData(ExecState* state) |
345 | { |
346 | return IDLOperation<JSAnalyserNode>::call<jsAnalyserNodePrototypeFunctionGetFloatFrequencyDataBody>(*state, "getFloatFrequencyData" ); |
347 | } |
348 | |
349 | static inline JSC::EncodedJSValue jsAnalyserNodePrototypeFunctionGetByteFrequencyDataBody(JSC::ExecState* state, typename IDLOperation<JSAnalyserNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
350 | { |
351 | UNUSED_PARAM(state); |
352 | UNUSED_PARAM(throwScope); |
353 | auto& impl = castedThis->wrapped(); |
354 | if (UNLIKELY(state->argumentCount() < 1)) |
355 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
356 | auto array = convert<IDLNullable<IDLUint8Array>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "array" , "AnalyserNode" , "getByteFrequencyData" , "Uint8Array" ); }); |
357 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
358 | impl.getByteFrequencyData(WTFMove(array)); |
359 | return JSValue::encode(jsUndefined()); |
360 | } |
361 | |
362 | EncodedJSValue JSC_HOST_CALL jsAnalyserNodePrototypeFunctionGetByteFrequencyData(ExecState* state) |
363 | { |
364 | return IDLOperation<JSAnalyserNode>::call<jsAnalyserNodePrototypeFunctionGetByteFrequencyDataBody>(*state, "getByteFrequencyData" ); |
365 | } |
366 | |
367 | static inline JSC::EncodedJSValue jsAnalyserNodePrototypeFunctionGetByteTimeDomainDataBody(JSC::ExecState* state, typename IDLOperation<JSAnalyserNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
368 | { |
369 | UNUSED_PARAM(state); |
370 | UNUSED_PARAM(throwScope); |
371 | auto& impl = castedThis->wrapped(); |
372 | if (UNLIKELY(state->argumentCount() < 1)) |
373 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
374 | auto array = convert<IDLNullable<IDLUint8Array>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "array" , "AnalyserNode" , "getByteTimeDomainData" , "Uint8Array" ); }); |
375 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
376 | impl.getByteTimeDomainData(WTFMove(array)); |
377 | return JSValue::encode(jsUndefined()); |
378 | } |
379 | |
380 | EncodedJSValue JSC_HOST_CALL jsAnalyserNodePrototypeFunctionGetByteTimeDomainData(ExecState* state) |
381 | { |
382 | return IDLOperation<JSAnalyserNode>::call<jsAnalyserNodePrototypeFunctionGetByteTimeDomainDataBody>(*state, "getByteTimeDomainData" ); |
383 | } |
384 | |
385 | void JSAnalyserNode::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
386 | { |
387 | auto* thisObject = jsCast<JSAnalyserNode*>(cell); |
388 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
389 | if (thisObject->scriptExecutionContext()) |
390 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
391 | Base::heapSnapshot(cell, builder); |
392 | } |
393 | |
394 | #if ENABLE(BINDING_INTEGRITY) |
395 | #if PLATFORM(WIN) |
396 | #pragma warning(disable: 4483) |
397 | extern "C" { extern void (*const __identifier("??_7AnalyserNode@WebCore@@6B@" )[])(); } |
398 | #else |
399 | extern "C" { extern void* _ZTVN7WebCore12AnalyserNodeE[]; } |
400 | #endif |
401 | #endif |
402 | |
403 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<AnalyserNode>&& impl) |
404 | { |
405 | |
406 | #if ENABLE(BINDING_INTEGRITY) |
407 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
408 | #if PLATFORM(WIN) |
409 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7AnalyserNode@WebCore@@6B@" )); |
410 | #else |
411 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore12AnalyserNodeE[2]); |
412 | #endif |
413 | |
414 | // If this fails AnalyserNode does not have a vtable, so you need to add the |
415 | // ImplementationLacksVTable attribute to the interface definition |
416 | static_assert(std::is_polymorphic<AnalyserNode>::value, "AnalyserNode is not polymorphic" ); |
417 | |
418 | // If you hit this assertion you either have a use after free bug, or |
419 | // AnalyserNode has subclasses. If AnalyserNode has subclasses that get passed |
420 | // to toJS() we currently require AnalyserNode you to opt out of binding hardening |
421 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
422 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
423 | #endif |
424 | return createWrapper<AnalyserNode>(globalObject, WTFMove(impl)); |
425 | } |
426 | |
427 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, AnalyserNode& impl) |
428 | { |
429 | return wrap(state, globalObject, impl); |
430 | } |
431 | |
432 | |
433 | } |
434 | |
435 | #endif // ENABLE(WEB_AUDIO) |
436 | |