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