| 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(WEB_AUDIO) |
| 24 | |
| 25 | #include "JSChannelMergerNode.h" |
| 26 | |
| 27 | #include "JSDOMBinding.h" |
| 28 | #include "JSDOMConstructorNotConstructable.h" |
| 29 | #include "JSDOMExceptionHandling.h" |
| 30 | #include "JSDOMWrapperCache.h" |
| 31 | #include "ScriptExecutionContext.h" |
| 32 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 33 | #include <JavaScriptCore/JSCInlines.h> |
| 34 | #include <wtf/GetPtr.h> |
| 35 | #include <wtf/PointerPreparations.h> |
| 36 | #include <wtf/URL.h> |
| 37 | |
| 38 | |
| 39 | namespace WebCore { |
| 40 | using namespace JSC; |
| 41 | |
| 42 | // Attributes |
| 43 | |
| 44 | JSC::EncodedJSValue jsChannelMergerNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 45 | bool setJSChannelMergerNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 46 | |
| 47 | class JSChannelMergerNodePrototype : public JSC::JSNonFinalObject { |
| 48 | public: |
| 49 | using Base = JSC::JSNonFinalObject; |
| 50 | static JSChannelMergerNodePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 51 | { |
| 52 | JSChannelMergerNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSChannelMergerNodePrototype>(vm.heap)) JSChannelMergerNodePrototype(vm, globalObject, structure); |
| 53 | ptr->finishCreation(vm); |
| 54 | return ptr; |
| 55 | } |
| 56 | |
| 57 | DECLARE_INFO; |
| 58 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 59 | { |
| 60 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 61 | } |
| 62 | |
| 63 | private: |
| 64 | JSChannelMergerNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 65 | : JSC::JSNonFinalObject(vm, structure) |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | void finishCreation(JSC::VM&); |
| 70 | }; |
| 71 | |
| 72 | using JSChannelMergerNodeConstructor = JSDOMConstructorNotConstructable<JSChannelMergerNode>; |
| 73 | |
| 74 | template<> JSValue JSChannelMergerNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 75 | { |
| 76 | return JSAudioNode::getConstructor(vm, &globalObject); |
| 77 | } |
| 78 | |
| 79 | template<> void JSChannelMergerNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 80 | { |
| 81 | putDirect(vm, vm.propertyNames->prototype, JSChannelMergerNode::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 82 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("ChannelMergerNode"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 83 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 84 | } |
| 85 | |
| 86 | template<> const ClassInfo JSChannelMergerNodeConstructor::s_info = { "ChannelMergerNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSChannelMergerNodeConstructor) }; |
| 87 | |
| 88 | /* Hash table for prototype */ |
| 89 | |
| 90 | static const HashTableValue JSChannelMergerNodePrototypeTableValues[] = |
| 91 | { |
| 92 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsChannelMergerNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSChannelMergerNodeConstructor) } }, |
| 93 | }; |
| 94 | |
| 95 | const ClassInfo JSChannelMergerNodePrototype::s_info = { "ChannelMergerNodePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSChannelMergerNodePrototype) }; |
| 96 | |
| 97 | void JSChannelMergerNodePrototype::finishCreation(VM& vm) |
| 98 | { |
| 99 | Base::finishCreation(vm); |
| 100 | reifyStaticProperties(vm, JSChannelMergerNode::info(), JSChannelMergerNodePrototypeTableValues, *this); |
| 101 | } |
| 102 | |
| 103 | const ClassInfo JSChannelMergerNode::s_info = { "ChannelMergerNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSChannelMergerNode) }; |
| 104 | |
| 105 | JSChannelMergerNode::JSChannelMergerNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<ChannelMergerNode>&& impl) |
| 106 | : JSAudioNode(structure, globalObject, WTFMove(impl)) |
| 107 | { |
| 108 | } |
| 109 | |
| 110 | void JSChannelMergerNode::finishCreation(VM& vm) |
| 111 | { |
| 112 | Base::finishCreation(vm); |
| 113 | ASSERT(inherits(vm, info())); |
| 114 | |
| 115 | } |
| 116 | |
| 117 | JSObject* JSChannelMergerNode::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 118 | { |
| 119 | return JSChannelMergerNodePrototype::create(vm, &globalObject, JSChannelMergerNodePrototype::createStructure(vm, &globalObject, JSAudioNode::prototype(vm, globalObject))); |
| 120 | } |
| 121 | |
| 122 | JSObject* JSChannelMergerNode::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 123 | { |
| 124 | return getDOMPrototype<JSChannelMergerNode>(vm, globalObject); |
| 125 | } |
| 126 | |
| 127 | JSValue JSChannelMergerNode::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 128 | { |
| 129 | return getDOMConstructor<JSChannelMergerNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 130 | } |
| 131 | |
| 132 | EncodedJSValue jsChannelMergerNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 133 | { |
| 134 | VM& vm = state->vm(); |
| 135 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 136 | auto* prototype = jsDynamicCast<JSChannelMergerNodePrototype*>(vm, JSValue::decode(thisValue)); |
| 137 | if (UNLIKELY(!prototype)) |
| 138 | return throwVMTypeError(state, throwScope); |
| 139 | return JSValue::encode(JSChannelMergerNode::getConstructor(state->vm(), prototype->globalObject())); |
| 140 | } |
| 141 | |
| 142 | bool setJSChannelMergerNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 143 | { |
| 144 | VM& vm = state->vm(); |
| 145 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 146 | auto* prototype = jsDynamicCast<JSChannelMergerNodePrototype*>(vm, JSValue::decode(thisValue)); |
| 147 | if (UNLIKELY(!prototype)) { |
| 148 | throwVMTypeError(state, throwScope); |
| 149 | return false; |
| 150 | } |
| 151 | // Shadowing a built-in constructor |
| 152 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 153 | } |
| 154 | |
| 155 | void JSChannelMergerNode::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 156 | { |
| 157 | auto* thisObject = jsCast<JSChannelMergerNode*>(cell); |
| 158 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 159 | if (thisObject->scriptExecutionContext()) |
| 160 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 161 | Base::heapSnapshot(cell, builder); |
| 162 | } |
| 163 | |
| 164 | #if ENABLE(BINDING_INTEGRITY) |
| 165 | #if PLATFORM(WIN) |
| 166 | #pragma warning(disable: 4483) |
| 167 | extern "C" { extern void (*const __identifier("??_7ChannelMergerNode@WebCore@@6B@" )[])(); } |
| 168 | #else |
| 169 | extern "C" { extern void* _ZTVN7WebCore17ChannelMergerNodeE[]; } |
| 170 | #endif |
| 171 | #endif |
| 172 | |
| 173 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<ChannelMergerNode>&& impl) |
| 174 | { |
| 175 | |
| 176 | #if ENABLE(BINDING_INTEGRITY) |
| 177 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| 178 | #if PLATFORM(WIN) |
| 179 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7ChannelMergerNode@WebCore@@6B@" )); |
| 180 | #else |
| 181 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore17ChannelMergerNodeE[2]); |
| 182 | #endif |
| 183 | |
| 184 | // If this fails ChannelMergerNode does not have a vtable, so you need to add the |
| 185 | // ImplementationLacksVTable attribute to the interface definition |
| 186 | static_assert(std::is_polymorphic<ChannelMergerNode>::value, "ChannelMergerNode is not polymorphic" ); |
| 187 | |
| 188 | // If you hit this assertion you either have a use after free bug, or |
| 189 | // ChannelMergerNode has subclasses. If ChannelMergerNode has subclasses that get passed |
| 190 | // to toJS() we currently require ChannelMergerNode you to opt out of binding hardening |
| 191 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
| 192 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| 193 | #endif |
| 194 | return createWrapper<ChannelMergerNode>(globalObject, WTFMove(impl)); |
| 195 | } |
| 196 | |
| 197 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, ChannelMergerNode& impl) |
| 198 | { |
| 199 | return wrap(state, globalObject, impl); |
| 200 | } |
| 201 | |
| 202 | |
| 203 | } |
| 204 | |
| 205 | #endif // ENABLE(WEB_AUDIO) |
| 206 | |