tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSCounter.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 "JSCounter.h"
23
24 #include "Counter.h"
25 #include "KURL.h"
26 #include <runtime/JSString.h>
27 #include <wtf/GetPtr.h>
28
29 using namespace JSC;
30
31 namespace WebCore {
32
33 ASSERT_CLASS_FITS_IN_CELL(JSCounter);
34
35 /* Hash table */
36 #if ENABLE(JIT)
37 #define THUNK_GENERATOR(generator) , generator
38 #else
39 #define THUNK_GENERATOR(generator)
40 #endif
41 #if ENABLE(DFG_JIT)
42 #define INTRINSIC(intrinsic) , intrinsic
43 #else
44 #define INTRINSIC(intrinsic)
45 #endif
46
47 static const HashTableValue JSCounterTableValues[] =
48 {
49     { "identifier", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCounterIdentifier), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
50     { "listStyle", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCounterListStyle), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
51     { "separator", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCounterSeparator), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
52     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCounterConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
54 };
55
56 #undef THUNK_GENERATOR
57 static const HashTable JSCounterTable = { 9, 7, JSCounterTableValues, 0 };
58 /* Hash table for constructor */
59 #if ENABLE(JIT)
60 #define THUNK_GENERATOR(generator) , generator
61 #else
62 #define THUNK_GENERATOR(generator)
63 #endif
64 #if ENABLE(DFG_JIT)
65 #define INTRINSIC(intrinsic) , intrinsic
66 #else
67 #define INTRINSIC(intrinsic)
68 #endif
69
70 static const HashTableValue JSCounterConstructorTableValues[] =
71 {
72     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
73 };
74
75 #undef THUNK_GENERATOR
76 static const HashTable JSCounterConstructorTable = { 1, 0, JSCounterConstructorTableValues, 0 };
77 const ClassInfo JSCounterConstructor::s_info = { "CounterConstructor", &DOMConstructorObject::s_info, &JSCounterConstructorTable, 0, CREATE_METHOD_TABLE(JSCounterConstructor) };
78
79 JSCounterConstructor::JSCounterConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
80     : DOMConstructorObject(structure, globalObject)
81 {
82 }
83
84 void JSCounterConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
85 {
86     Base::finishCreation(exec->globalData());
87     ASSERT(inherits(&s_info));
88     putDirect(exec->globalData(), exec->propertyNames().prototype, JSCounterPrototype::self(exec, globalObject), DontDelete | ReadOnly);
89 }
90
91 bool JSCounterConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
92 {
93     return getStaticValueSlot<JSCounterConstructor, JSDOMWrapper>(exec, &JSCounterConstructorTable, static_cast<JSCounterConstructor*>(cell), propertyName, slot);
94 }
95
96 bool JSCounterConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
97 {
98     return getStaticValueDescriptor<JSCounterConstructor, JSDOMWrapper>(exec, &JSCounterConstructorTable, static_cast<JSCounterConstructor*>(object), propertyName, descriptor);
99 }
100
101 /* Hash table for prototype */
102 #if ENABLE(JIT)
103 #define THUNK_GENERATOR(generator) , generator
104 #else
105 #define THUNK_GENERATOR(generator)
106 #endif
107 #if ENABLE(DFG_JIT)
108 #define INTRINSIC(intrinsic) , intrinsic
109 #else
110 #define INTRINSIC(intrinsic)
111 #endif
112
113 static const HashTableValue JSCounterPrototypeTableValues[] =
114 {
115     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
116 };
117
118 #undef THUNK_GENERATOR
119 static const HashTable JSCounterPrototypeTable = { 1, 0, JSCounterPrototypeTableValues, 0 };
120 const ClassInfo JSCounterPrototype::s_info = { "CounterPrototype", &JSC::JSNonFinalObject::s_info, &JSCounterPrototypeTable, 0, CREATE_METHOD_TABLE(JSCounterPrototype) };
121
122 JSObject* JSCounterPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
123 {
124     return getDOMPrototype<JSCounter>(exec, globalObject);
125 }
126
127 const ClassInfo JSCounter::s_info = { "Counter", &JSDOMWrapper::s_info, &JSCounterTable, 0 , CREATE_METHOD_TABLE(JSCounter) };
128
129 JSCounter::JSCounter(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Counter> impl)
130     : JSDOMWrapper(structure, globalObject)
131     , m_impl(impl.leakRef())
132 {
133 }
134
135 void JSCounter::finishCreation(JSGlobalData& globalData)
136 {
137     Base::finishCreation(globalData);
138     ASSERT(inherits(&s_info));
139 }
140
141 JSObject* JSCounter::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
142 {
143     return JSCounterPrototype::create(exec->globalData(), globalObject, JSCounterPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
144 }
145
146 bool JSCounter::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
147 {
148     JSCounter* thisObject = jsCast<JSCounter*>(cell);
149     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
150     return getStaticValueSlot<JSCounter, Base>(exec, &JSCounterTable, thisObject, propertyName, slot);
151 }
152
153 bool JSCounter::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
154 {
155     JSCounter* thisObject = jsCast<JSCounter*>(object);
156     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
157     return getStaticValueDescriptor<JSCounter, Base>(exec, &JSCounterTable, thisObject, propertyName, descriptor);
158 }
159
160 JSValue jsCounterIdentifier(ExecState* exec, JSValue slotBase, const Identifier&)
161 {
162     JSCounter* castedThis = static_cast<JSCounter*>(asObject(slotBase));
163     UNUSED_PARAM(exec);
164     Counter* imp = static_cast<Counter*>(castedThis->impl());
165     JSValue result = jsString(exec, imp->identifier());
166     return result;
167 }
168
169
170 JSValue jsCounterListStyle(ExecState* exec, JSValue slotBase, const Identifier&)
171 {
172     JSCounter* castedThis = static_cast<JSCounter*>(asObject(slotBase));
173     UNUSED_PARAM(exec);
174     Counter* imp = static_cast<Counter*>(castedThis->impl());
175     JSValue result = jsString(exec, imp->listStyle());
176     return result;
177 }
178
179
180 JSValue jsCounterSeparator(ExecState* exec, JSValue slotBase, const Identifier&)
181 {
182     JSCounter* castedThis = static_cast<JSCounter*>(asObject(slotBase));
183     UNUSED_PARAM(exec);
184     Counter* imp = static_cast<Counter*>(castedThis->impl());
185     JSValue result = jsString(exec, imp->separator());
186     return result;
187 }
188
189
190 JSValue jsCounterConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
191 {
192     JSCounter* domObject = static_cast<JSCounter*>(asObject(slotBase));
193     return JSCounter::getConstructor(exec, domObject->globalObject());
194 }
195
196 JSValue JSCounter::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
197 {
198     return getDOMConstructor<JSCounterConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
199 }
200
201 static inline bool isObservable(JSCounter* jsCounter)
202 {
203     if (jsCounter->hasCustomProperties())
204         return true;
205     return false;
206 }
207
208 bool JSCounterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
209 {
210     JSCounter* jsCounter = static_cast<JSCounter*>(handle.get().asCell());
211     if (!isObservable(jsCounter))
212         return false;
213     UNUSED_PARAM(visitor);
214     return false;
215 }
216
217 void JSCounterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
218 {
219     JSCounter* jsCounter = static_cast<JSCounter*>(handle.get().asCell());
220     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
221     uncacheWrapper(world, jsCounter->impl(), jsCounter);
222     jsCounter->releaseImpl();
223 }
224
225 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Counter* impl)
226 {
227     return wrap<JSCounter>(exec, globalObject, impl);
228 }
229
230 Counter* toCounter(JSC::JSValue value)
231 {
232     return value.inherits(&JSCounter::s_info) ? static_cast<JSCounter*>(asObject(value))->impl() : 0;
233 }
234
235 }