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.
23 #if ENABLE(INPUT_SPEECH)
25 #include "JSSpeechInputResultList.h"
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
29 #include "JSSpeechInputResult.h"
30 #include "SpeechInputResult.h"
31 #include "SpeechInputResultList.h"
32 #include <runtime/Error.h>
33 #include <runtime/PropertyNameArray.h>
34 #include <wtf/GetPtr.h>
40 ASSERT_CLASS_FITS_IN_CELL(JSSpeechInputResultList);
44 #define THUNK_GENERATOR(generator) , generator
46 #define THUNK_GENERATOR(generator)
49 #define INTRINSIC(intrinsic) , intrinsic
51 #define INTRINSIC(intrinsic)
54 static const HashTableValue JSSpeechInputResultListTableValues[] =
56 { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechInputResultListLength), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechInputResultListConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
61 #undef THUNK_GENERATOR
62 static const HashTable JSSpeechInputResultListTable = { 5, 3, JSSpeechInputResultListTableValues, 0 };
63 /* Hash table for constructor */
65 #define THUNK_GENERATOR(generator) , generator
67 #define THUNK_GENERATOR(generator)
70 #define INTRINSIC(intrinsic) , intrinsic
72 #define INTRINSIC(intrinsic)
75 static const HashTableValue JSSpeechInputResultListConstructorTableValues[] =
77 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
80 #undef THUNK_GENERATOR
81 static const HashTable JSSpeechInputResultListConstructorTable = { 1, 0, JSSpeechInputResultListConstructorTableValues, 0 };
82 const ClassInfo JSSpeechInputResultListConstructor::s_info = { "SpeechInputResultListConstructor", &DOMConstructorObject::s_info, &JSSpeechInputResultListConstructorTable, 0, CREATE_METHOD_TABLE(JSSpeechInputResultListConstructor) };
84 JSSpeechInputResultListConstructor::JSSpeechInputResultListConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
85 : DOMConstructorObject(structure, globalObject)
89 void JSSpeechInputResultListConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
91 Base::finishCreation(exec->globalData());
92 ASSERT(inherits(&s_info));
93 putDirect(exec->globalData(), exec->propertyNames().prototype, JSSpeechInputResultListPrototype::self(exec, globalObject), DontDelete | ReadOnly);
96 bool JSSpeechInputResultListConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
98 return getStaticValueSlot<JSSpeechInputResultListConstructor, JSDOMWrapper>(exec, &JSSpeechInputResultListConstructorTable, static_cast<JSSpeechInputResultListConstructor*>(cell), propertyName, slot);
101 bool JSSpeechInputResultListConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
103 return getStaticValueDescriptor<JSSpeechInputResultListConstructor, JSDOMWrapper>(exec, &JSSpeechInputResultListConstructorTable, static_cast<JSSpeechInputResultListConstructor*>(object), propertyName, descriptor);
106 /* Hash table for prototype */
108 #define THUNK_GENERATOR(generator) , generator
110 #define THUNK_GENERATOR(generator)
113 #define INTRINSIC(intrinsic) , intrinsic
115 #define INTRINSIC(intrinsic)
118 static const HashTableValue JSSpeechInputResultListPrototypeTableValues[] =
120 { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSpeechInputResultListPrototypeFunctionItem), (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 JSSpeechInputResultListPrototypeTable = { 2, 1, JSSpeechInputResultListPrototypeTableValues, 0 };
126 const ClassInfo JSSpeechInputResultListPrototype::s_info = { "SpeechInputResultListPrototype", &JSC::JSNonFinalObject::s_info, &JSSpeechInputResultListPrototypeTable, 0, CREATE_METHOD_TABLE(JSSpeechInputResultListPrototype) };
128 JSObject* JSSpeechInputResultListPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
130 return getDOMPrototype<JSSpeechInputResultList>(exec, globalObject);
133 bool JSSpeechInputResultListPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
135 JSSpeechInputResultListPrototype* thisObject = jsCast<JSSpeechInputResultListPrototype*>(cell);
136 return getStaticFunctionSlot<JSObject>(exec, &JSSpeechInputResultListPrototypeTable, thisObject, propertyName, slot);
139 bool JSSpeechInputResultListPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
141 JSSpeechInputResultListPrototype* thisObject = jsCast<JSSpeechInputResultListPrototype*>(object);
142 return getStaticFunctionDescriptor<JSObject>(exec, &JSSpeechInputResultListPrototypeTable, thisObject, propertyName, descriptor);
145 const ClassInfo JSSpeechInputResultList::s_info = { "SpeechInputResultList", &JSDOMWrapper::s_info, &JSSpeechInputResultListTable, 0 , CREATE_METHOD_TABLE(JSSpeechInputResultList) };
147 JSSpeechInputResultList::JSSpeechInputResultList(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SpeechInputResultList> impl)
148 : JSDOMWrapper(structure, globalObject)
149 , m_impl(impl.leakRef())
153 void JSSpeechInputResultList::finishCreation(JSGlobalData& globalData)
155 Base::finishCreation(globalData);
156 ASSERT(inherits(&s_info));
159 JSObject* JSSpeechInputResultList::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
161 return JSSpeechInputResultListPrototype::create(exec->globalData(), globalObject, JSSpeechInputResultListPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
164 bool JSSpeechInputResultList::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
166 JSSpeechInputResultList* thisObject = jsCast<JSSpeechInputResultList*>(cell);
167 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
168 const HashEntry* entry = JSSpeechInputResultListTable.entry(exec, propertyName);
170 slot.setCustom(thisObject, entry->propertyGetter());
174 unsigned index = propertyName.toUInt32(ok);
175 if (ok && index < static_cast<SpeechInputResultList*>(thisObject->impl())->length()) {
176 slot.setCustomIndex(thisObject, index, indexGetter);
179 return getStaticValueSlot<JSSpeechInputResultList, Base>(exec, &JSSpeechInputResultListTable, thisObject, propertyName, slot);
182 bool JSSpeechInputResultList::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
184 JSSpeechInputResultList* thisObject = jsCast<JSSpeechInputResultList*>(object);
185 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
186 const HashEntry* entry = JSSpeechInputResultListTable.entry(exec, propertyName);
189 slot.setCustom(thisObject, entry->propertyGetter());
190 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
194 unsigned index = propertyName.toUInt32(ok);
195 if (ok && index < static_cast<SpeechInputResultList*>(thisObject->impl())->length()) {
197 slot.setCustomIndex(thisObject, index, indexGetter);
198 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
201 return getStaticValueDescriptor<JSSpeechInputResultList, Base>(exec, &JSSpeechInputResultListTable, thisObject, propertyName, descriptor);
204 bool JSSpeechInputResultList::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
206 JSSpeechInputResultList* thisObject = jsCast<JSSpeechInputResultList*>(cell);
207 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
208 if (propertyName < static_cast<SpeechInputResultList*>(thisObject->impl())->length()) {
209 slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);
212 return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
215 JSValue jsSpeechInputResultListLength(ExecState* exec, JSValue slotBase, const Identifier&)
217 JSSpeechInputResultList* castedThis = static_cast<JSSpeechInputResultList*>(asObject(slotBase));
219 SpeechInputResultList* imp = static_cast<SpeechInputResultList*>(castedThis->impl());
220 JSValue result = jsNumber(imp->length());
225 JSValue jsSpeechInputResultListConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
227 JSSpeechInputResultList* domObject = static_cast<JSSpeechInputResultList*>(asObject(slotBase));
228 return JSSpeechInputResultList::getConstructor(exec, domObject->globalObject());
231 void JSSpeechInputResultList::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
233 JSSpeechInputResultList* thisObject = jsCast<JSSpeechInputResultList*>(object);
234 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
235 for (unsigned i = 0; i < static_cast<SpeechInputResultList*>(thisObject->impl())->length(); ++i)
236 propertyNames.add(Identifier::from(exec, i));
237 Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
240 JSValue JSSpeechInputResultList::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
242 return getDOMConstructor<JSSpeechInputResultListConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
245 EncodedJSValue JSC_HOST_CALL jsSpeechInputResultListPrototypeFunctionItem(ExecState* exec)
247 JSValue thisValue = exec->hostThisValue();
248 if (!thisValue.inherits(&JSSpeechInputResultList::s_info))
249 return throwVMTypeError(exec);
250 JSSpeechInputResultList* castedThis = static_cast<JSSpeechInputResultList*>(asObject(thisValue));
251 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSpeechInputResultList::s_info);
252 SpeechInputResultList* imp = static_cast<SpeechInputResultList*>(castedThis->impl());
253 if (exec->argumentCount() < 1)
254 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
255 int index(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
257 setDOMException(exec, INDEX_SIZE_ERR);
258 return JSValue::encode(jsUndefined());
260 if (exec->hadException())
261 return JSValue::encode(jsUndefined());
263 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
264 return JSValue::encode(result);
268 JSValue JSSpeechInputResultList::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
270 JSSpeechInputResultList* thisObj = static_cast<JSSpeechInputResultList*>(asObject(slotBase));
271 ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);
272 return toJS(exec, thisObj->globalObject(), static_cast<SpeechInputResultList*>(thisObj->impl())->item(index));
275 static inline bool isObservable(JSSpeechInputResultList* jsSpeechInputResultList)
277 if (jsSpeechInputResultList->hasCustomProperties())
282 bool JSSpeechInputResultListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
284 JSSpeechInputResultList* jsSpeechInputResultList = static_cast<JSSpeechInputResultList*>(handle.get().asCell());
285 if (!isObservable(jsSpeechInputResultList))
287 UNUSED_PARAM(visitor);
291 void JSSpeechInputResultListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
293 JSSpeechInputResultList* jsSpeechInputResultList = static_cast<JSSpeechInputResultList*>(handle.get().asCell());
294 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
295 uncacheWrapper(world, jsSpeechInputResultList->impl(), jsSpeechInputResultList);
296 jsSpeechInputResultList->releaseImpl();
299 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SpeechInputResultList* impl)
301 return wrap<JSSpeechInputResultList>(exec, globalObject, impl);
304 SpeechInputResultList* toSpeechInputResultList(JSC::JSValue value)
306 return value.inherits(&JSSpeechInputResultList::s_info) ? static_cast<JSSpeechInputResultList*>(asObject(value))->impl() : 0;
311 #endif // ENABLE(INPUT_SPEECH)