2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
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.
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.
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.
25 #include "JSAudioNode.h"
27 #include "AudioContext.h"
28 #include "AudioNode.h"
29 #include "JSAudioContext.h"
30 #include <runtime/Error.h>
31 #include <wtf/GetPtr.h>
37 ASSERT_CLASS_FITS_IN_CELL(JSAudioNode);
41 #define THUNK_GENERATOR(generator) , generator
43 #define THUNK_GENERATOR(generator)
46 #define INTRINSIC(intrinsic) , intrinsic
48 #define INTRINSIC(intrinsic)
51 static const HashTableValue JSAudioNodeTableValues[] =
53 { "context", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeContext), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54 { "numberOfInputs", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeNumberOfInputs), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55 { "numberOfOutputs", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeNumberOfOutputs), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAudioNodeConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
60 #undef THUNK_GENERATOR
61 static const HashTable JSAudioNodeTable = { 8, 7, JSAudioNodeTableValues, 0 };
62 /* Hash table for constructor */
64 #define THUNK_GENERATOR(generator) , generator
66 #define THUNK_GENERATOR(generator)
69 #define INTRINSIC(intrinsic) , intrinsic
71 #define INTRINSIC(intrinsic)
74 static const HashTableValue JSAudioNodeConstructorTableValues[] =
76 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
79 #undef THUNK_GENERATOR
80 static const HashTable JSAudioNodeConstructorTable = { 1, 0, JSAudioNodeConstructorTableValues, 0 };
81 const ClassInfo JSAudioNodeConstructor::s_info = { "AudioNodeConstructor", &DOMConstructorObject::s_info, &JSAudioNodeConstructorTable, 0, CREATE_METHOD_TABLE(JSAudioNodeConstructor) };
83 JSAudioNodeConstructor::JSAudioNodeConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
84 : DOMConstructorObject(structure, globalObject)
88 void JSAudioNodeConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
90 Base::finishCreation(exec->globalData());
91 ASSERT(inherits(&s_info));
92 putDirect(exec->globalData(), exec->propertyNames().prototype, JSAudioNodePrototype::self(exec, globalObject), DontDelete | ReadOnly);
95 bool JSAudioNodeConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
97 return getStaticValueSlot<JSAudioNodeConstructor, JSDOMWrapper>(exec, &JSAudioNodeConstructorTable, static_cast<JSAudioNodeConstructor*>(cell), propertyName, slot);
100 bool JSAudioNodeConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
102 return getStaticValueDescriptor<JSAudioNodeConstructor, JSDOMWrapper>(exec, &JSAudioNodeConstructorTable, static_cast<JSAudioNodeConstructor*>(object), propertyName, descriptor);
105 /* Hash table for prototype */
107 #define THUNK_GENERATOR(generator) , generator
109 #define THUNK_GENERATOR(generator)
112 #define INTRINSIC(intrinsic) , intrinsic
114 #define INTRINSIC(intrinsic)
117 static const HashTableValue JSAudioNodePrototypeTableValues[] =
119 { "connect", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsAudioNodePrototypeFunctionConnect), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
120 { "disconnect", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsAudioNodePrototypeFunctionDisconnect), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
121 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
124 #undef THUNK_GENERATOR
125 static const HashTable JSAudioNodePrototypeTable = { 4, 3, JSAudioNodePrototypeTableValues, 0 };
126 const ClassInfo JSAudioNodePrototype::s_info = { "AudioNodePrototype", &JSC::JSNonFinalObject::s_info, &JSAudioNodePrototypeTable, 0, CREATE_METHOD_TABLE(JSAudioNodePrototype) };
128 JSObject* JSAudioNodePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
130 return getDOMPrototype<JSAudioNode>(exec, globalObject);
133 bool JSAudioNodePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
135 JSAudioNodePrototype* thisObject = jsCast<JSAudioNodePrototype*>(cell);
136 return getStaticFunctionSlot<JSObject>(exec, &JSAudioNodePrototypeTable, thisObject, propertyName, slot);
139 bool JSAudioNodePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
141 JSAudioNodePrototype* thisObject = jsCast<JSAudioNodePrototype*>(object);
142 return getStaticFunctionDescriptor<JSObject>(exec, &JSAudioNodePrototypeTable, thisObject, propertyName, descriptor);
145 const ClassInfo JSAudioNode::s_info = { "AudioNode", &JSDOMWrapper::s_info, &JSAudioNodeTable, 0 , CREATE_METHOD_TABLE(JSAudioNode) };
147 JSAudioNode::JSAudioNode(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<AudioNode> impl)
148 : JSDOMWrapper(structure, globalObject)
149 , m_impl(impl.leakRef())
153 void JSAudioNode::finishCreation(JSGlobalData& globalData)
155 Base::finishCreation(globalData);
156 ASSERT(inherits(&s_info));
159 JSObject* JSAudioNode::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
161 return JSAudioNodePrototype::create(exec->globalData(), globalObject, JSAudioNodePrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
164 bool JSAudioNode::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
166 JSAudioNode* thisObject = jsCast<JSAudioNode*>(cell);
167 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
168 return getStaticValueSlot<JSAudioNode, Base>(exec, &JSAudioNodeTable, thisObject, propertyName, slot);
171 bool JSAudioNode::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
173 JSAudioNode* thisObject = jsCast<JSAudioNode*>(object);
174 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
175 return getStaticValueDescriptor<JSAudioNode, Base>(exec, &JSAudioNodeTable, thisObject, propertyName, descriptor);
178 JSValue jsAudioNodeContext(ExecState* exec, JSValue slotBase, const Identifier&)
180 JSAudioNode* castedThis = static_cast<JSAudioNode*>(asObject(slotBase));
182 AudioNode* imp = static_cast<AudioNode*>(castedThis->impl());
183 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->context()));
188 JSValue jsAudioNodeNumberOfInputs(ExecState* exec, JSValue slotBase, const Identifier&)
190 JSAudioNode* castedThis = static_cast<JSAudioNode*>(asObject(slotBase));
192 AudioNode* imp = static_cast<AudioNode*>(castedThis->impl());
193 JSValue result = jsNumber(imp->numberOfInputs());
198 JSValue jsAudioNodeNumberOfOutputs(ExecState* exec, JSValue slotBase, const Identifier&)
200 JSAudioNode* castedThis = static_cast<JSAudioNode*>(asObject(slotBase));
202 AudioNode* imp = static_cast<AudioNode*>(castedThis->impl());
203 JSValue result = jsNumber(imp->numberOfOutputs());
208 JSValue jsAudioNodeConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
210 JSAudioNode* domObject = static_cast<JSAudioNode*>(asObject(slotBase));
211 return JSAudioNode::getConstructor(exec, domObject->globalObject());
214 JSValue JSAudioNode::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
216 return getDOMConstructor<JSAudioNodeConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
219 EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionConnect(ExecState* exec)
221 JSValue thisValue = exec->hostThisValue();
222 if (!thisValue.inherits(&JSAudioNode::s_info))
223 return throwVMTypeError(exec);
224 JSAudioNode* castedThis = static_cast<JSAudioNode*>(asObject(thisValue));
225 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSAudioNode::s_info);
226 return JSValue::encode(castedThis->connect(exec));
229 EncodedJSValue JSC_HOST_CALL jsAudioNodePrototypeFunctionDisconnect(ExecState* exec)
231 JSValue thisValue = exec->hostThisValue();
232 if (!thisValue.inherits(&JSAudioNode::s_info))
233 return throwVMTypeError(exec);
234 JSAudioNode* castedThis = static_cast<JSAudioNode*>(asObject(thisValue));
235 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSAudioNode::s_info);
236 return JSValue::encode(castedThis->disconnect(exec));
239 static inline bool isObservable(JSAudioNode* jsAudioNode)
241 if (jsAudioNode->hasCustomProperties())
246 bool JSAudioNodeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
248 JSAudioNode* jsAudioNode = static_cast<JSAudioNode*>(handle.get().asCell());
249 if (!isObservable(jsAudioNode))
251 UNUSED_PARAM(visitor);
255 void JSAudioNodeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
257 JSAudioNode* jsAudioNode = static_cast<JSAudioNode*>(handle.get().asCell());
258 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
259 uncacheWrapper(world, jsAudioNode->impl(), jsAudioNode);
260 jsAudioNode->releaseImpl();
263 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, AudioNode* impl)
265 return wrap<JSAudioNode>(exec, globalObject, impl);
268 AudioNode* toAudioNode(JSC::JSValue value)
270 return value.inherits(&JSAudioNode::s_info) ? static_cast<JSAudioNode*>(asObject(value))->impl() : 0;
275 #endif // ENABLE(WEB_AUDIO)