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