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 "JSWebGLVertexArrayObjectOES.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 | |
38 | namespace WebCore { |
39 | using namespace JSC; |
40 | |
41 | class JSWebGLVertexArrayObjectOESPrototype : public JSC::JSNonFinalObject { |
42 | public: |
43 | using Base = JSC::JSNonFinalObject; |
44 | static JSWebGLVertexArrayObjectOESPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
45 | { |
46 | JSWebGLVertexArrayObjectOESPrototype* ptr = new (NotNull, JSC::allocateCell<JSWebGLVertexArrayObjectOESPrototype>(vm.heap)) JSWebGLVertexArrayObjectOESPrototype(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 | |
57 | private: |
58 | JSWebGLVertexArrayObjectOESPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
59 | : JSC::JSNonFinalObject(vm, structure) |
60 | { |
61 | } |
62 | }; |
63 | |
64 | /* Hash table for prototype */ |
65 | const ClassInfo JSWebGLVertexArrayObjectOESPrototype::s_info = { "WebGLVertexArrayObjectOESPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGLVertexArrayObjectOESPrototype) }; |
66 | |
67 | const ClassInfo JSWebGLVertexArrayObjectOES::s_info = { "WebGLVertexArrayObjectOES" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGLVertexArrayObjectOES) }; |
68 | |
69 | JSWebGLVertexArrayObjectOES::JSWebGLVertexArrayObjectOES(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WebGLVertexArrayObjectOES>&& impl) |
70 | : JSDOMWrapper<WebGLVertexArrayObjectOES>(structure, globalObject, WTFMove(impl)) |
71 | { |
72 | } |
73 | |
74 | void JSWebGLVertexArrayObjectOES::finishCreation(VM& vm) |
75 | { |
76 | Base::finishCreation(vm); |
77 | ASSERT(inherits(vm, info())); |
78 | |
79 | } |
80 | |
81 | JSObject* JSWebGLVertexArrayObjectOES::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
82 | { |
83 | return JSWebGLVertexArrayObjectOESPrototype::create(vm, &globalObject, JSWebGLVertexArrayObjectOESPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
84 | } |
85 | |
86 | JSObject* JSWebGLVertexArrayObjectOES::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
87 | { |
88 | return getDOMPrototype<JSWebGLVertexArrayObjectOES>(vm, globalObject); |
89 | } |
90 | |
91 | void JSWebGLVertexArrayObjectOES::destroy(JSC::JSCell* cell) |
92 | { |
93 | JSWebGLVertexArrayObjectOES* thisObject = static_cast<JSWebGLVertexArrayObjectOES*>(cell); |
94 | thisObject->JSWebGLVertexArrayObjectOES::~JSWebGLVertexArrayObjectOES(); |
95 | } |
96 | |
97 | void JSWebGLVertexArrayObjectOES::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
98 | { |
99 | auto* thisObject = jsCast<JSWebGLVertexArrayObjectOES*>(cell); |
100 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
101 | if (thisObject->scriptExecutionContext()) |
102 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
103 | Base::heapSnapshot(cell, builder); |
104 | } |
105 | |
106 | bool JSWebGLVertexArrayObjectOESOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
107 | { |
108 | UNUSED_PARAM(handle); |
109 | UNUSED_PARAM(visitor); |
110 | UNUSED_PARAM(reason); |
111 | return false; |
112 | } |
113 | |
114 | void JSWebGLVertexArrayObjectOESOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
115 | { |
116 | auto* jsWebGLVertexArrayObjectOES = static_cast<JSWebGLVertexArrayObjectOES*>(handle.slot()->asCell()); |
117 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
118 | uncacheWrapper(world, &jsWebGLVertexArrayObjectOES->wrapped(), jsWebGLVertexArrayObjectOES); |
119 | } |
120 | |
121 | #if ENABLE(BINDING_INTEGRITY) |
122 | #if PLATFORM(WIN) |
123 | #pragma warning(disable: 4483) |
124 | extern "C" { extern void (*const __identifier("??_7WebGLVertexArrayObjectOES@WebCore@@6B@" )[])(); } |
125 | #else |
126 | extern "C" { extern void* _ZTVN7WebCore25WebGLVertexArrayObjectOESE[]; } |
127 | #endif |
128 | #endif |
129 | |
130 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<WebGLVertexArrayObjectOES>&& impl) |
131 | { |
132 | |
133 | #if ENABLE(BINDING_INTEGRITY) |
134 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
135 | #if PLATFORM(WIN) |
136 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7WebGLVertexArrayObjectOES@WebCore@@6B@" )); |
137 | #else |
138 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore25WebGLVertexArrayObjectOESE[2]); |
139 | #endif |
140 | |
141 | // If this fails WebGLVertexArrayObjectOES does not have a vtable, so you need to add the |
142 | // ImplementationLacksVTable attribute to the interface definition |
143 | static_assert(std::is_polymorphic<WebGLVertexArrayObjectOES>::value, "WebGLVertexArrayObjectOES is not polymorphic" ); |
144 | |
145 | // If you hit this assertion you either have a use after free bug, or |
146 | // WebGLVertexArrayObjectOES has subclasses. If WebGLVertexArrayObjectOES has subclasses that get passed |
147 | // to toJS() we currently require WebGLVertexArrayObjectOES you to opt out of binding hardening |
148 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
149 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
150 | #endif |
151 | return createWrapper<WebGLVertexArrayObjectOES>(globalObject, WTFMove(impl)); |
152 | } |
153 | |
154 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, WebGLVertexArrayObjectOES& impl) |
155 | { |
156 | return wrap(state, globalObject, impl); |
157 | } |
158 | |
159 | WebGLVertexArrayObjectOES* JSWebGLVertexArrayObjectOES::toWrapped(JSC::VM& vm, JSC::JSValue value) |
160 | { |
161 | if (auto* wrapper = jsDynamicCast<JSWebGLVertexArrayObjectOES*>(vm, value)) |
162 | return &wrapper->wrapped(); |
163 | return nullptr; |
164 | } |
165 | |
166 | } |
167 | |
168 | #endif // ENABLE(WEBGL) |
169 | |