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
30using namespace JSC;
31
32namespace WebCore {
33
34ASSERT_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
43static const HashTableValue JSTestInterfaceTableValues[2] =
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
50static 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
58static const HashTableValue JSTestInterfaceConstructorTableValues[1] =
59{
60    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
61};
62
63#undef THUNK_GENERATOR
64static JSC_CONST_HASHTABLE HashTable JSTestInterfaceConstructorTable = { 1, 0, JSTestInterfaceConstructorTableValues, 0 };
65class JSTestInterfaceConstructor : public DOMConstructorObject {
66public:
67    JSTestInterfaceConstructor(JSC::ExecState*, JSDOMGlobalObject*);
68
69    virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
70    virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
71    static const JSC::ClassInfo s_info;
72    static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
73    {
74        return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
75    }
76protected:
77    static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
78    static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestInterface(JSC::ExecState*);
79    virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
80};
81
82const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", &DOMConstructorObject::s_info, &JSTestInterfaceConstructorTable, 0 };
83
84JSTestInterfaceConstructor::JSTestInterfaceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
85    : DOMConstructorObject(JSTestInterfaceConstructor::createStructure(globalObject->globalData(), globalObject->objectPrototype()), globalObject)
86{
87    ASSERT(inherits(&s_info));
88    putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly);
89}
90
91bool JSTestInterfaceConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
92{
93    return getStaticValueSlot<JSTestInterfaceConstructor, DOMObject>(exec, &JSTestInterfaceConstructorTable, this, propertyName, slot);
94}
95
96bool JSTestInterfaceConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
97{
98    return getStaticValueDescriptor<JSTestInterfaceConstructor, DOMObject>(exec, &JSTestInterfaceConstructorTable, this, propertyName, descriptor);
99}
100
101EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::constructJSTestInterface(ExecState* exec)
102{
103    ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(exec->callee())->scriptExecutionContext();
104    if (!context)
105        return throwVMError(exec, createReferenceError(exec, "Reference error"));
106    return JSValue::encode(asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(exec->callee())->globalObject(), TestInterface::create(context))));
107}
108
109ConstructType JSTestInterfaceConstructor::getConstructData(ConstructData& constructData)
110{
111    constructData.native.function = constructJSTestInterface;
112    return ConstructTypeHost;
113}
114
115/* Hash table for prototype */
116#if ENABLE(JIT)
117#define THUNK_GENERATOR(generator) , generator
118#else
119#define THUNK_GENERATOR(generator)
120#endif
121
122static const HashTableValue JSTestInterfacePrototypeTableValues[1] =
123{
124    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
125};
126
127#undef THUNK_GENERATOR
128static JSC_CONST_HASHTABLE HashTable JSTestInterfacePrototypeTable = { 1, 0, JSTestInterfacePrototypeTableValues, 0 };
129const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSTestInterfacePrototypeTable, 0 };
130
131JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
132{
133    return getDOMPrototype<JSTestInterface>(exec, globalObject);
134}
135
136const ClassInfo JSTestInterface::s_info = { "TestInterface", &DOMObjectWithGlobalPointer::s_info, &JSTestInterfaceTable, 0 };
137
138JSTestInterface::JSTestInterface(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestInterface> impl)
139    : DOMObjectWithGlobalPointer(structure, globalObject)
140    , m_impl(impl)
141{
142    ASSERT(inherits(&s_info));
143}
144
145JSObject* JSTestInterface::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
146{
147    return new (exec) JSTestInterfacePrototype(globalObject, JSTestInterfacePrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype()));
148}
149
150bool JSTestInterface::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
151{
152    return getStaticValueSlot<JSTestInterface, Base>(exec, &JSTestInterfaceTable, this, propertyName, slot);
153}
154
155bool JSTestInterface::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
156{
157    return getStaticValueDescriptor<JSTestInterface, Base>(exec, &JSTestInterfaceTable, this, propertyName, descriptor);
158}
159
160JSValue jsTestInterfaceConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
161{
162    JSTestInterface* domObject = static_cast<JSTestInterface*>(asObject(slotBase));
163    return JSTestInterface::getConstructor(exec, domObject->globalObject());
164}
165
166JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
167{
168    return getDOMConstructor<JSTestInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
169}
170
171JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestInterface* object)
172{
173    return getDOMObjectWrapper<JSTestInterface>(exec, globalObject, object);
174}
175TestInterface* toTestInterface(JSC::JSValue value)
176{
177    return value.inherits(&JSTestInterface::s_info) ? static_cast<JSTestInterface*>(asObject(value))->impl() : 0;
178}
179
180}
181
182#endif // ENABLE(Condition1) || ENABLE(Condition2)
183