|
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(INDEXED_DATABASE) |
|
24 |
|
25 #include "JSIDBKeyRange.h" |
|
26 |
|
27 #include "IDBAny.h" |
|
28 #include "IDBKeyRange.h" |
|
29 #include "JSIDBAny.h" |
|
30 #include <runtime/JSNumberCell.h> |
|
31 #include <wtf/GetPtr.h> |
|
32 |
|
33 using namespace JSC; |
|
34 |
|
35 namespace WebCore { |
|
36 |
|
37 ASSERT_CLASS_FITS_IN_CELL(JSIDBKeyRange); |
|
38 |
|
39 /* Hash table */ |
|
40 #if ENABLE(JIT) |
|
41 #define THUNK_GENERATOR(generator) , generator |
|
42 #else |
|
43 #define THUNK_GENERATOR(generator) |
|
44 #endif |
|
45 |
|
46 static const HashTableValue JSIDBKeyRangeTableValues[5] = |
|
47 { |
|
48 { "left", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeLeft), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
49 { "right", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeRight), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "flags", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeFlags), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
53 }; |
|
54 |
|
55 #undef THUNK_GENERATOR |
|
56 static JSC_CONST_HASHTABLE HashTable JSIDBKeyRangeTable = { 8, 7, JSIDBKeyRangeTableValues, 0 }; |
|
57 /* Hash table for constructor */ |
|
58 #if ENABLE(JIT) |
|
59 #define THUNK_GENERATOR(generator) , generator |
|
60 #else |
|
61 #define THUNK_GENERATOR(generator) |
|
62 #endif |
|
63 |
|
64 static const HashTableValue JSIDBKeyRangeConstructorTableValues[6] = |
|
65 { |
|
66 { "SINGLE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeSINGLE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
67 { "LEFT_OPEN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeLEFT_OPEN), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
68 { "RIGHT_OPEN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeRIGHT_OPEN), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
69 { "LEFT_BOUND", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeLEFT_BOUND), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
70 { "RIGHT_BOUND", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeRIGHT_BOUND), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
71 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
72 }; |
|
73 |
|
74 #undef THUNK_GENERATOR |
|
75 static JSC_CONST_HASHTABLE HashTable JSIDBKeyRangeConstructorTable = { 16, 15, JSIDBKeyRangeConstructorTableValues, 0 }; |
|
76 |
|
77 COMPILE_ASSERT(0 == IDBKeyRange::SINGLE, IDBKeyRangeEnumSINGLEIsWrongUseDontCheckEnums); |
|
78 COMPILE_ASSERT(1 == IDBKeyRange::LEFT_OPEN, IDBKeyRangeEnumLEFT_OPENIsWrongUseDontCheckEnums); |
|
79 COMPILE_ASSERT(2 == IDBKeyRange::RIGHT_OPEN, IDBKeyRangeEnumRIGHT_OPENIsWrongUseDontCheckEnums); |
|
80 COMPILE_ASSERT(4 == IDBKeyRange::LEFT_BOUND, IDBKeyRangeEnumLEFT_BOUNDIsWrongUseDontCheckEnums); |
|
81 COMPILE_ASSERT(8 == IDBKeyRange::RIGHT_BOUND, IDBKeyRangeEnumRIGHT_BOUNDIsWrongUseDontCheckEnums); |
|
82 |
|
83 class JSIDBKeyRangeConstructor : public DOMConstructorObject { |
|
84 public: |
|
85 JSIDBKeyRangeConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
86 |
|
87 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
88 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
89 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
90 static const JSC::ClassInfo s_info; |
|
91 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
92 { |
|
93 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
94 } |
|
95 protected: |
|
96 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
97 }; |
|
98 |
|
99 const ClassInfo JSIDBKeyRangeConstructor::s_info = { "IDBKeyRangeConstructor", 0, &JSIDBKeyRangeConstructorTable, 0 }; |
|
100 |
|
101 JSIDBKeyRangeConstructor::JSIDBKeyRangeConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
102 : DOMConstructorObject(JSIDBKeyRangeConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
103 { |
|
104 putDirect(exec->propertyNames().prototype, JSIDBKeyRangePrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
105 } |
|
106 |
|
107 bool JSIDBKeyRangeConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
108 { |
|
109 return getStaticValueSlot<JSIDBKeyRangeConstructor, DOMObject>(exec, &JSIDBKeyRangeConstructorTable, this, propertyName, slot); |
|
110 } |
|
111 |
|
112 bool JSIDBKeyRangeConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
113 { |
|
114 return getStaticValueDescriptor<JSIDBKeyRangeConstructor, DOMObject>(exec, &JSIDBKeyRangeConstructorTable, this, propertyName, descriptor); |
|
115 } |
|
116 |
|
117 /* Hash table for prototype */ |
|
118 #if ENABLE(JIT) |
|
119 #define THUNK_GENERATOR(generator) , generator |
|
120 #else |
|
121 #define THUNK_GENERATOR(generator) |
|
122 #endif |
|
123 |
|
124 static const HashTableValue JSIDBKeyRangePrototypeTableValues[6] = |
|
125 { |
|
126 { "SINGLE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeSINGLE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
127 { "LEFT_OPEN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeLEFT_OPEN), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
128 { "RIGHT_OPEN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeRIGHT_OPEN), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
129 { "LEFT_BOUND", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeLEFT_BOUND), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
130 { "RIGHT_BOUND", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeRIGHT_BOUND), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
131 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
132 }; |
|
133 |
|
134 #undef THUNK_GENERATOR |
|
135 static JSC_CONST_HASHTABLE HashTable JSIDBKeyRangePrototypeTable = { 16, 15, JSIDBKeyRangePrototypeTableValues, 0 }; |
|
136 const ClassInfo JSIDBKeyRangePrototype::s_info = { "IDBKeyRangePrototype", 0, &JSIDBKeyRangePrototypeTable, 0 }; |
|
137 |
|
138 JSObject* JSIDBKeyRangePrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
139 { |
|
140 return getDOMPrototype<JSIDBKeyRange>(exec, globalObject); |
|
141 } |
|
142 |
|
143 bool JSIDBKeyRangePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
144 { |
|
145 return getStaticValueSlot<JSIDBKeyRangePrototype, JSObject>(exec, &JSIDBKeyRangePrototypeTable, this, propertyName, slot); |
|
146 } |
|
147 |
|
148 bool JSIDBKeyRangePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
149 { |
|
150 return getStaticValueDescriptor<JSIDBKeyRangePrototype, JSObject>(exec, &JSIDBKeyRangePrototypeTable, this, propertyName, descriptor); |
|
151 } |
|
152 |
|
153 const ClassInfo JSIDBKeyRange::s_info = { "IDBKeyRange", 0, &JSIDBKeyRangeTable, 0 }; |
|
154 |
|
155 JSIDBKeyRange::JSIDBKeyRange(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<IDBKeyRange> impl) |
|
156 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
157 , m_impl(impl) |
|
158 { |
|
159 } |
|
160 |
|
161 JSIDBKeyRange::~JSIDBKeyRange() |
|
162 { |
|
163 forgetDOMObject(this, impl()); |
|
164 } |
|
165 |
|
166 JSObject* JSIDBKeyRange::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
167 { |
|
168 return new (exec) JSIDBKeyRangePrototype(globalObject, JSIDBKeyRangePrototype::createStructure(globalObject->objectPrototype())); |
|
169 } |
|
170 |
|
171 bool JSIDBKeyRange::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
172 { |
|
173 return getStaticValueSlot<JSIDBKeyRange, Base>(exec, &JSIDBKeyRangeTable, this, propertyName, slot); |
|
174 } |
|
175 |
|
176 bool JSIDBKeyRange::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
177 { |
|
178 return getStaticValueDescriptor<JSIDBKeyRange, Base>(exec, &JSIDBKeyRangeTable, this, propertyName, descriptor); |
|
179 } |
|
180 |
|
181 JSValue jsIDBKeyRangeLeft(ExecState* exec, JSValue slotBase, const Identifier&) |
|
182 { |
|
183 JSIDBKeyRange* castedThis = static_cast<JSIDBKeyRange*>(asObject(slotBase)); |
|
184 UNUSED_PARAM(exec); |
|
185 IDBKeyRange* imp = static_cast<IDBKeyRange*>(castedThis->impl()); |
|
186 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->left())); |
|
187 return result; |
|
188 } |
|
189 |
|
190 JSValue jsIDBKeyRangeRight(ExecState* exec, JSValue slotBase, const Identifier&) |
|
191 { |
|
192 JSIDBKeyRange* castedThis = static_cast<JSIDBKeyRange*>(asObject(slotBase)); |
|
193 UNUSED_PARAM(exec); |
|
194 IDBKeyRange* imp = static_cast<IDBKeyRange*>(castedThis->impl()); |
|
195 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->right())); |
|
196 return result; |
|
197 } |
|
198 |
|
199 JSValue jsIDBKeyRangeFlags(ExecState* exec, JSValue slotBase, const Identifier&) |
|
200 { |
|
201 JSIDBKeyRange* castedThis = static_cast<JSIDBKeyRange*>(asObject(slotBase)); |
|
202 UNUSED_PARAM(exec); |
|
203 IDBKeyRange* imp = static_cast<IDBKeyRange*>(castedThis->impl()); |
|
204 JSValue result = jsNumber(exec, imp->flags()); |
|
205 return result; |
|
206 } |
|
207 |
|
208 JSValue jsIDBKeyRangeConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
209 { |
|
210 JSIDBKeyRange* domObject = static_cast<JSIDBKeyRange*>(asObject(slotBase)); |
|
211 return JSIDBKeyRange::getConstructor(exec, domObject->globalObject()); |
|
212 } |
|
213 JSValue JSIDBKeyRange::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
214 { |
|
215 return getDOMConstructor<JSIDBKeyRangeConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
216 } |
|
217 |
|
218 // Constant getters |
|
219 |
|
220 JSValue jsIDBKeyRangeSINGLE(ExecState* exec, JSValue, const Identifier&) |
|
221 { |
|
222 return jsNumber(exec, static_cast<int>(0)); |
|
223 } |
|
224 |
|
225 JSValue jsIDBKeyRangeLEFT_OPEN(ExecState* exec, JSValue, const Identifier&) |
|
226 { |
|
227 return jsNumber(exec, static_cast<int>(1)); |
|
228 } |
|
229 |
|
230 JSValue jsIDBKeyRangeRIGHT_OPEN(ExecState* exec, JSValue, const Identifier&) |
|
231 { |
|
232 return jsNumber(exec, static_cast<int>(2)); |
|
233 } |
|
234 |
|
235 JSValue jsIDBKeyRangeLEFT_BOUND(ExecState* exec, JSValue, const Identifier&) |
|
236 { |
|
237 return jsNumber(exec, static_cast<int>(4)); |
|
238 } |
|
239 |
|
240 JSValue jsIDBKeyRangeRIGHT_BOUND(ExecState* exec, JSValue, const Identifier&) |
|
241 { |
|
242 return jsNumber(exec, static_cast<int>(8)); |
|
243 } |
|
244 |
|
245 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, IDBKeyRange* object) |
|
246 { |
|
247 return getDOMObjectWrapper<JSIDBKeyRange>(exec, globalObject, object); |
|
248 } |
|
249 IDBKeyRange* toIDBKeyRange(JSC::JSValue value) |
|
250 { |
|
251 return value.inherits(&JSIDBKeyRange::s_info) ? static_cast<JSIDBKeyRange*>(asObject(value))->impl() : 0; |
|
252 } |
|
253 |
|
254 } |
|
255 |
|
256 #endif // ENABLE(INDEXED_DATABASE) |