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 "JSVRFrameData.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructor.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 "JSVRPose.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
43namespace WebCore {
44using namespace JSC;
45
46// Attributes
47
48JSC::EncodedJSValue jsVRFrameDataConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSVRFrameDataConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50JSC::EncodedJSValue jsVRFrameDataTimestamp(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51JSC::EncodedJSValue jsVRFrameDataLeftProjectionMatrix(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52JSC::EncodedJSValue jsVRFrameDataLeftViewMatrix(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53JSC::EncodedJSValue jsVRFrameDataRightProjectionMatrix(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54JSC::EncodedJSValue jsVRFrameDataRightViewMatrix(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
55JSC::EncodedJSValue jsVRFrameDataPose(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56
57class JSVRFrameDataPrototype : public JSC::JSNonFinalObject {
58public:
59 using Base = JSC::JSNonFinalObject;
60 static JSVRFrameDataPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
61 {
62 JSVRFrameDataPrototype* ptr = new (NotNull, JSC::allocateCell<JSVRFrameDataPrototype>(vm.heap)) JSVRFrameDataPrototype(vm, globalObject, structure);
63 ptr->finishCreation(vm);
64 return ptr;
65 }
66
67 DECLARE_INFO;
68 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
69 {
70 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
71 }
72
73private:
74 JSVRFrameDataPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
75 : JSC::JSNonFinalObject(vm, structure)
76 {
77 }
78
79 void finishCreation(JSC::VM&);
80};
81
82using JSVRFrameDataConstructor = JSDOMConstructor<JSVRFrameData>;
83
84template<> EncodedJSValue JSC_HOST_CALL JSVRFrameDataConstructor::construct(ExecState* state)
85{
86 VM& vm = state->vm();
87 auto throwScope = DECLARE_THROW_SCOPE(vm);
88 UNUSED_PARAM(throwScope);
89 auto* castedThis = jsCast<JSVRFrameDataConstructor*>(state->jsCallee());
90 ASSERT(castedThis);
91 auto object = VRFrameData::create();
92 return JSValue::encode(toJSNewlyCreated<IDLInterface<VRFrameData>>(*state, *castedThis->globalObject(), WTFMove(object)));
93}
94
95template<> JSValue JSVRFrameDataConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
96{
97 UNUSED_PARAM(vm);
98 return globalObject.functionPrototype();
99}
100
101template<> void JSVRFrameDataConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
102{
103 putDirect(vm, vm.propertyNames->prototype, JSVRFrameData::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
104 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("VRFrameData"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
105 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
106}
107
108template<> const ClassInfo JSVRFrameDataConstructor::s_info = { "VRFrameData", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVRFrameDataConstructor) };
109
110/* Hash table for prototype */
111
112static const HashTableValue JSVRFrameDataPrototypeTableValues[] =
113{
114 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVRFrameDataConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVRFrameDataConstructor) } },
115 { "timestamp", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVRFrameDataTimestamp), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
116 { "leftProjectionMatrix", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVRFrameDataLeftProjectionMatrix), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
117 { "leftViewMatrix", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVRFrameDataLeftViewMatrix), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
118 { "rightProjectionMatrix", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVRFrameDataRightProjectionMatrix), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
119 { "rightViewMatrix", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVRFrameDataRightViewMatrix), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
120 { "pose", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVRFrameDataPose), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
121};
122
123const ClassInfo JSVRFrameDataPrototype::s_info = { "VRFrameDataPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVRFrameDataPrototype) };
124
125void JSVRFrameDataPrototype::finishCreation(VM& vm)
126{
127 Base::finishCreation(vm);
128 reifyStaticProperties(vm, JSVRFrameData::info(), JSVRFrameDataPrototypeTableValues, *this);
129}
130
131const ClassInfo JSVRFrameData::s_info = { "VRFrameData", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVRFrameData) };
132
133JSVRFrameData::JSVRFrameData(Structure* structure, JSDOMGlobalObject& globalObject, Ref<VRFrameData>&& impl)
134 : JSDOMWrapper<VRFrameData>(structure, globalObject, WTFMove(impl))
135{
136}
137
138void JSVRFrameData::finishCreation(VM& vm)
139{
140 Base::finishCreation(vm);
141 ASSERT(inherits(vm, info()));
142
143}
144
145JSObject* JSVRFrameData::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
146{
147 return JSVRFrameDataPrototype::create(vm, &globalObject, JSVRFrameDataPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
148}
149
150JSObject* JSVRFrameData::prototype(VM& vm, JSDOMGlobalObject& globalObject)
151{
152 return getDOMPrototype<JSVRFrameData>(vm, globalObject);
153}
154
155JSValue JSVRFrameData::getConstructor(VM& vm, const JSGlobalObject* globalObject)
156{
157 return getDOMConstructor<JSVRFrameDataConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
158}
159
160void JSVRFrameData::destroy(JSC::JSCell* cell)
161{
162 JSVRFrameData* thisObject = static_cast<JSVRFrameData*>(cell);
163 thisObject->JSVRFrameData::~JSVRFrameData();
164}
165
166template<> inline JSVRFrameData* IDLAttribute<JSVRFrameData>::cast(ExecState& state, EncodedJSValue thisValue)
167{
168 return jsDynamicCast<JSVRFrameData*>(state.vm(), JSValue::decode(thisValue));
169}
170
171EncodedJSValue jsVRFrameDataConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
172{
173 VM& vm = state->vm();
174 auto throwScope = DECLARE_THROW_SCOPE(vm);
175 auto* prototype = jsDynamicCast<JSVRFrameDataPrototype*>(vm, JSValue::decode(thisValue));
176 if (UNLIKELY(!prototype))
177 return throwVMTypeError(state, throwScope);
178 return JSValue::encode(JSVRFrameData::getConstructor(state->vm(), prototype->globalObject()));
179}
180
181bool setJSVRFrameDataConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
182{
183 VM& vm = state->vm();
184 auto throwScope = DECLARE_THROW_SCOPE(vm);
185 auto* prototype = jsDynamicCast<JSVRFrameDataPrototype*>(vm, JSValue::decode(thisValue));
186 if (UNLIKELY(!prototype)) {
187 throwVMTypeError(state, throwScope);
188 return false;
189 }
190 // Shadowing a built-in constructor
191 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
192}
193
194static inline JSValue jsVRFrameDataTimestampGetter(ExecState& state, JSVRFrameData& thisObject, ThrowScope& throwScope)
195{
196 UNUSED_PARAM(throwScope);
197 UNUSED_PARAM(state);
198 auto& impl = thisObject.wrapped();
199 JSValue result = toJS<IDLDouble>(state, throwScope, impl.timestamp());
200 return result;
201}
202
203EncodedJSValue jsVRFrameDataTimestamp(ExecState* state, EncodedJSValue thisValue, PropertyName)
204{
205 return IDLAttribute<JSVRFrameData>::get<jsVRFrameDataTimestampGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "timestamp");
206}
207
208static inline JSValue jsVRFrameDataLeftProjectionMatrixGetter(ExecState& state, JSVRFrameData& thisObject, ThrowScope& throwScope)
209{
210 UNUSED_PARAM(throwScope);
211 UNUSED_PARAM(state);
212 auto& impl = thisObject.wrapped();
213 JSValue result = toJS<IDLFloat32Array>(state, *thisObject.globalObject(), throwScope, impl.leftProjectionMatrix());
214 return result;
215}
216
217EncodedJSValue jsVRFrameDataLeftProjectionMatrix(ExecState* state, EncodedJSValue thisValue, PropertyName)
218{
219 return IDLAttribute<JSVRFrameData>::get<jsVRFrameDataLeftProjectionMatrixGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "leftProjectionMatrix");
220}
221
222static inline JSValue jsVRFrameDataLeftViewMatrixGetter(ExecState& state, JSVRFrameData& thisObject, ThrowScope& throwScope)
223{
224 UNUSED_PARAM(throwScope);
225 UNUSED_PARAM(state);
226 auto& impl = thisObject.wrapped();
227 JSValue result = toJS<IDLFloat32Array>(state, *thisObject.globalObject(), throwScope, impl.leftViewMatrix());
228 return result;
229}
230
231EncodedJSValue jsVRFrameDataLeftViewMatrix(ExecState* state, EncodedJSValue thisValue, PropertyName)
232{
233 return IDLAttribute<JSVRFrameData>::get<jsVRFrameDataLeftViewMatrixGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "leftViewMatrix");
234}
235
236static inline JSValue jsVRFrameDataRightProjectionMatrixGetter(ExecState& state, JSVRFrameData& thisObject, ThrowScope& throwScope)
237{
238 UNUSED_PARAM(throwScope);
239 UNUSED_PARAM(state);
240 auto& impl = thisObject.wrapped();
241 JSValue result = toJS<IDLFloat32Array>(state, *thisObject.globalObject(), throwScope, impl.rightProjectionMatrix());
242 return result;
243}
244
245EncodedJSValue jsVRFrameDataRightProjectionMatrix(ExecState* state, EncodedJSValue thisValue, PropertyName)
246{
247 return IDLAttribute<JSVRFrameData>::get<jsVRFrameDataRightProjectionMatrixGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "rightProjectionMatrix");
248}
249
250static inline JSValue jsVRFrameDataRightViewMatrixGetter(ExecState& state, JSVRFrameData& thisObject, ThrowScope& throwScope)
251{
252 UNUSED_PARAM(throwScope);
253 UNUSED_PARAM(state);
254 auto& impl = thisObject.wrapped();
255 JSValue result = toJS<IDLFloat32Array>(state, *thisObject.globalObject(), throwScope, impl.rightViewMatrix());
256 return result;
257}
258
259EncodedJSValue jsVRFrameDataRightViewMatrix(ExecState* state, EncodedJSValue thisValue, PropertyName)
260{
261 return IDLAttribute<JSVRFrameData>::get<jsVRFrameDataRightViewMatrixGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "rightViewMatrix");
262}
263
264static inline JSValue jsVRFrameDataPoseGetter(ExecState& state, JSVRFrameData& thisObject, ThrowScope& throwScope)
265{
266 UNUSED_PARAM(throwScope);
267 UNUSED_PARAM(state);
268 auto& impl = thisObject.wrapped();
269 JSValue result = toJS<IDLInterface<VRPose>>(state, *thisObject.globalObject(), throwScope, impl.pose());
270 return result;
271}
272
273EncodedJSValue jsVRFrameDataPose(ExecState* state, EncodedJSValue thisValue, PropertyName)
274{
275 return IDLAttribute<JSVRFrameData>::get<jsVRFrameDataPoseGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "pose");
276}
277
278void JSVRFrameData::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
279{
280 auto* thisObject = jsCast<JSVRFrameData*>(cell);
281 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
282 if (thisObject->scriptExecutionContext())
283 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
284 Base::heapSnapshot(cell, builder);
285}
286
287bool JSVRFrameDataOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
288{
289 UNUSED_PARAM(handle);
290 UNUSED_PARAM(visitor);
291 UNUSED_PARAM(reason);
292 return false;
293}
294
295void JSVRFrameDataOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
296{
297 auto* jsVRFrameData = static_cast<JSVRFrameData*>(handle.slot()->asCell());
298 auto& world = *static_cast<DOMWrapperWorld*>(context);
299 uncacheWrapper(world, &jsVRFrameData->wrapped(), jsVRFrameData);
300}
301
302JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<VRFrameData>&& impl)
303{
304 // If you hit this failure the interface definition has the ImplementationLacksVTable
305 // attribute. You should remove that attribute. If the class has subclasses
306 // that may be passed through this toJS() function you should use the SkipVTableValidation
307 // attribute to VRFrameData.
308 static_assert(!std::is_polymorphic<VRFrameData>::value, "VRFrameData is polymorphic but the IDL claims it is not");
309 return createWrapper<VRFrameData>(globalObject, WTFMove(impl));
310}
311
312JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, VRFrameData& impl)
313{
314 return wrap(state, globalObject, impl);
315}
316
317VRFrameData* JSVRFrameData::toWrapped(JSC::VM& vm, JSC::JSValue value)
318{
319 if (auto* wrapper = jsDynamicCast<JSVRFrameData*>(vm, value))
320 return &wrapper->wrapped();
321 return nullptr;
322}
323
324}
325