| 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 "JSOESVertexArrayObject.h" |
| 26 | |
| 27 | #include "JSDOMBinding.h" |
| 28 | #include "JSDOMConvertBoolean.h" |
| 29 | #include "JSDOMConvertInterface.h" |
| 30 | #include "JSDOMConvertNullable.h" |
| 31 | #include "JSDOMExceptionHandling.h" |
| 32 | #include "JSDOMGlobalObject.h" |
| 33 | #include "JSDOMOperation.h" |
| 34 | #include "JSDOMWrapperCache.h" |
| 35 | #include "JSWebGLVertexArrayObjectOES.h" |
| 36 | #include "ScriptExecutionContext.h" |
| 37 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 38 | #include <JavaScriptCore/JSCInlines.h> |
| 39 | #include <wtf/GetPtr.h> |
| 40 | #include <wtf/PointerPreparations.h> |
| 41 | #include <wtf/URL.h> |
| 42 | |
| 43 | |
| 44 | namespace WebCore { |
| 45 | using namespace JSC; |
| 46 | |
| 47 | // Functions |
| 48 | |
| 49 | JSC::EncodedJSValue JSC_HOST_CALL jsOESVertexArrayObjectPrototypeFunctionCreateVertexArrayOES(JSC::ExecState*); |
| 50 | JSC::EncodedJSValue JSC_HOST_CALL jsOESVertexArrayObjectPrototypeFunctionDeleteVertexArrayOES(JSC::ExecState*); |
| 51 | JSC::EncodedJSValue JSC_HOST_CALL jsOESVertexArrayObjectPrototypeFunctionIsVertexArrayOES(JSC::ExecState*); |
| 52 | JSC::EncodedJSValue JSC_HOST_CALL jsOESVertexArrayObjectPrototypeFunctionBindVertexArrayOES(JSC::ExecState*); |
| 53 | |
| 54 | class JSOESVertexArrayObjectPrototype : public JSC::JSNonFinalObject { |
| 55 | public: |
| 56 | using Base = JSC::JSNonFinalObject; |
| 57 | static JSOESVertexArrayObjectPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 58 | { |
| 59 | JSOESVertexArrayObjectPrototype* ptr = new (NotNull, JSC::allocateCell<JSOESVertexArrayObjectPrototype>(vm.heap)) JSOESVertexArrayObjectPrototype(vm, globalObject, structure); |
| 60 | ptr->finishCreation(vm); |
| 61 | return ptr; |
| 62 | } |
| 63 | |
| 64 | DECLARE_INFO; |
| 65 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 66 | { |
| 67 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 68 | } |
| 69 | |
| 70 | private: |
| 71 | JSOESVertexArrayObjectPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 72 | : JSC::JSNonFinalObject(vm, structure) |
| 73 | { |
| 74 | } |
| 75 | |
| 76 | void finishCreation(JSC::VM&); |
| 77 | }; |
| 78 | |
| 79 | /* Hash table for prototype */ |
| 80 | |
| 81 | static const HashTableValue JSOESVertexArrayObjectPrototypeTableValues[] = |
| 82 | { |
| 83 | { "createVertexArrayOES" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsOESVertexArrayObjectPrototypeFunctionCreateVertexArrayOES), (intptr_t) (0) } }, |
| 84 | { "deleteVertexArrayOES" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsOESVertexArrayObjectPrototypeFunctionDeleteVertexArrayOES), (intptr_t) (0) } }, |
| 85 | { "isVertexArrayOES" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsOESVertexArrayObjectPrototypeFunctionIsVertexArrayOES), (intptr_t) (0) } }, |
| 86 | { "bindVertexArrayOES" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsOESVertexArrayObjectPrototypeFunctionBindVertexArrayOES), (intptr_t) (0) } }, |
| 87 | { "VERTEX_ARRAY_BINDING_OES" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x85B5) } }, |
| 88 | }; |
| 89 | |
| 90 | const ClassInfo JSOESVertexArrayObjectPrototype::s_info = { "OESVertexArrayObjectPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOESVertexArrayObjectPrototype) }; |
| 91 | |
| 92 | void JSOESVertexArrayObjectPrototype::finishCreation(VM& vm) |
| 93 | { |
| 94 | Base::finishCreation(vm); |
| 95 | reifyStaticProperties(vm, JSOESVertexArrayObject::info(), JSOESVertexArrayObjectPrototypeTableValues, *this); |
| 96 | } |
| 97 | |
| 98 | const ClassInfo JSOESVertexArrayObject::s_info = { "OESVertexArrayObject" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOESVertexArrayObject) }; |
| 99 | |
| 100 | JSOESVertexArrayObject::JSOESVertexArrayObject(Structure* structure, JSDOMGlobalObject& globalObject, Ref<OESVertexArrayObject>&& impl) |
| 101 | : JSDOMWrapper<OESVertexArrayObject>(structure, globalObject, WTFMove(impl)) |
| 102 | { |
| 103 | } |
| 104 | |
| 105 | void JSOESVertexArrayObject::finishCreation(VM& vm) |
| 106 | { |
| 107 | Base::finishCreation(vm); |
| 108 | ASSERT(inherits(vm, info())); |
| 109 | |
| 110 | } |
| 111 | |
| 112 | JSObject* JSOESVertexArrayObject::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 113 | { |
| 114 | return JSOESVertexArrayObjectPrototype::create(vm, &globalObject, JSOESVertexArrayObjectPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
| 115 | } |
| 116 | |
| 117 | JSObject* JSOESVertexArrayObject::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 118 | { |
| 119 | return getDOMPrototype<JSOESVertexArrayObject>(vm, globalObject); |
| 120 | } |
| 121 | |
| 122 | void JSOESVertexArrayObject::destroy(JSC::JSCell* cell) |
| 123 | { |
| 124 | JSOESVertexArrayObject* thisObject = static_cast<JSOESVertexArrayObject*>(cell); |
| 125 | thisObject->JSOESVertexArrayObject::~JSOESVertexArrayObject(); |
| 126 | } |
| 127 | |
| 128 | template<> inline JSOESVertexArrayObject* IDLOperation<JSOESVertexArrayObject>::cast(ExecState& state) |
| 129 | { |
| 130 | return jsDynamicCast<JSOESVertexArrayObject*>(state.vm(), state.thisValue()); |
| 131 | } |
| 132 | |
| 133 | static inline JSC::EncodedJSValue jsOESVertexArrayObjectPrototypeFunctionCreateVertexArrayOESBody(JSC::ExecState* state, typename IDLOperation<JSOESVertexArrayObject>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 134 | { |
| 135 | UNUSED_PARAM(state); |
| 136 | UNUSED_PARAM(throwScope); |
| 137 | auto& impl = castedThis->wrapped(); |
| 138 | return JSValue::encode(toJS<IDLInterface<WebGLVertexArrayObjectOES>>(*state, *castedThis->globalObject(), impl.createVertexArrayOES())); |
| 139 | } |
| 140 | |
| 141 | EncodedJSValue JSC_HOST_CALL jsOESVertexArrayObjectPrototypeFunctionCreateVertexArrayOES(ExecState* state) |
| 142 | { |
| 143 | return IDLOperation<JSOESVertexArrayObject>::call<jsOESVertexArrayObjectPrototypeFunctionCreateVertexArrayOESBody>(*state, "createVertexArrayOES" ); |
| 144 | } |
| 145 | |
| 146 | static inline JSC::EncodedJSValue jsOESVertexArrayObjectPrototypeFunctionDeleteVertexArrayOESBody(JSC::ExecState* state, typename IDLOperation<JSOESVertexArrayObject>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 147 | { |
| 148 | UNUSED_PARAM(state); |
| 149 | UNUSED_PARAM(throwScope); |
| 150 | auto& impl = castedThis->wrapped(); |
| 151 | auto arrayObject = convert<IDLNullable<IDLInterface<WebGLVertexArrayObjectOES>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "arrayObject" , "OESVertexArrayObject" , "deleteVertexArrayOES" , "WebGLVertexArrayObjectOES" ); }); |
| 152 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 153 | impl.deleteVertexArrayOES(WTFMove(arrayObject)); |
| 154 | return JSValue::encode(jsUndefined()); |
| 155 | } |
| 156 | |
| 157 | EncodedJSValue JSC_HOST_CALL jsOESVertexArrayObjectPrototypeFunctionDeleteVertexArrayOES(ExecState* state) |
| 158 | { |
| 159 | return IDLOperation<JSOESVertexArrayObject>::call<jsOESVertexArrayObjectPrototypeFunctionDeleteVertexArrayOESBody>(*state, "deleteVertexArrayOES" ); |
| 160 | } |
| 161 | |
| 162 | static inline JSC::EncodedJSValue jsOESVertexArrayObjectPrototypeFunctionIsVertexArrayOESBody(JSC::ExecState* state, typename IDLOperation<JSOESVertexArrayObject>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 163 | { |
| 164 | UNUSED_PARAM(state); |
| 165 | UNUSED_PARAM(throwScope); |
| 166 | auto& impl = castedThis->wrapped(); |
| 167 | auto arrayObject = convert<IDLNullable<IDLInterface<WebGLVertexArrayObjectOES>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "arrayObject" , "OESVertexArrayObject" , "isVertexArrayOES" , "WebGLVertexArrayObjectOES" ); }); |
| 168 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 169 | return JSValue::encode(toJS<IDLBoolean>(impl.isVertexArrayOES(WTFMove(arrayObject)))); |
| 170 | } |
| 171 | |
| 172 | EncodedJSValue JSC_HOST_CALL jsOESVertexArrayObjectPrototypeFunctionIsVertexArrayOES(ExecState* state) |
| 173 | { |
| 174 | return IDLOperation<JSOESVertexArrayObject>::call<jsOESVertexArrayObjectPrototypeFunctionIsVertexArrayOESBody>(*state, "isVertexArrayOES" ); |
| 175 | } |
| 176 | |
| 177 | static inline JSC::EncodedJSValue jsOESVertexArrayObjectPrototypeFunctionBindVertexArrayOESBody(JSC::ExecState* state, typename IDLOperation<JSOESVertexArrayObject>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 178 | { |
| 179 | UNUSED_PARAM(state); |
| 180 | UNUSED_PARAM(throwScope); |
| 181 | auto& impl = castedThis->wrapped(); |
| 182 | auto arrayObject = convert<IDLNullable<IDLInterface<WebGLVertexArrayObjectOES>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "arrayObject" , "OESVertexArrayObject" , "bindVertexArrayOES" , "WebGLVertexArrayObjectOES" ); }); |
| 183 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 184 | impl.bindVertexArrayOES(WTFMove(arrayObject)); |
| 185 | return JSValue::encode(jsUndefined()); |
| 186 | } |
| 187 | |
| 188 | EncodedJSValue JSC_HOST_CALL jsOESVertexArrayObjectPrototypeFunctionBindVertexArrayOES(ExecState* state) |
| 189 | { |
| 190 | return IDLOperation<JSOESVertexArrayObject>::call<jsOESVertexArrayObjectPrototypeFunctionBindVertexArrayOESBody>(*state, "bindVertexArrayOES" ); |
| 191 | } |
| 192 | |
| 193 | void JSOESVertexArrayObject::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 194 | { |
| 195 | auto* thisObject = jsCast<JSOESVertexArrayObject*>(cell); |
| 196 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 197 | if (thisObject->scriptExecutionContext()) |
| 198 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 199 | Base::heapSnapshot(cell, builder); |
| 200 | } |
| 201 | |
| 202 | bool JSOESVertexArrayObjectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
| 203 | { |
| 204 | auto* jsOESVertexArrayObject = jsCast<JSOESVertexArrayObject*>(handle.slot()->asCell()); |
| 205 | WebGLRenderingContextBase* root = WTF::getPtr(jsOESVertexArrayObject->wrapped().context()); |
| 206 | if (UNLIKELY(reason)) |
| 207 | *reason = "Reachable from OESVertexArrayObject" ; |
| 208 | return visitor.containsOpaqueRoot(root); |
| 209 | } |
| 210 | |
| 211 | void JSOESVertexArrayObjectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| 212 | { |
| 213 | auto* jsOESVertexArrayObject = static_cast<JSOESVertexArrayObject*>(handle.slot()->asCell()); |
| 214 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
| 215 | uncacheWrapper(world, &jsOESVertexArrayObject->wrapped(), jsOESVertexArrayObject); |
| 216 | } |
| 217 | |
| 218 | #if ENABLE(BINDING_INTEGRITY) |
| 219 | #if PLATFORM(WIN) |
| 220 | #pragma warning(disable: 4483) |
| 221 | extern "C" { extern void (*const __identifier("??_7OESVertexArrayObject@WebCore@@6B@" )[])(); } |
| 222 | #else |
| 223 | extern "C" { extern void* _ZTVN7WebCore20OESVertexArrayObjectE[]; } |
| 224 | #endif |
| 225 | #endif |
| 226 | |
| 227 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<OESVertexArrayObject>&& impl) |
| 228 | { |
| 229 | |
| 230 | #if ENABLE(BINDING_INTEGRITY) |
| 231 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| 232 | #if PLATFORM(WIN) |
| 233 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7OESVertexArrayObject@WebCore@@6B@" )); |
| 234 | #else |
| 235 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore20OESVertexArrayObjectE[2]); |
| 236 | #endif |
| 237 | |
| 238 | // If this fails OESVertexArrayObject does not have a vtable, so you need to add the |
| 239 | // ImplementationLacksVTable attribute to the interface definition |
| 240 | static_assert(std::is_polymorphic<OESVertexArrayObject>::value, "OESVertexArrayObject is not polymorphic" ); |
| 241 | |
| 242 | // If you hit this assertion you either have a use after free bug, or |
| 243 | // OESVertexArrayObject has subclasses. If OESVertexArrayObject has subclasses that get passed |
| 244 | // to toJS() we currently require OESVertexArrayObject you to opt out of binding hardening |
| 245 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
| 246 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| 247 | #endif |
| 248 | return createWrapper<OESVertexArrayObject>(globalObject, WTFMove(impl)); |
| 249 | } |
| 250 | |
| 251 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, OESVertexArrayObject& impl) |
| 252 | { |
| 253 | return wrap(state, globalObject, impl); |
| 254 | } |
| 255 | |
| 256 | OESVertexArrayObject* JSOESVertexArrayObject::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 257 | { |
| 258 | if (auto* wrapper = jsDynamicCast<JSOESVertexArrayObject*>(vm, value)) |
| 259 | return &wrapper->wrapped(); |
| 260 | return nullptr; |
| 261 | } |
| 262 | |
| 263 | } |
| 264 | |
| 265 | #endif // ENABLE(WEBGL) |
| 266 | |