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 "JSWebGLCompressedTexturePVRTC.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 JSWebGLCompressedTexturePVRTCPrototype : public JSC::JSNonFinalObject {
42public:
43 using Base = JSC::JSNonFinalObject;
44 static JSWebGLCompressedTexturePVRTCPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
45 {
46 JSWebGLCompressedTexturePVRTCPrototype* ptr = new (NotNull, JSC::allocateCell<JSWebGLCompressedTexturePVRTCPrototype>(vm.heap)) JSWebGLCompressedTexturePVRTCPrototype(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 JSWebGLCompressedTexturePVRTCPrototype(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 JSWebGLCompressedTexturePVRTCPrototypeTableValues[] =
69{
70 { "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x8C00) } },
71 { "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x8C01) } },
72 { "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x8C02) } },
73 { "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x8C03) } },
74};
75
76const ClassInfo JSWebGLCompressedTexturePVRTCPrototype::s_info = { "WebGLCompressedTexturePVRTCPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGLCompressedTexturePVRTCPrototype) };
77
78void JSWebGLCompressedTexturePVRTCPrototype::finishCreation(VM& vm)
79{
80 Base::finishCreation(vm);
81 reifyStaticProperties(vm, JSWebGLCompressedTexturePVRTC::info(), JSWebGLCompressedTexturePVRTCPrototypeTableValues, *this);
82}
83
84const ClassInfo JSWebGLCompressedTexturePVRTC::s_info = { "WebGLCompressedTexturePVRTC", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGLCompressedTexturePVRTC) };
85
86JSWebGLCompressedTexturePVRTC::JSWebGLCompressedTexturePVRTC(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WebGLCompressedTexturePVRTC>&& impl)
87 : JSDOMWrapper<WebGLCompressedTexturePVRTC>(structure, globalObject, WTFMove(impl))
88{
89}
90
91void JSWebGLCompressedTexturePVRTC::finishCreation(VM& vm)
92{
93 Base::finishCreation(vm);
94 ASSERT(inherits(vm, info()));
95
96}
97
98JSObject* JSWebGLCompressedTexturePVRTC::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
99{
100 return JSWebGLCompressedTexturePVRTCPrototype::create(vm, &globalObject, JSWebGLCompressedTexturePVRTCPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
101}
102
103JSObject* JSWebGLCompressedTexturePVRTC::prototype(VM& vm, JSDOMGlobalObject& globalObject)
104{
105 return getDOMPrototype<JSWebGLCompressedTexturePVRTC>(vm, globalObject);
106}
107
108void JSWebGLCompressedTexturePVRTC::destroy(JSC::JSCell* cell)
109{
110 JSWebGLCompressedTexturePVRTC* thisObject = static_cast<JSWebGLCompressedTexturePVRTC*>(cell);
111 thisObject->JSWebGLCompressedTexturePVRTC::~JSWebGLCompressedTexturePVRTC();
112}
113
114void JSWebGLCompressedTexturePVRTC::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
115{
116 auto* thisObject = jsCast<JSWebGLCompressedTexturePVRTC*>(cell);
117 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
118 if (thisObject->scriptExecutionContext())
119 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
120 Base::heapSnapshot(cell, builder);
121}
122
123bool JSWebGLCompressedTexturePVRTCOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
124{
125 auto* jsWebGLCompressedTexturePVRTC = jsCast<JSWebGLCompressedTexturePVRTC*>(handle.slot()->asCell());
126 WebGLRenderingContextBase* root = WTF::getPtr(jsWebGLCompressedTexturePVRTC->wrapped().context());
127 if (UNLIKELY(reason))
128 *reason = "Reachable from WebGLCompressedTexturePVRTC";
129 return visitor.containsOpaqueRoot(root);
130}
131
132void JSWebGLCompressedTexturePVRTCOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
133{
134 auto* jsWebGLCompressedTexturePVRTC = static_cast<JSWebGLCompressedTexturePVRTC*>(handle.slot()->asCell());
135 auto& world = *static_cast<DOMWrapperWorld*>(context);
136 uncacheWrapper(world, &jsWebGLCompressedTexturePVRTC->wrapped(), jsWebGLCompressedTexturePVRTC);
137}
138
139#if ENABLE(BINDING_INTEGRITY)
140#if PLATFORM(WIN)
141#pragma warning(disable: 4483)
142extern "C" { extern void (*const __identifier("??_7WebGLCompressedTexturePVRTC@WebCore@@6B@")[])(); }
143#else
144extern "C" { extern void* _ZTVN7WebCore27WebGLCompressedTexturePVRTCE[]; }
145#endif
146#endif
147
148JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<WebGLCompressedTexturePVRTC>&& impl)
149{
150
151#if ENABLE(BINDING_INTEGRITY)
152 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
153#if PLATFORM(WIN)
154 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7WebGLCompressedTexturePVRTC@WebCore@@6B@"));
155#else
156 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore27WebGLCompressedTexturePVRTCE[2]);
157#endif
158
159 // If this fails WebGLCompressedTexturePVRTC does not have a vtable, so you need to add the
160 // ImplementationLacksVTable attribute to the interface definition
161 static_assert(std::is_polymorphic<WebGLCompressedTexturePVRTC>::value, "WebGLCompressedTexturePVRTC is not polymorphic");
162
163 // If you hit this assertion you either have a use after free bug, or
164 // WebGLCompressedTexturePVRTC has subclasses. If WebGLCompressedTexturePVRTC has subclasses that get passed
165 // to toJS() we currently require WebGLCompressedTexturePVRTC you to opt out of binding hardening
166 // by adding the SkipVTableValidation attribute to the interface IDL definition
167 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
168#endif
169 return createWrapper<WebGLCompressedTexturePVRTC>(globalObject, WTFMove(impl));
170}
171
172JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, WebGLCompressedTexturePVRTC& impl)
173{
174 return wrap(state, globalObject, impl);
175}
176
177WebGLCompressedTexturePVRTC* JSWebGLCompressedTexturePVRTC::toWrapped(JSC::VM& vm, JSC::JSValue value)
178{
179 if (auto* wrapper = jsDynamicCast<JSWebGLCompressedTexturePVRTC*>(vm, value))
180 return &wrapper->wrapped();
181 return nullptr;
182}
183
184}
185
186#endif // ENABLE(WEBGL)
187