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