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