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(WEBGL) |
24 | |
25 | #include "JSWebGLActiveInfo.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructorNotConstructable.h" |
30 | #include "JSDOMConvertNumbers.h" |
31 | #include "JSDOMConvertStrings.h" |
32 | #include "JSDOMExceptionHandling.h" |
33 | #include "JSDOMWrapperCache.h" |
34 | #include "ScriptExecutionContext.h" |
35 | #include <JavaScriptCore/FunctionPrototype.h> |
36 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
37 | #include <JavaScriptCore/JSCInlines.h> |
38 | #include <wtf/GetPtr.h> |
39 | #include <wtf/PointerPreparations.h> |
40 | #include <wtf/URL.h> |
41 | |
42 | |
43 | namespace WebCore { |
44 | using namespace JSC; |
45 | |
46 | // Attributes |
47 | |
48 | JSC::EncodedJSValue jsWebGLActiveInfoConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | bool setJSWebGLActiveInfoConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
50 | JSC::EncodedJSValue jsWebGLActiveInfoSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | JSC::EncodedJSValue jsWebGLActiveInfoType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | JSC::EncodedJSValue jsWebGLActiveInfoName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
53 | |
54 | class JSWebGLActiveInfoPrototype : public JSC::JSNonFinalObject { |
55 | public: |
56 | using Base = JSC::JSNonFinalObject; |
57 | static JSWebGLActiveInfoPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
58 | { |
59 | JSWebGLActiveInfoPrototype* ptr = new (NotNull, JSC::allocateCell<JSWebGLActiveInfoPrototype>(vm.heap)) JSWebGLActiveInfoPrototype(vm, globalObject, structure); |
60 | ptr->finishCreation(vm); |
61 | return ptr; |
62 | } |
63 | |
64 | DECLARE_INFO; |
65 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
66 | { |
67 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
68 | } |
69 | |
70 | private: |
71 | JSWebGLActiveInfoPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
72 | : JSC::JSNonFinalObject(vm, structure) |
73 | { |
74 | } |
75 | |
76 | void finishCreation(JSC::VM&); |
77 | }; |
78 | |
79 | using JSWebGLActiveInfoConstructor = JSDOMConstructorNotConstructable<JSWebGLActiveInfo>; |
80 | |
81 | template<> JSValue JSWebGLActiveInfoConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
82 | { |
83 | UNUSED_PARAM(vm); |
84 | return globalObject.functionPrototype(); |
85 | } |
86 | |
87 | template<> void JSWebGLActiveInfoConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
88 | { |
89 | putDirect(vm, vm.propertyNames->prototype, JSWebGLActiveInfo::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
90 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("WebGLActiveInfo"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
91 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
92 | } |
93 | |
94 | template<> const ClassInfo JSWebGLActiveInfoConstructor::s_info = { "WebGLActiveInfo" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGLActiveInfoConstructor) }; |
95 | |
96 | /* Hash table for prototype */ |
97 | |
98 | static const HashTableValue JSWebGLActiveInfoPrototypeTableValues[] = |
99 | { |
100 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebGLActiveInfoConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebGLActiveInfoConstructor) } }, |
101 | { "size" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebGLActiveInfoSize), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
102 | { "type" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebGLActiveInfoType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
103 | { "name" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebGLActiveInfoName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
104 | }; |
105 | |
106 | const ClassInfo JSWebGLActiveInfoPrototype::s_info = { "WebGLActiveInfoPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGLActiveInfoPrototype) }; |
107 | |
108 | void JSWebGLActiveInfoPrototype::finishCreation(VM& vm) |
109 | { |
110 | Base::finishCreation(vm); |
111 | reifyStaticProperties(vm, JSWebGLActiveInfo::info(), JSWebGLActiveInfoPrototypeTableValues, *this); |
112 | } |
113 | |
114 | const ClassInfo JSWebGLActiveInfo::s_info = { "WebGLActiveInfo" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGLActiveInfo) }; |
115 | |
116 | JSWebGLActiveInfo::JSWebGLActiveInfo(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WebGLActiveInfo>&& impl) |
117 | : JSDOMWrapper<WebGLActiveInfo>(structure, globalObject, WTFMove(impl)) |
118 | { |
119 | } |
120 | |
121 | void JSWebGLActiveInfo::finishCreation(VM& vm) |
122 | { |
123 | Base::finishCreation(vm); |
124 | ASSERT(inherits(vm, info())); |
125 | |
126 | } |
127 | |
128 | JSObject* JSWebGLActiveInfo::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
129 | { |
130 | return JSWebGLActiveInfoPrototype::create(vm, &globalObject, JSWebGLActiveInfoPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
131 | } |
132 | |
133 | JSObject* JSWebGLActiveInfo::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
134 | { |
135 | return getDOMPrototype<JSWebGLActiveInfo>(vm, globalObject); |
136 | } |
137 | |
138 | JSValue JSWebGLActiveInfo::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
139 | { |
140 | return getDOMConstructor<JSWebGLActiveInfoConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
141 | } |
142 | |
143 | void JSWebGLActiveInfo::destroy(JSC::JSCell* cell) |
144 | { |
145 | JSWebGLActiveInfo* thisObject = static_cast<JSWebGLActiveInfo*>(cell); |
146 | thisObject->JSWebGLActiveInfo::~JSWebGLActiveInfo(); |
147 | } |
148 | |
149 | template<> inline JSWebGLActiveInfo* IDLAttribute<JSWebGLActiveInfo>::cast(ExecState& state, EncodedJSValue thisValue) |
150 | { |
151 | return jsDynamicCast<JSWebGLActiveInfo*>(state.vm(), JSValue::decode(thisValue)); |
152 | } |
153 | |
154 | EncodedJSValue jsWebGLActiveInfoConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
155 | { |
156 | VM& vm = state->vm(); |
157 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
158 | auto* prototype = jsDynamicCast<JSWebGLActiveInfoPrototype*>(vm, JSValue::decode(thisValue)); |
159 | if (UNLIKELY(!prototype)) |
160 | return throwVMTypeError(state, throwScope); |
161 | return JSValue::encode(JSWebGLActiveInfo::getConstructor(state->vm(), prototype->globalObject())); |
162 | } |
163 | |
164 | bool setJSWebGLActiveInfoConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
165 | { |
166 | VM& vm = state->vm(); |
167 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
168 | auto* prototype = jsDynamicCast<JSWebGLActiveInfoPrototype*>(vm, JSValue::decode(thisValue)); |
169 | if (UNLIKELY(!prototype)) { |
170 | throwVMTypeError(state, throwScope); |
171 | return false; |
172 | } |
173 | // Shadowing a built-in constructor |
174 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
175 | } |
176 | |
177 | static inline JSValue jsWebGLActiveInfoSizeGetter(ExecState& state, JSWebGLActiveInfo& thisObject, ThrowScope& throwScope) |
178 | { |
179 | UNUSED_PARAM(throwScope); |
180 | UNUSED_PARAM(state); |
181 | auto& impl = thisObject.wrapped(); |
182 | JSValue result = toJS<IDLLong>(state, throwScope, impl.size()); |
183 | return result; |
184 | } |
185 | |
186 | EncodedJSValue jsWebGLActiveInfoSize(ExecState* state, EncodedJSValue thisValue, PropertyName) |
187 | { |
188 | return IDLAttribute<JSWebGLActiveInfo>::get<jsWebGLActiveInfoSizeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "size" ); |
189 | } |
190 | |
191 | static inline JSValue jsWebGLActiveInfoTypeGetter(ExecState& state, JSWebGLActiveInfo& thisObject, ThrowScope& throwScope) |
192 | { |
193 | UNUSED_PARAM(throwScope); |
194 | UNUSED_PARAM(state); |
195 | auto& impl = thisObject.wrapped(); |
196 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.type()); |
197 | return result; |
198 | } |
199 | |
200 | EncodedJSValue jsWebGLActiveInfoType(ExecState* state, EncodedJSValue thisValue, PropertyName) |
201 | { |
202 | return IDLAttribute<JSWebGLActiveInfo>::get<jsWebGLActiveInfoTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type" ); |
203 | } |
204 | |
205 | static inline JSValue jsWebGLActiveInfoNameGetter(ExecState& state, JSWebGLActiveInfo& thisObject, ThrowScope& throwScope) |
206 | { |
207 | UNUSED_PARAM(throwScope); |
208 | UNUSED_PARAM(state); |
209 | auto& impl = thisObject.wrapped(); |
210 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.name()); |
211 | return result; |
212 | } |
213 | |
214 | EncodedJSValue jsWebGLActiveInfoName(ExecState* state, EncodedJSValue thisValue, PropertyName) |
215 | { |
216 | return IDLAttribute<JSWebGLActiveInfo>::get<jsWebGLActiveInfoNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "name" ); |
217 | } |
218 | |
219 | void JSWebGLActiveInfo::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
220 | { |
221 | auto* thisObject = jsCast<JSWebGLActiveInfo*>(cell); |
222 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
223 | if (thisObject->scriptExecutionContext()) |
224 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
225 | Base::heapSnapshot(cell, builder); |
226 | } |
227 | |
228 | bool JSWebGLActiveInfoOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
229 | { |
230 | UNUSED_PARAM(handle); |
231 | UNUSED_PARAM(visitor); |
232 | UNUSED_PARAM(reason); |
233 | return false; |
234 | } |
235 | |
236 | void JSWebGLActiveInfoOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
237 | { |
238 | auto* jsWebGLActiveInfo = static_cast<JSWebGLActiveInfo*>(handle.slot()->asCell()); |
239 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
240 | uncacheWrapper(world, &jsWebGLActiveInfo->wrapped(), jsWebGLActiveInfo); |
241 | } |
242 | |
243 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<WebGLActiveInfo>&& impl) |
244 | { |
245 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
246 | // attribute. You should remove that attribute. If the class has subclasses |
247 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
248 | // attribute to WebGLActiveInfo. |
249 | static_assert(!std::is_polymorphic<WebGLActiveInfo>::value, "WebGLActiveInfo is polymorphic but the IDL claims it is not" ); |
250 | return createWrapper<WebGLActiveInfo>(globalObject, WTFMove(impl)); |
251 | } |
252 | |
253 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, WebGLActiveInfo& impl) |
254 | { |
255 | return wrap(state, globalObject, impl); |
256 | } |
257 | |
258 | WebGLActiveInfo* JSWebGLActiveInfo::toWrapped(JSC::VM& vm, JSC::JSValue value) |
259 | { |
260 | if (auto* wrapper = jsDynamicCast<JSWebGLActiveInfo*>(vm, value)) |
261 | return &wrapper->wrapped(); |
262 | return nullptr; |
263 | } |
264 | |
265 | } |
266 | |
267 | #endif // ENABLE(WEBGL) |
268 | |