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(MEDIA_STREAM) && ENABLE(WEB_AUDIO)
24
25#include "JSMediaStreamAudioDestinationNode.h"
26
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructorNotConstructable.h"
30#include "JSDOMConvertInterface.h"
31#include "JSDOMExceptionHandling.h"
32#include "JSDOMGlobalObject.h"
33#include "JSDOMWrapperCache.h"
34#include "JSMediaStream.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
43namespace WebCore {
44using namespace JSC;
45
46// Attributes
47
48JSC::EncodedJSValue jsMediaStreamAudioDestinationNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSMediaStreamAudioDestinationNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50JSC::EncodedJSValue jsMediaStreamAudioDestinationNodeStream(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51
52class JSMediaStreamAudioDestinationNodePrototype : public JSC::JSNonFinalObject {
53public:
54 using Base = JSC::JSNonFinalObject;
55 static JSMediaStreamAudioDestinationNodePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
56 {
57 JSMediaStreamAudioDestinationNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSMediaStreamAudioDestinationNodePrototype>(vm.heap)) JSMediaStreamAudioDestinationNodePrototype(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
68private:
69 JSMediaStreamAudioDestinationNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
70 : JSC::JSNonFinalObject(vm, structure)
71 {
72 }
73
74 void finishCreation(JSC::VM&);
75};
76
77using JSMediaStreamAudioDestinationNodeConstructor = JSDOMConstructorNotConstructable<JSMediaStreamAudioDestinationNode>;
78
79template<> JSValue JSMediaStreamAudioDestinationNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
80{
81 return JSAudioNode::getConstructor(vm, &globalObject);
82}
83
84template<> void JSMediaStreamAudioDestinationNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
85{
86 putDirect(vm, vm.propertyNames->prototype, JSMediaStreamAudioDestinationNode::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("MediaStreamAudioDestinationNode"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
88 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89}
90
91template<> const ClassInfo JSMediaStreamAudioDestinationNodeConstructor::s_info = { "MediaStreamAudioDestinationNode", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMediaStreamAudioDestinationNodeConstructor) };
92
93/* Hash table for prototype */
94
95static const HashTableValue JSMediaStreamAudioDestinationNodePrototypeTableValues[] =
96{
97 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaStreamAudioDestinationNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaStreamAudioDestinationNodeConstructor) } },
98 { "stream", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaStreamAudioDestinationNodeStream), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
99};
100
101const ClassInfo JSMediaStreamAudioDestinationNodePrototype::s_info = { "MediaStreamAudioDestinationNodePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMediaStreamAudioDestinationNodePrototype) };
102
103void JSMediaStreamAudioDestinationNodePrototype::finishCreation(VM& vm)
104{
105 Base::finishCreation(vm);
106 reifyStaticProperties(vm, JSMediaStreamAudioDestinationNode::info(), JSMediaStreamAudioDestinationNodePrototypeTableValues, *this);
107}
108
109const ClassInfo JSMediaStreamAudioDestinationNode::s_info = { "MediaStreamAudioDestinationNode", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMediaStreamAudioDestinationNode) };
110
111JSMediaStreamAudioDestinationNode::JSMediaStreamAudioDestinationNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<MediaStreamAudioDestinationNode>&& impl)
112 : JSAudioNode(structure, globalObject, WTFMove(impl))
113{
114}
115
116void JSMediaStreamAudioDestinationNode::finishCreation(VM& vm)
117{
118 Base::finishCreation(vm);
119 ASSERT(inherits(vm, info()));
120
121}
122
123JSObject* JSMediaStreamAudioDestinationNode::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
124{
125 return JSMediaStreamAudioDestinationNodePrototype::create(vm, &globalObject, JSMediaStreamAudioDestinationNodePrototype::createStructure(vm, &globalObject, JSAudioNode::prototype(vm, globalObject)));
126}
127
128JSObject* JSMediaStreamAudioDestinationNode::prototype(VM& vm, JSDOMGlobalObject& globalObject)
129{
130 return getDOMPrototype<JSMediaStreamAudioDestinationNode>(vm, globalObject);
131}
132
133JSValue JSMediaStreamAudioDestinationNode::getConstructor(VM& vm, const JSGlobalObject* globalObject)
134{
135 return getDOMConstructor<JSMediaStreamAudioDestinationNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
136}
137
138template<> inline JSMediaStreamAudioDestinationNode* IDLAttribute<JSMediaStreamAudioDestinationNode>::cast(ExecState& state, EncodedJSValue thisValue)
139{
140 return jsDynamicCast<JSMediaStreamAudioDestinationNode*>(state.vm(), JSValue::decode(thisValue));
141}
142
143EncodedJSValue jsMediaStreamAudioDestinationNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
144{
145 VM& vm = state->vm();
146 auto throwScope = DECLARE_THROW_SCOPE(vm);
147 auto* prototype = jsDynamicCast<JSMediaStreamAudioDestinationNodePrototype*>(vm, JSValue::decode(thisValue));
148 if (UNLIKELY(!prototype))
149 return throwVMTypeError(state, throwScope);
150 return JSValue::encode(JSMediaStreamAudioDestinationNode::getConstructor(state->vm(), prototype->globalObject()));
151}
152
153bool setJSMediaStreamAudioDestinationNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
154{
155 VM& vm = state->vm();
156 auto throwScope = DECLARE_THROW_SCOPE(vm);
157 auto* prototype = jsDynamicCast<JSMediaStreamAudioDestinationNodePrototype*>(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
166static inline JSValue jsMediaStreamAudioDestinationNodeStreamGetter(ExecState& state, JSMediaStreamAudioDestinationNode& thisObject, ThrowScope& throwScope)
167{
168 UNUSED_PARAM(throwScope);
169 UNUSED_PARAM(state);
170 auto& impl = thisObject.wrapped();
171 JSValue result = toJS<IDLInterface<MediaStream>>(state, *thisObject.globalObject(), throwScope, impl.stream());
172 return result;
173}
174
175EncodedJSValue jsMediaStreamAudioDestinationNodeStream(ExecState* state, EncodedJSValue thisValue, PropertyName)
176{
177 return IDLAttribute<JSMediaStreamAudioDestinationNode>::get<jsMediaStreamAudioDestinationNodeStreamGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "stream");
178}
179
180void JSMediaStreamAudioDestinationNode::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
181{
182 auto* thisObject = jsCast<JSMediaStreamAudioDestinationNode*>(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)
192extern "C" { extern void (*const __identifier("??_7MediaStreamAudioDestinationNode@WebCore@@6B@")[])(); }
193#else
194extern "C" { extern void* _ZTVN7WebCore31MediaStreamAudioDestinationNodeE[]; }
195#endif
196#endif
197
198JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<MediaStreamAudioDestinationNode>&& 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("??_7MediaStreamAudioDestinationNode@WebCore@@6B@"));
205#else
206 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore31MediaStreamAudioDestinationNodeE[2]);
207#endif
208
209 // If this fails MediaStreamAudioDestinationNode does not have a vtable, so you need to add the
210 // ImplementationLacksVTable attribute to the interface definition
211 static_assert(std::is_polymorphic<MediaStreamAudioDestinationNode>::value, "MediaStreamAudioDestinationNode is not polymorphic");
212
213 // If you hit this assertion you either have a use after free bug, or
214 // MediaStreamAudioDestinationNode has subclasses. If MediaStreamAudioDestinationNode has subclasses that get passed
215 // to toJS() we currently require MediaStreamAudioDestinationNode 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<MediaStreamAudioDestinationNode>(globalObject, WTFMove(impl));
220}
221
222JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, MediaStreamAudioDestinationNode& impl)
223{
224 return wrap(state, globalObject, impl);
225}
226
227
228}
229
230#endif // ENABLE(MEDIA_STREAM) && ENABLE(WEB_AUDIO)
231