JSTestInterface.cpp revision cad810f21b803229eb11403f9209855525a25d57
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    virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
72    static const JSC::ClassInfo s_info;
73    static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
74    {
75        return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
76    }
77protected:
78    static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
79    static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestInterface(JSC::ExecState*);
80    virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
81};
82
83const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", 0, &JSTestInterfaceConstructorTable, 0 };
84
85JSTestInterfaceConstructor::JSTestInterfaceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
86    : DOMConstructorObject(JSTestInterfaceConstructor::createStructure(globalObject->objectPrototype()), globalObject)
87{
88    putDirect(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", 0, &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", 0, &JSTestInterfaceTable, 0 };
137
138JSTestInterface::JSTestInterface(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestInterface> impl)
139    : DOMObjectWithGlobalPointer(structure, globalObject)
140    , m_impl(impl)
141{
142}
143
144JSTestInterface::~JSTestInterface()
145{
146    forgetDOMObject(this, impl());
147}
148
149JSObject* JSTestInterface::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
150{
151    return new (exec) JSTestInterfacePrototype(globalObject, JSTestInterfacePrototype::createStructure(globalObject->objectPrototype()));
152}
153
154bool JSTestInterface::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
155{
156    return getStaticValueSlot<JSTestInterface, Base>(exec, &JSTestInterfaceTable, this, propertyName, slot);
157}
158
159bool JSTestInterface::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
160{
161    return getStaticValueDescriptor<JSTestInterface, Base>(exec, &JSTestInterfaceTable, this, propertyName, descriptor);
162}
163
164JSValue jsTestInterfaceConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
165{
166    JSTestInterface* domObject = static_cast<JSTestInterface*>(asObject(slotBase));
167    return JSTestInterface::getConstructor(exec, domObject->globalObject());
168}
169JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
170{
171    return getDOMConstructor<JSTestInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
172}
173
174JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestInterface* object)
175{
176    return getDOMObjectWrapper<JSTestInterface>(exec, globalObject, object);
177}
178TestInterface* toTestInterface(JSC::JSValue value)
179{
180    return value.inherits(&JSTestInterface::s_info) ? static_cast<JSTestInterface*>(asObject(value))->impl() : 0;
181}
182
183}
184
185#endif // ENABLE(Condition1) || ENABLE(Condition2)
186