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 "JSOESTextureHalfFloat.h"
26
27#include "JSDOMBinding.h"
28#include "JSDOMExceptionHandling.h"
29#include "JSDOMWrapperCache.h"
30#include "ScriptExecutionContext.h"
31#include <JavaScriptCore/HeapSnapshotBuilder.h>
32#include <JavaScriptCore/JSCInlines.h>
33#include <wtf/GetPtr.h>
34#include <wtf/PointerPreparations.h>
35#include <wtf/URL.h>
36
37
38namespace WebCore {
39using namespace JSC;
40
41class JSOESTextureHalfFloatPrototype : public JSC::JSNonFinalObject {
42public:
43 using Base = JSC::JSNonFinalObject;
44 static JSOESTextureHalfFloatPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
45 {
46 JSOESTextureHalfFloatPrototype* ptr = new (NotNull, JSC::allocateCell<JSOESTextureHalfFloatPrototype>(vm.heap)) JSOESTextureHalfFloatPrototype(vm, globalObject, structure);
47 ptr->finishCreation(vm);
48 return ptr;
49 }
50
51 DECLARE_INFO;
52 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53 {
54 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55 }
56
57private:
58 JSOESTextureHalfFloatPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
59 : JSC::JSNonFinalObject(vm, structure)
60 {
61 }
62
63 void finishCreation(JSC::VM&);
64};
65
66/* Hash table for prototype */
67
68static const HashTableValue JSOESTextureHalfFloatPrototypeTableValues[] =
69{
70 { "HALF_FLOAT_OES", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x8D61) } },
71};
72
73const ClassInfo JSOESTextureHalfFloatPrototype::s_info = { "OESTextureHalfFloatPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOESTextureHalfFloatPrototype) };
74
75void JSOESTextureHalfFloatPrototype::finishCreation(VM& vm)
76{
77 Base::finishCreation(vm);
78 reifyStaticProperties(vm, JSOESTextureHalfFloat::info(), JSOESTextureHalfFloatPrototypeTableValues, *this);
79}
80
81const ClassInfo JSOESTextureHalfFloat::s_info = { "OESTextureHalfFloat", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOESTextureHalfFloat) };
82
83JSOESTextureHalfFloat::JSOESTextureHalfFloat(Structure* structure, JSDOMGlobalObject& globalObject, Ref<OESTextureHalfFloat>&& impl)
84 : JSDOMWrapper<OESTextureHalfFloat>(structure, globalObject, WTFMove(impl))
85{
86}
87
88void JSOESTextureHalfFloat::finishCreation(VM& vm)
89{
90 Base::finishCreation(vm);
91 ASSERT(inherits(vm, info()));
92
93}
94
95JSObject* JSOESTextureHalfFloat::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
96{
97 return JSOESTextureHalfFloatPrototype::create(vm, &globalObject, JSOESTextureHalfFloatPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
98}
99
100JSObject* JSOESTextureHalfFloat::prototype(VM& vm, JSDOMGlobalObject& globalObject)
101{
102 return getDOMPrototype<JSOESTextureHalfFloat>(vm, globalObject);
103}
104
105void JSOESTextureHalfFloat::destroy(JSC::JSCell* cell)
106{
107 JSOESTextureHalfFloat* thisObject = static_cast<JSOESTextureHalfFloat*>(cell);
108 thisObject->JSOESTextureHalfFloat::~JSOESTextureHalfFloat();
109}
110
111void JSOESTextureHalfFloat::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
112{
113 auto* thisObject = jsCast<JSOESTextureHalfFloat*>(cell);
114 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
115 if (thisObject->scriptExecutionContext())
116 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
117 Base::heapSnapshot(cell, builder);
118}
119
120bool JSOESTextureHalfFloatOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
121{
122 auto* jsOESTextureHalfFloat = jsCast<JSOESTextureHalfFloat*>(handle.slot()->asCell());
123 WebGLRenderingContextBase* root = WTF::getPtr(jsOESTextureHalfFloat->wrapped().context());
124 if (UNLIKELY(reason))
125 *reason = "Reachable from OESTextureHalfFloat";
126 return visitor.containsOpaqueRoot(root);
127}
128
129void JSOESTextureHalfFloatOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
130{
131 auto* jsOESTextureHalfFloat = static_cast<JSOESTextureHalfFloat*>(handle.slot()->asCell());
132 auto& world = *static_cast<DOMWrapperWorld*>(context);
133 uncacheWrapper(world, &jsOESTextureHalfFloat->wrapped(), jsOESTextureHalfFloat);
134}
135
136#if ENABLE(BINDING_INTEGRITY)
137#if PLATFORM(WIN)
138#pragma warning(disable: 4483)
139extern "C" { extern void (*const __identifier("??_7OESTextureHalfFloat@WebCore@@6B@")[])(); }
140#else
141extern "C" { extern void* _ZTVN7WebCore19OESTextureHalfFloatE[]; }
142#endif
143#endif
144
145JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<OESTextureHalfFloat>&& impl)
146{
147
148#if ENABLE(BINDING_INTEGRITY)
149 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
150#if PLATFORM(WIN)
151 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7OESTextureHalfFloat@WebCore@@6B@"));
152#else
153 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore19OESTextureHalfFloatE[2]);
154#endif
155
156 // If this fails OESTextureHalfFloat does not have a vtable, so you need to add the
157 // ImplementationLacksVTable attribute to the interface definition
158 static_assert(std::is_polymorphic<OESTextureHalfFloat>::value, "OESTextureHalfFloat is not polymorphic");
159
160 // If you hit this assertion you either have a use after free bug, or
161 // OESTextureHalfFloat has subclasses. If OESTextureHalfFloat has subclasses that get passed
162 // to toJS() we currently require OESTextureHalfFloat you to opt out of binding hardening
163 // by adding the SkipVTableValidation attribute to the interface IDL definition
164 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
165#endif
166 return createWrapper<OESTextureHalfFloat>(globalObject, WTFMove(impl));
167}
168
169JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, OESTextureHalfFloat& impl)
170{
171 return wrap(state, globalObject, impl);
172}
173
174OESTextureHalfFloat* JSOESTextureHalfFloat::toWrapped(JSC::VM& vm, JSC::JSValue value)
175{
176 if (auto* wrapper = jsDynamicCast<JSOESTextureHalfFloat*>(vm, value))
177 return &wrapper->wrapped();
178 return nullptr;
179}
180
181}
182
183#endif // ENABLE(WEBGL)
184