initial import
[vuplus_webkit] / Source / WebCore / bindings / scripts / test / JS / JSTestInterface.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(Condition1) || ENABLE(Condition2)
24
25 #include "JSTestInterface.h"
26
27 #include "TestInterface.h"
28 #include <wtf/GetPtr.h>
29
30 using namespace JSC;
31
32 namespace WebCore {
33
34 ASSERT_CLASS_FITS_IN_CELL(JSTestInterface);
35
36 /* Hash table */
37 #if ENABLE(JIT)
38 #define THUNK_GENERATOR(generator) , generator
39 #else
40 #define THUNK_GENERATOR(generator)
41 #endif
42
43 static const HashTableValue JSTestInterfaceTableValues[] =
44 {
45     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
46     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
47 };
48
49 #undef THUNK_GENERATOR
50 static JSC_CONST_HASHTABLE HashTable JSTestInterfaceTable = { 2, 1, JSTestInterfaceTableValues, 0 };
51 /* Hash table for constructor */
52 #if ENABLE(JIT)
53 #define THUNK_GENERATOR(generator) , generator
54 #else
55 #define THUNK_GENERATOR(generator)
56 #endif
57
58 static const HashTableValue JSTestInterfaceConstructorTableValues[] =
59 {
60     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
61 };
62
63 #undef THUNK_GENERATOR
64 static JSC_CONST_HASHTABLE HashTable JSTestInterfaceConstructorTable = { 1, 0, JSTestInterfaceConstructorTableValues, 0 };
65 class JSTestInterfaceConstructor : public DOMConstructorObject {
66 private:
67     JSTestInterfaceConstructor(JSC::Structure*, JSDOMGlobalObject*);
68     void finishCreation(JSC::ExecState*, JSDOMGlobalObject*);
69
70 public:
71     typedef DOMConstructorObject Base;
72     static JSTestInterfaceConstructor* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject)
73     {
74         JSTestInterfaceConstructor* ptr = new (JSC::allocateCell<JSTestInterfaceConstructor>(*exec->heap())) JSTestInterfaceConstructor(structure, globalObject);
75         ptr->finishCreation(exec, globalObject);
76         return ptr;
77     }
78
79     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
80     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
81     static const JSC::ClassInfo s_info;
82     static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
83     {
84         return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info);
85     }
86 protected:
87     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
88     static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestInterface(JSC::ExecState*);
89     virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
90 };
91
92 const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", &DOMConstructorObject::s_info, &JSTestInterfaceConstructorTable, 0 };
93
94 JSTestInterfaceConstructor::JSTestInterfaceConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
95     : DOMConstructorObject(structure, globalObject)
96 {
97 }
98
99 void JSTestInterfaceConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
100 {
101     Base::finishCreation(exec->globalData());
102     ASSERT(inherits(&s_info));
103     putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly);
104 }
105
106 bool JSTestInterfaceConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
107 {
108     return getStaticValueSlot<JSTestInterfaceConstructor, JSDOMWrapper>(exec, &JSTestInterfaceConstructorTable, this, propertyName, slot);
109 }
110
111 bool JSTestInterfaceConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
112 {
113     return getStaticValueDescriptor<JSTestInterfaceConstructor, JSDOMWrapper>(exec, &JSTestInterfaceConstructorTable, this, propertyName, descriptor);
114 }
115
116 EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::constructJSTestInterface(ExecState* exec)
117 {
118     ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(exec->callee())->scriptExecutionContext();
119     if (!context)
120         return throwVMError(exec, createReferenceError(exec, "Reference error"));
121     return JSValue::encode(asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(exec->callee())->globalObject(), TestInterface::create(context))));
122 }
123
124 ConstructType JSTestInterfaceConstructor::getConstructData(ConstructData& constructData)
125 {
126     constructData.native.function = constructJSTestInterface;
127     return ConstructTypeHost;
128 }
129
130 /* Hash table for prototype */
131 #if ENABLE(JIT)
132 #define THUNK_GENERATOR(generator) , generator
133 #else
134 #define THUNK_GENERATOR(generator)
135 #endif
136
137 static const HashTableValue JSTestInterfacePrototypeTableValues[] =
138 {
139     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
140 };
141
142 #undef THUNK_GENERATOR
143 static JSC_CONST_HASHTABLE HashTable JSTestInterfacePrototypeTable = { 1, 0, JSTestInterfacePrototypeTableValues, 0 };
144 const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &JSC::JSNonFinalObject::s_info, &JSTestInterfacePrototypeTable, 0 };
145
146 JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
147 {
148     return getDOMPrototype<JSTestInterface>(exec, globalObject);
149 }
150
151 const ClassInfo JSTestInterface::s_info = { "TestInterface", &JSDOMWrapper::s_info, &JSTestInterfaceTable, 0 };
152
153 JSTestInterface::JSTestInterface(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestInterface> impl)
154     : JSDOMWrapper(structure, globalObject)
155     , m_impl(impl)
156 {
157 }
158
159 void JSTestInterface::finishCreation(JSGlobalData& globalData)
160 {
161     Base::finishCreation(globalData);
162     ASSERT(inherits(&s_info));
163 }
164
165 JSObject* JSTestInterface::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
166 {
167     return JSTestInterfacePrototype::create(exec->globalData(), globalObject, JSTestInterfacePrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
168 }
169
170 bool JSTestInterface::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
171 {
172     ASSERT_GC_OBJECT_INHERITS(this, &s_info);
173     return getStaticValueSlot<JSTestInterface, Base>(exec, &JSTestInterfaceTable, this, propertyName, slot);
174 }
175
176 bool JSTestInterface::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
177 {
178     ASSERT_GC_OBJECT_INHERITS(this, &s_info);
179     return getStaticValueDescriptor<JSTestInterface, Base>(exec, &JSTestInterfaceTable, this, propertyName, descriptor);
180 }
181
182 JSValue jsTestInterfaceConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
183 {
184     JSTestInterface* domObject = static_cast<JSTestInterface*>(asObject(slotBase));
185     return JSTestInterface::getConstructor(exec, domObject->globalObject());
186 }
187
188 JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
189 {
190     return getDOMConstructor<JSTestInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
191 }
192
193 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestInterface* impl)
194 {
195     return wrap<JSTestInterface>(exec, globalObject, impl);
196 }
197
198 TestInterface* toTestInterface(JSC::JSValue value)
199 {
200     return value.inherits(&JSTestInterface::s_info) ? static_cast<JSTestInterface*>(asObject(value))->impl() : 0;
201 }
202
203 }
204
205 #endif // ENABLE(Condition1) || ENABLE(Condition2)