tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSHTMLAudioElement.cpp
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(VIDEO)
24
25 #include "JSHTMLAudioElement.h"
26
27 #include "ExceptionCode.h"
28 #include "HTMLAudioElement.h"
29 #include "JSDOMBinding.h"
30 #include <runtime/Error.h>
31 #include <wtf/GetPtr.h>
32
33 using namespace JSC;
34
35 namespace WebCore {
36
37 ASSERT_CLASS_FITS_IN_CELL(JSHTMLAudioElement);
38
39 /* Hash table */
40 #if ENABLE(JIT)
41 #define THUNK_GENERATOR(generator) , generator
42 #else
43 #define THUNK_GENERATOR(generator)
44 #endif
45 #if ENABLE(DFG_JIT)
46 #define INTRINSIC(intrinsic) , intrinsic
47 #else
48 #define INTRINSIC(intrinsic)
49 #endif
50
51 static const HashTableValue JSHTMLAudioElementTableValues[] =
52 {
53     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLAudioElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
55 };
56
57 #undef THUNK_GENERATOR
58 static const HashTable JSHTMLAudioElementTable = { 2, 1, JSHTMLAudioElementTableValues, 0 };
59 /* Hash table for constructor */
60 #if ENABLE(JIT)
61 #define THUNK_GENERATOR(generator) , generator
62 #else
63 #define THUNK_GENERATOR(generator)
64 #endif
65 #if ENABLE(DFG_JIT)
66 #define INTRINSIC(intrinsic) , intrinsic
67 #else
68 #define INTRINSIC(intrinsic)
69 #endif
70
71 static const HashTableValue JSHTMLAudioElementConstructorTableValues[] =
72 {
73     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
74 };
75
76 #undef THUNK_GENERATOR
77 static const HashTable JSHTMLAudioElementConstructorTable = { 1, 0, JSHTMLAudioElementConstructorTableValues, 0 };
78 const ClassInfo JSHTMLAudioElementConstructor::s_info = { "HTMLAudioElementConstructor", &DOMConstructorObject::s_info, &JSHTMLAudioElementConstructorTable, 0, CREATE_METHOD_TABLE(JSHTMLAudioElementConstructor) };
79
80 JSHTMLAudioElementConstructor::JSHTMLAudioElementConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
81     : DOMConstructorObject(structure, globalObject)
82 {
83 }
84
85 void JSHTMLAudioElementConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
86 {
87     Base::finishCreation(exec->globalData());
88     ASSERT(inherits(&s_info));
89     putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLAudioElementPrototype::self(exec, globalObject), DontDelete | ReadOnly);
90 }
91
92 bool JSHTMLAudioElementConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
93 {
94     return getStaticValueSlot<JSHTMLAudioElementConstructor, JSDOMWrapper>(exec, &JSHTMLAudioElementConstructorTable, static_cast<JSHTMLAudioElementConstructor*>(cell), propertyName, slot);
95 }
96
97 bool JSHTMLAudioElementConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
98 {
99     return getStaticValueDescriptor<JSHTMLAudioElementConstructor, JSDOMWrapper>(exec, &JSHTMLAudioElementConstructorTable, static_cast<JSHTMLAudioElementConstructor*>(object), propertyName, descriptor);
100 }
101
102 const ClassInfo JSHTMLAudioElementNamedConstructor::s_info = { "HTMLAudioElementConstructor", &DOMConstructorObject::s_info, 0, 0, CREATE_METHOD_TABLE(JSHTMLAudioElementNamedConstructor) };
103
104 JSHTMLAudioElementNamedConstructor::JSHTMLAudioElementNamedConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
105     : DOMConstructorWithDocument(structure, globalObject)
106 {
107 }
108
109 void JSHTMLAudioElementNamedConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
110 {
111     Base::finishCreation(globalObject);
112     ASSERT(inherits(&s_info));
113     putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLAudioElementPrototype::self(exec, globalObject), None);
114 }
115
116 EncodedJSValue JSC_HOST_CALL JSHTMLAudioElementNamedConstructor::constructJSHTMLAudioElement(ExecState* exec)
117 {
118     JSHTMLAudioElementNamedConstructor* jsConstructor = static_cast<JSHTMLAudioElementNamedConstructor*>(exec->callee());
119     const String& src(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsEmpty).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsEmpty).toString(exec)));
120     if (exec->hadException())
121         return JSValue::encode(jsUndefined());
122     RefPtr<HTMLAudioElement> object = HTMLAudioElement::createForJSConstructor(jsConstructor->document(), src);
123     return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), object.get())));
124 }
125
126 ConstructType JSHTMLAudioElementNamedConstructor::getConstructData(JSCell*, ConstructData& constructData)
127 {
128     constructData.native.function = constructJSHTMLAudioElement;
129     return ConstructTypeHost;
130 }
131
132 /* Hash table for prototype */
133 #if ENABLE(JIT)
134 #define THUNK_GENERATOR(generator) , generator
135 #else
136 #define THUNK_GENERATOR(generator)
137 #endif
138 #if ENABLE(DFG_JIT)
139 #define INTRINSIC(intrinsic) , intrinsic
140 #else
141 #define INTRINSIC(intrinsic)
142 #endif
143
144 static const HashTableValue JSHTMLAudioElementPrototypeTableValues[] =
145 {
146     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
147 };
148
149 #undef THUNK_GENERATOR
150 static const HashTable JSHTMLAudioElementPrototypeTable = { 1, 0, JSHTMLAudioElementPrototypeTableValues, 0 };
151 const ClassInfo JSHTMLAudioElementPrototype::s_info = { "HTMLAudioElementPrototype", &JSC::JSNonFinalObject::s_info, &JSHTMLAudioElementPrototypeTable, 0, CREATE_METHOD_TABLE(JSHTMLAudioElementPrototype) };
152
153 JSObject* JSHTMLAudioElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
154 {
155     return getDOMPrototype<JSHTMLAudioElement>(exec, globalObject);
156 }
157
158 const ClassInfo JSHTMLAudioElement::s_info = { "HTMLAudioElement", &JSHTMLMediaElement::s_info, &JSHTMLAudioElementTable, 0 , CREATE_METHOD_TABLE(JSHTMLAudioElement) };
159
160 JSHTMLAudioElement::JSHTMLAudioElement(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLAudioElement> impl)
161     : JSHTMLMediaElement(structure, globalObject, impl)
162 {
163 }
164
165 void JSHTMLAudioElement::finishCreation(JSGlobalData& globalData)
166 {
167     Base::finishCreation(globalData);
168     ASSERT(inherits(&s_info));
169 }
170
171 JSObject* JSHTMLAudioElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
172 {
173     return JSHTMLAudioElementPrototype::create(exec->globalData(), globalObject, JSHTMLAudioElementPrototype::createStructure(exec->globalData(), globalObject, JSHTMLMediaElementPrototype::self(exec, globalObject)));
174 }
175
176 bool JSHTMLAudioElement::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
177 {
178     JSHTMLAudioElement* thisObject = jsCast<JSHTMLAudioElement*>(cell);
179     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
180     return getStaticValueSlot<JSHTMLAudioElement, Base>(exec, &JSHTMLAudioElementTable, thisObject, propertyName, slot);
181 }
182
183 bool JSHTMLAudioElement::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
184 {
185     JSHTMLAudioElement* thisObject = jsCast<JSHTMLAudioElement*>(object);
186     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
187     return getStaticValueDescriptor<JSHTMLAudioElement, Base>(exec, &JSHTMLAudioElementTable, thisObject, propertyName, descriptor);
188 }
189
190 JSValue jsHTMLAudioElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
191 {
192     JSHTMLAudioElement* domObject = static_cast<JSHTMLAudioElement*>(asObject(slotBase));
193     return JSHTMLAudioElement::getConstructor(exec, domObject->globalObject());
194 }
195
196 JSValue JSHTMLAudioElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
197 {
198     return getDOMConstructor<JSHTMLAudioElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
199 }
200
201 static inline bool isObservable(JSHTMLAudioElement* jsHTMLAudioElement)
202 {
203     if (jsHTMLAudioElement->hasCustomProperties())
204         return true;
205     return false;
206 }
207
208 bool JSHTMLAudioElementOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
209 {
210     JSHTMLAudioElement* jsHTMLAudioElement = static_cast<JSHTMLAudioElement*>(handle.get().asCell());
211     if (jsHTMLAudioElement->impl()->hasPendingActivity())
212         return true;
213     if (!isObservable(jsHTMLAudioElement))
214         return false;
215     UNUSED_PARAM(visitor);
216     return false;
217 }
218
219 void JSHTMLAudioElementOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
220 {
221     JSHTMLAudioElement* jsHTMLAudioElement = static_cast<JSHTMLAudioElement*>(handle.get().asCell());
222     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
223     uncacheWrapper(world, jsHTMLAudioElement->impl(), jsHTMLAudioElement);
224     jsHTMLAudioElement->releaseImpl();
225 }
226
227
228 }
229
230 #endif // ENABLE(VIDEO)