|
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 "JSDOMStringMap.h" |
|
23 |
|
24 #include "AtomicString.h" |
|
25 #include "DOMStringMap.h" |
|
26 #include "JSDOMStringMapCustom.h" |
|
27 #include <wtf/GetPtr.h> |
|
28 |
|
29 using namespace JSC; |
|
30 |
|
31 namespace WebCore { |
|
32 |
|
33 ASSERT_CLASS_FITS_IN_CELL(JSDOMStringMap); |
|
34 |
|
35 /* Hash table */ |
|
36 #if ENABLE(JIT) |
|
37 #define THUNK_GENERATOR(generator) , generator |
|
38 #else |
|
39 #define THUNK_GENERATOR(generator) |
|
40 #endif |
|
41 |
|
42 static const HashTableValue JSDOMStringMapTableValues[2] = |
|
43 { |
|
44 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMStringMapConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
45 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
46 }; |
|
47 |
|
48 #undef THUNK_GENERATOR |
|
49 static JSC_CONST_HASHTABLE HashTable JSDOMStringMapTable = { 2, 1, JSDOMStringMapTableValues, 0 }; |
|
50 /* Hash table for constructor */ |
|
51 #if ENABLE(JIT) |
|
52 #define THUNK_GENERATOR(generator) , generator |
|
53 #else |
|
54 #define THUNK_GENERATOR(generator) |
|
55 #endif |
|
56 |
|
57 static const HashTableValue JSDOMStringMapConstructorTableValues[1] = |
|
58 { |
|
59 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
60 }; |
|
61 |
|
62 #undef THUNK_GENERATOR |
|
63 static JSC_CONST_HASHTABLE HashTable JSDOMStringMapConstructorTable = { 1, 0, JSDOMStringMapConstructorTableValues, 0 }; |
|
64 class JSDOMStringMapConstructor : public DOMConstructorObject { |
|
65 public: |
|
66 JSDOMStringMapConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
67 |
|
68 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
69 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
70 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
71 static const JSC::ClassInfo s_info; |
|
72 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
73 { |
|
74 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
75 } |
|
76 protected: |
|
77 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
78 }; |
|
79 |
|
80 const ClassInfo JSDOMStringMapConstructor::s_info = { "DOMStringMapConstructor", 0, &JSDOMStringMapConstructorTable, 0 }; |
|
81 |
|
82 JSDOMStringMapConstructor::JSDOMStringMapConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
83 : DOMConstructorObject(JSDOMStringMapConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
84 { |
|
85 putDirect(exec->propertyNames().prototype, JSDOMStringMapPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
86 } |
|
87 |
|
88 bool JSDOMStringMapConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
89 { |
|
90 return getStaticValueSlot<JSDOMStringMapConstructor, DOMObject>(exec, &JSDOMStringMapConstructorTable, this, propertyName, slot); |
|
91 } |
|
92 |
|
93 bool JSDOMStringMapConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
94 { |
|
95 return getStaticValueDescriptor<JSDOMStringMapConstructor, DOMObject>(exec, &JSDOMStringMapConstructorTable, this, propertyName, descriptor); |
|
96 } |
|
97 |
|
98 /* Hash table for prototype */ |
|
99 #if ENABLE(JIT) |
|
100 #define THUNK_GENERATOR(generator) , generator |
|
101 #else |
|
102 #define THUNK_GENERATOR(generator) |
|
103 #endif |
|
104 |
|
105 static const HashTableValue JSDOMStringMapPrototypeTableValues[1] = |
|
106 { |
|
107 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
108 }; |
|
109 |
|
110 #undef THUNK_GENERATOR |
|
111 static JSC_CONST_HASHTABLE HashTable JSDOMStringMapPrototypeTable = { 1, 0, JSDOMStringMapPrototypeTableValues, 0 }; |
|
112 const ClassInfo JSDOMStringMapPrototype::s_info = { "DOMStringMapPrototype", 0, &JSDOMStringMapPrototypeTable, 0 }; |
|
113 |
|
114 JSObject* JSDOMStringMapPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
115 { |
|
116 return getDOMPrototype<JSDOMStringMap>(exec, globalObject); |
|
117 } |
|
118 |
|
119 const ClassInfo JSDOMStringMap::s_info = { "DOMStringMap", 0, &JSDOMStringMapTable, 0 }; |
|
120 |
|
121 JSDOMStringMap::JSDOMStringMap(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<DOMStringMap> impl) |
|
122 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
123 , m_impl(impl) |
|
124 { |
|
125 } |
|
126 |
|
127 JSDOMStringMap::~JSDOMStringMap() |
|
128 { |
|
129 forgetDOMObject(this, impl()); |
|
130 } |
|
131 |
|
132 JSObject* JSDOMStringMap::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
133 { |
|
134 return new (exec) JSDOMStringMapPrototype(globalObject, JSDOMStringMapPrototype::createStructure(globalObject->objectPrototype())); |
|
135 } |
|
136 |
|
137 bool JSDOMStringMap::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
138 { |
|
139 const HashEntry* entry = JSDOMStringMapTable.entry(exec, propertyName); |
|
140 if (entry) { |
|
141 slot.setCustom(this, entry->propertyGetter()); |
|
142 return true; |
|
143 } |
|
144 if (canGetItemsForName(exec, static_cast<DOMStringMap*>(impl()), propertyName)) { |
|
145 slot.setCustom(this, nameGetter); |
|
146 return true; |
|
147 } |
|
148 return getStaticValueSlot<JSDOMStringMap, Base>(exec, &JSDOMStringMapTable, this, propertyName, slot); |
|
149 } |
|
150 |
|
151 bool JSDOMStringMap::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
152 { |
|
153 const HashEntry* entry = JSDOMStringMapTable.entry(exec, propertyName); |
|
154 if (entry) { |
|
155 PropertySlot slot; |
|
156 slot.setCustom(this, entry->propertyGetter()); |
|
157 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); |
|
158 return true; |
|
159 } |
|
160 if (canGetItemsForName(exec, static_cast<DOMStringMap*>(impl()), propertyName)) { |
|
161 PropertySlot slot; |
|
162 slot.setCustom(this, nameGetter); |
|
163 descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum); |
|
164 return true; |
|
165 } |
|
166 return getStaticValueDescriptor<JSDOMStringMap, Base>(exec, &JSDOMStringMapTable, this, propertyName, descriptor); |
|
167 } |
|
168 |
|
169 JSValue jsDOMStringMapConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
170 { |
|
171 JSDOMStringMap* domObject = static_cast<JSDOMStringMap*>(asObject(slotBase)); |
|
172 return JSDOMStringMap::getConstructor(exec, domObject->globalObject()); |
|
173 } |
|
174 void JSDOMStringMap::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
175 { |
|
176 if (putDelegate(exec, propertyName, value, slot)) |
|
177 return; |
|
178 Base::put(exec, propertyName, value, slot); |
|
179 } |
|
180 |
|
181 JSValue JSDOMStringMap::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
182 { |
|
183 return getDOMConstructor<JSDOMStringMapConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
184 } |
|
185 |
|
186 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMStringMap* object) |
|
187 { |
|
188 return getDOMObjectWrapper<JSDOMStringMap>(exec, globalObject, object); |
|
189 } |
|
190 DOMStringMap* toDOMStringMap(JSC::JSValue value) |
|
191 { |
|
192 return value.inherits(&JSDOMStringMap::s_info) ? static_cast<JSDOMStringMap*>(asObject(value))->impl() : 0; |
|
193 } |
|
194 |
|
195 } |