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 "JSAudioProcessingEvent.h" |
26 | |
27 | #include "JSAudioBuffer.h" |
28 | #include "JSDOMAttribute.h" |
29 | #include "JSDOMBinding.h" |
30 | #include "JSDOMConstructorNotConstructable.h" |
31 | #include "JSDOMConvertInterface.h" |
32 | #include "JSDOMConvertNumbers.h" |
33 | #include "JSDOMExceptionHandling.h" |
34 | #include "JSDOMGlobalObject.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 | // Attributes |
48 | |
49 | JSC::EncodedJSValue jsAudioProcessingEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
50 | bool setJSAudioProcessingEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
51 | JSC::EncodedJSValue jsAudioProcessingEventPlaybackTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | JSC::EncodedJSValue jsAudioProcessingEventInputBuffer(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
53 | JSC::EncodedJSValue jsAudioProcessingEventOutputBuffer(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
54 | |
55 | class JSAudioProcessingEventPrototype : public JSC::JSNonFinalObject { |
56 | public: |
57 | using Base = JSC::JSNonFinalObject; |
58 | static JSAudioProcessingEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
59 | { |
60 | JSAudioProcessingEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSAudioProcessingEventPrototype>(vm.heap)) JSAudioProcessingEventPrototype(vm, globalObject, structure); |
61 | ptr->finishCreation(vm); |
62 | return ptr; |
63 | } |
64 | |
65 | DECLARE_INFO; |
66 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
67 | { |
68 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
69 | } |
70 | |
71 | private: |
72 | JSAudioProcessingEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
73 | : JSC::JSNonFinalObject(vm, structure) |
74 | { |
75 | } |
76 | |
77 | void finishCreation(JSC::VM&); |
78 | }; |
79 | |
80 | using JSAudioProcessingEventConstructor = JSDOMConstructorNotConstructable<JSAudioProcessingEvent>; |
81 | |
82 | template<> JSValue JSAudioProcessingEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
83 | { |
84 | return JSEvent::getConstructor(vm, &globalObject); |
85 | } |
86 | |
87 | template<> void JSAudioProcessingEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
88 | { |
89 | putDirect(vm, vm.propertyNames->prototype, JSAudioProcessingEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
90 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("AudioProcessingEvent"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
91 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
92 | } |
93 | |
94 | template<> const ClassInfo JSAudioProcessingEventConstructor::s_info = { "AudioProcessingEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioProcessingEventConstructor) }; |
95 | |
96 | /* Hash table for prototype */ |
97 | |
98 | static const HashTableValue JSAudioProcessingEventPrototypeTableValues[] = |
99 | { |
100 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioProcessingEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAudioProcessingEventConstructor) } }, |
101 | { "playbackTime" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioProcessingEventPlaybackTime), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
102 | { "inputBuffer" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioProcessingEventInputBuffer), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
103 | { "outputBuffer" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioProcessingEventOutputBuffer), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
104 | }; |
105 | |
106 | const ClassInfo JSAudioProcessingEventPrototype::s_info = { "AudioProcessingEventPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioProcessingEventPrototype) }; |
107 | |
108 | void JSAudioProcessingEventPrototype::finishCreation(VM& vm) |
109 | { |
110 | Base::finishCreation(vm); |
111 | reifyStaticProperties(vm, JSAudioProcessingEvent::info(), JSAudioProcessingEventPrototypeTableValues, *this); |
112 | } |
113 | |
114 | const ClassInfo JSAudioProcessingEvent::s_info = { "AudioProcessingEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAudioProcessingEvent) }; |
115 | |
116 | JSAudioProcessingEvent::JSAudioProcessingEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AudioProcessingEvent>&& impl) |
117 | : JSEvent(structure, globalObject, WTFMove(impl)) |
118 | { |
119 | } |
120 | |
121 | void JSAudioProcessingEvent::finishCreation(VM& vm) |
122 | { |
123 | Base::finishCreation(vm); |
124 | ASSERT(inherits(vm, info())); |
125 | |
126 | } |
127 | |
128 | JSObject* JSAudioProcessingEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
129 | { |
130 | return JSAudioProcessingEventPrototype::create(vm, &globalObject, JSAudioProcessingEventPrototype::createStructure(vm, &globalObject, JSEvent::prototype(vm, globalObject))); |
131 | } |
132 | |
133 | JSObject* JSAudioProcessingEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
134 | { |
135 | return getDOMPrototype<JSAudioProcessingEvent>(vm, globalObject); |
136 | } |
137 | |
138 | JSValue JSAudioProcessingEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
139 | { |
140 | return getDOMConstructor<JSAudioProcessingEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
141 | } |
142 | |
143 | template<> inline JSAudioProcessingEvent* IDLAttribute<JSAudioProcessingEvent>::cast(ExecState& state, EncodedJSValue thisValue) |
144 | { |
145 | return jsDynamicCast<JSAudioProcessingEvent*>(state.vm(), JSValue::decode(thisValue)); |
146 | } |
147 | |
148 | EncodedJSValue jsAudioProcessingEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
149 | { |
150 | VM& vm = state->vm(); |
151 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
152 | auto* prototype = jsDynamicCast<JSAudioProcessingEventPrototype*>(vm, JSValue::decode(thisValue)); |
153 | if (UNLIKELY(!prototype)) |
154 | return throwVMTypeError(state, throwScope); |
155 | return JSValue::encode(JSAudioProcessingEvent::getConstructor(state->vm(), prototype->globalObject())); |
156 | } |
157 | |
158 | bool setJSAudioProcessingEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
159 | { |
160 | VM& vm = state->vm(); |
161 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
162 | auto* prototype = jsDynamicCast<JSAudioProcessingEventPrototype*>(vm, JSValue::decode(thisValue)); |
163 | if (UNLIKELY(!prototype)) { |
164 | throwVMTypeError(state, throwScope); |
165 | return false; |
166 | } |
167 | // Shadowing a built-in constructor |
168 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
169 | } |
170 | |
171 | static inline JSValue jsAudioProcessingEventPlaybackTimeGetter(ExecState& state, JSAudioProcessingEvent& thisObject, ThrowScope& throwScope) |
172 | { |
173 | UNUSED_PARAM(throwScope); |
174 | UNUSED_PARAM(state); |
175 | auto& impl = thisObject.wrapped(); |
176 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.playbackTime()); |
177 | return result; |
178 | } |
179 | |
180 | EncodedJSValue jsAudioProcessingEventPlaybackTime(ExecState* state, EncodedJSValue thisValue, PropertyName) |
181 | { |
182 | return IDLAttribute<JSAudioProcessingEvent>::get<jsAudioProcessingEventPlaybackTimeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "playbackTime" ); |
183 | } |
184 | |
185 | static inline JSValue jsAudioProcessingEventInputBufferGetter(ExecState& state, JSAudioProcessingEvent& thisObject, ThrowScope& throwScope) |
186 | { |
187 | UNUSED_PARAM(throwScope); |
188 | UNUSED_PARAM(state); |
189 | auto& impl = thisObject.wrapped(); |
190 | JSValue result = toJS<IDLInterface<AudioBuffer>>(state, *thisObject.globalObject(), throwScope, impl.inputBuffer()); |
191 | return result; |
192 | } |
193 | |
194 | EncodedJSValue jsAudioProcessingEventInputBuffer(ExecState* state, EncodedJSValue thisValue, PropertyName) |
195 | { |
196 | return IDLAttribute<JSAudioProcessingEvent>::get<jsAudioProcessingEventInputBufferGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "inputBuffer" ); |
197 | } |
198 | |
199 | static inline JSValue jsAudioProcessingEventOutputBufferGetter(ExecState& state, JSAudioProcessingEvent& thisObject, ThrowScope& throwScope) |
200 | { |
201 | UNUSED_PARAM(throwScope); |
202 | UNUSED_PARAM(state); |
203 | auto& impl = thisObject.wrapped(); |
204 | JSValue result = toJS<IDLInterface<AudioBuffer>>(state, *thisObject.globalObject(), throwScope, impl.outputBuffer()); |
205 | return result; |
206 | } |
207 | |
208 | EncodedJSValue jsAudioProcessingEventOutputBuffer(ExecState* state, EncodedJSValue thisValue, PropertyName) |
209 | { |
210 | return IDLAttribute<JSAudioProcessingEvent>::get<jsAudioProcessingEventOutputBufferGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "outputBuffer" ); |
211 | } |
212 | |
213 | void JSAudioProcessingEvent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
214 | { |
215 | auto* thisObject = jsCast<JSAudioProcessingEvent*>(cell); |
216 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
217 | if (thisObject->scriptExecutionContext()) |
218 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
219 | Base::heapSnapshot(cell, builder); |
220 | } |
221 | |
222 | #if ENABLE(BINDING_INTEGRITY) |
223 | #if PLATFORM(WIN) |
224 | #pragma warning(disable: 4483) |
225 | extern "C" { extern void (*const __identifier("??_7AudioProcessingEvent@WebCore@@6B@" )[])(); } |
226 | #else |
227 | extern "C" { extern void* _ZTVN7WebCore20AudioProcessingEventE[]; } |
228 | #endif |
229 | #endif |
230 | |
231 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<AudioProcessingEvent>&& impl) |
232 | { |
233 | |
234 | #if ENABLE(BINDING_INTEGRITY) |
235 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
236 | #if PLATFORM(WIN) |
237 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7AudioProcessingEvent@WebCore@@6B@" )); |
238 | #else |
239 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore20AudioProcessingEventE[2]); |
240 | #endif |
241 | |
242 | // If this fails AudioProcessingEvent does not have a vtable, so you need to add the |
243 | // ImplementationLacksVTable attribute to the interface definition |
244 | static_assert(std::is_polymorphic<AudioProcessingEvent>::value, "AudioProcessingEvent is not polymorphic" ); |
245 | |
246 | // If you hit this assertion you either have a use after free bug, or |
247 | // AudioProcessingEvent has subclasses. If AudioProcessingEvent has subclasses that get passed |
248 | // to toJS() we currently require AudioProcessingEvent you to opt out of binding hardening |
249 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
250 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
251 | #endif |
252 | return createWrapper<AudioProcessingEvent>(globalObject, WTFMove(impl)); |
253 | } |
254 | |
255 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, AudioProcessingEvent& impl) |
256 | { |
257 | return wrap(state, globalObject, impl); |
258 | } |
259 | |
260 | |
261 | } |
262 | |
263 | #endif // ENABLE(WEB_AUDIO) |
264 | |