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