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