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