| 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 "JSDynamicsCompressorNode.h" |
| 26 | |
| 27 | #include "JSAudioParam.h" |
| 28 | #include "JSDOMAttribute.h" |
| 29 | #include "JSDOMBinding.h" |
| 30 | #include "JSDOMConstructorNotConstructable.h" |
| 31 | #include "JSDOMConvertInterface.h" |
| 32 | #include "JSDOMExceptionHandling.h" |
| 33 | #include "JSDOMGlobalObject.h" |
| 34 | #include "JSDOMWrapperCache.h" |
| 35 | #include "ScriptExecutionContext.h" |
| 36 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 37 | #include <JavaScriptCore/JSCInlines.h> |
| 38 | #include <wtf/GetPtr.h> |
| 39 | #include <wtf/PointerPreparations.h> |
| 40 | #include <wtf/URL.h> |
| 41 | |
| 42 | |
| 43 | namespace WebCore { |
| 44 | using namespace JSC; |
| 45 | |
| 46 | // Attributes |
| 47 | |
| 48 | JSC::EncodedJSValue jsDynamicsCompressorNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 49 | bool setJSDynamicsCompressorNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 50 | JSC::EncodedJSValue jsDynamicsCompressorNodeThreshold(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 51 | JSC::EncodedJSValue jsDynamicsCompressorNodeKnee(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 52 | JSC::EncodedJSValue jsDynamicsCompressorNodeRatio(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 53 | JSC::EncodedJSValue jsDynamicsCompressorNodeReduction(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 54 | JSC::EncodedJSValue jsDynamicsCompressorNodeAttack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 55 | JSC::EncodedJSValue jsDynamicsCompressorNodeRelease(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 56 | |
| 57 | class JSDynamicsCompressorNodePrototype : public JSC::JSNonFinalObject { |
| 58 | public: |
| 59 | using Base = JSC::JSNonFinalObject; |
| 60 | static JSDynamicsCompressorNodePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 61 | { |
| 62 | JSDynamicsCompressorNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSDynamicsCompressorNodePrototype>(vm.heap)) JSDynamicsCompressorNodePrototype(vm, globalObject, structure); |
| 63 | ptr->finishCreation(vm); |
| 64 | return ptr; |
| 65 | } |
| 66 | |
| 67 | DECLARE_INFO; |
| 68 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 69 | { |
| 70 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 71 | } |
| 72 | |
| 73 | private: |
| 74 | JSDynamicsCompressorNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 75 | : JSC::JSNonFinalObject(vm, structure) |
| 76 | { |
| 77 | } |
| 78 | |
| 79 | void finishCreation(JSC::VM&); |
| 80 | }; |
| 81 | |
| 82 | using JSDynamicsCompressorNodeConstructor = JSDOMConstructorNotConstructable<JSDynamicsCompressorNode>; |
| 83 | |
| 84 | template<> JSValue JSDynamicsCompressorNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 85 | { |
| 86 | return JSAudioNode::getConstructor(vm, &globalObject); |
| 87 | } |
| 88 | |
| 89 | template<> void JSDynamicsCompressorNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 90 | { |
| 91 | putDirect(vm, vm.propertyNames->prototype, JSDynamicsCompressorNode::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 92 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("DynamicsCompressorNode"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 93 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 94 | } |
| 95 | |
| 96 | template<> const ClassInfo JSDynamicsCompressorNodeConstructor::s_info = { "DynamicsCompressorNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDynamicsCompressorNodeConstructor) }; |
| 97 | |
| 98 | /* Hash table for prototype */ |
| 99 | |
| 100 | static const HashTableValue JSDynamicsCompressorNodePrototypeTableValues[] = |
| 101 | { |
| 102 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDynamicsCompressorNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDynamicsCompressorNodeConstructor) } }, |
| 103 | { "threshold" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDynamicsCompressorNodeThreshold), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 104 | { "knee" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDynamicsCompressorNodeKnee), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 105 | { "ratio" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDynamicsCompressorNodeRatio), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 106 | { "reduction" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDynamicsCompressorNodeReduction), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 107 | { "attack" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDynamicsCompressorNodeAttack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 108 | { "release" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDynamicsCompressorNodeRelease), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 109 | }; |
| 110 | |
| 111 | const ClassInfo JSDynamicsCompressorNodePrototype::s_info = { "DynamicsCompressorNodePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDynamicsCompressorNodePrototype) }; |
| 112 | |
| 113 | void JSDynamicsCompressorNodePrototype::finishCreation(VM& vm) |
| 114 | { |
| 115 | Base::finishCreation(vm); |
| 116 | reifyStaticProperties(vm, JSDynamicsCompressorNode::info(), JSDynamicsCompressorNodePrototypeTableValues, *this); |
| 117 | } |
| 118 | |
| 119 | const ClassInfo JSDynamicsCompressorNode::s_info = { "DynamicsCompressorNode" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDynamicsCompressorNode) }; |
| 120 | |
| 121 | JSDynamicsCompressorNode::JSDynamicsCompressorNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DynamicsCompressorNode>&& impl) |
| 122 | : JSAudioNode(structure, globalObject, WTFMove(impl)) |
| 123 | { |
| 124 | } |
| 125 | |
| 126 | void JSDynamicsCompressorNode::finishCreation(VM& vm) |
| 127 | { |
| 128 | Base::finishCreation(vm); |
| 129 | ASSERT(inherits(vm, info())); |
| 130 | |
| 131 | } |
| 132 | |
| 133 | JSObject* JSDynamicsCompressorNode::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 134 | { |
| 135 | return JSDynamicsCompressorNodePrototype::create(vm, &globalObject, JSDynamicsCompressorNodePrototype::createStructure(vm, &globalObject, JSAudioNode::prototype(vm, globalObject))); |
| 136 | } |
| 137 | |
| 138 | JSObject* JSDynamicsCompressorNode::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 139 | { |
| 140 | return getDOMPrototype<JSDynamicsCompressorNode>(vm, globalObject); |
| 141 | } |
| 142 | |
| 143 | JSValue JSDynamicsCompressorNode::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 144 | { |
| 145 | return getDOMConstructor<JSDynamicsCompressorNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 146 | } |
| 147 | |
| 148 | template<> inline JSDynamicsCompressorNode* IDLAttribute<JSDynamicsCompressorNode>::cast(ExecState& state, EncodedJSValue thisValue) |
| 149 | { |
| 150 | return jsDynamicCast<JSDynamicsCompressorNode*>(state.vm(), JSValue::decode(thisValue)); |
| 151 | } |
| 152 | |
| 153 | EncodedJSValue jsDynamicsCompressorNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 154 | { |
| 155 | VM& vm = state->vm(); |
| 156 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 157 | auto* prototype = jsDynamicCast<JSDynamicsCompressorNodePrototype*>(vm, JSValue::decode(thisValue)); |
| 158 | if (UNLIKELY(!prototype)) |
| 159 | return throwVMTypeError(state, throwScope); |
| 160 | return JSValue::encode(JSDynamicsCompressorNode::getConstructor(state->vm(), prototype->globalObject())); |
| 161 | } |
| 162 | |
| 163 | bool setJSDynamicsCompressorNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 164 | { |
| 165 | VM& vm = state->vm(); |
| 166 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 167 | auto* prototype = jsDynamicCast<JSDynamicsCompressorNodePrototype*>(vm, JSValue::decode(thisValue)); |
| 168 | if (UNLIKELY(!prototype)) { |
| 169 | throwVMTypeError(state, throwScope); |
| 170 | return false; |
| 171 | } |
| 172 | // Shadowing a built-in constructor |
| 173 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 174 | } |
| 175 | |
| 176 | static inline JSValue jsDynamicsCompressorNodeThresholdGetter(ExecState& state, JSDynamicsCompressorNode& thisObject, ThrowScope& throwScope) |
| 177 | { |
| 178 | UNUSED_PARAM(throwScope); |
| 179 | UNUSED_PARAM(state); |
| 180 | auto& impl = thisObject.wrapped(); |
| 181 | JSValue result = toJS<IDLInterface<AudioParam>>(state, *thisObject.globalObject(), throwScope, impl.threshold()); |
| 182 | return result; |
| 183 | } |
| 184 | |
| 185 | EncodedJSValue jsDynamicsCompressorNodeThreshold(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 186 | { |
| 187 | return IDLAttribute<JSDynamicsCompressorNode>::get<jsDynamicsCompressorNodeThresholdGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "threshold" ); |
| 188 | } |
| 189 | |
| 190 | static inline JSValue jsDynamicsCompressorNodeKneeGetter(ExecState& state, JSDynamicsCompressorNode& thisObject, ThrowScope& throwScope) |
| 191 | { |
| 192 | UNUSED_PARAM(throwScope); |
| 193 | UNUSED_PARAM(state); |
| 194 | auto& impl = thisObject.wrapped(); |
| 195 | JSValue result = toJS<IDLInterface<AudioParam>>(state, *thisObject.globalObject(), throwScope, impl.knee()); |
| 196 | return result; |
| 197 | } |
| 198 | |
| 199 | EncodedJSValue jsDynamicsCompressorNodeKnee(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 200 | { |
| 201 | return IDLAttribute<JSDynamicsCompressorNode>::get<jsDynamicsCompressorNodeKneeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "knee" ); |
| 202 | } |
| 203 | |
| 204 | static inline JSValue jsDynamicsCompressorNodeRatioGetter(ExecState& state, JSDynamicsCompressorNode& thisObject, ThrowScope& throwScope) |
| 205 | { |
| 206 | UNUSED_PARAM(throwScope); |
| 207 | UNUSED_PARAM(state); |
| 208 | auto& impl = thisObject.wrapped(); |
| 209 | JSValue result = toJS<IDLInterface<AudioParam>>(state, *thisObject.globalObject(), throwScope, impl.ratio()); |
| 210 | return result; |
| 211 | } |
| 212 | |
| 213 | EncodedJSValue jsDynamicsCompressorNodeRatio(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 214 | { |
| 215 | return IDLAttribute<JSDynamicsCompressorNode>::get<jsDynamicsCompressorNodeRatioGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "ratio" ); |
| 216 | } |
| 217 | |
| 218 | static inline JSValue jsDynamicsCompressorNodeReductionGetter(ExecState& state, JSDynamicsCompressorNode& thisObject, ThrowScope& throwScope) |
| 219 | { |
| 220 | UNUSED_PARAM(throwScope); |
| 221 | UNUSED_PARAM(state); |
| 222 | auto& impl = thisObject.wrapped(); |
| 223 | JSValue result = toJS<IDLInterface<AudioParam>>(state, *thisObject.globalObject(), throwScope, impl.reduction()); |
| 224 | return result; |
| 225 | } |
| 226 | |
| 227 | EncodedJSValue jsDynamicsCompressorNodeReduction(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 228 | { |
| 229 | return IDLAttribute<JSDynamicsCompressorNode>::get<jsDynamicsCompressorNodeReductionGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "reduction" ); |
| 230 | } |
| 231 | |
| 232 | static inline JSValue jsDynamicsCompressorNodeAttackGetter(ExecState& state, JSDynamicsCompressorNode& thisObject, ThrowScope& throwScope) |
| 233 | { |
| 234 | UNUSED_PARAM(throwScope); |
| 235 | UNUSED_PARAM(state); |
| 236 | auto& impl = thisObject.wrapped(); |
| 237 | JSValue result = toJS<IDLInterface<AudioParam>>(state, *thisObject.globalObject(), throwScope, impl.attack()); |
| 238 | return result; |
| 239 | } |
| 240 | |
| 241 | EncodedJSValue jsDynamicsCompressorNodeAttack(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 242 | { |
| 243 | return IDLAttribute<JSDynamicsCompressorNode>::get<jsDynamicsCompressorNodeAttackGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "attack" ); |
| 244 | } |
| 245 | |
| 246 | static inline JSValue jsDynamicsCompressorNodeReleaseGetter(ExecState& state, JSDynamicsCompressorNode& thisObject, ThrowScope& throwScope) |
| 247 | { |
| 248 | UNUSED_PARAM(throwScope); |
| 249 | UNUSED_PARAM(state); |
| 250 | auto& impl = thisObject.wrapped(); |
| 251 | JSValue result = toJS<IDLInterface<AudioParam>>(state, *thisObject.globalObject(), throwScope, impl.release()); |
| 252 | return result; |
| 253 | } |
| 254 | |
| 255 | EncodedJSValue jsDynamicsCompressorNodeRelease(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 256 | { |
| 257 | return IDLAttribute<JSDynamicsCompressorNode>::get<jsDynamicsCompressorNodeReleaseGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "release" ); |
| 258 | } |
| 259 | |
| 260 | void JSDynamicsCompressorNode::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 261 | { |
| 262 | auto* thisObject = jsCast<JSDynamicsCompressorNode*>(cell); |
| 263 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 264 | if (thisObject->scriptExecutionContext()) |
| 265 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 266 | Base::heapSnapshot(cell, builder); |
| 267 | } |
| 268 | |
| 269 | #if ENABLE(BINDING_INTEGRITY) |
| 270 | #if PLATFORM(WIN) |
| 271 | #pragma warning(disable: 4483) |
| 272 | extern "C" { extern void (*const __identifier("??_7DynamicsCompressorNode@WebCore@@6B@" )[])(); } |
| 273 | #else |
| 274 | extern "C" { extern void* _ZTVN7WebCore22DynamicsCompressorNodeE[]; } |
| 275 | #endif |
| 276 | #endif |
| 277 | |
| 278 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<DynamicsCompressorNode>&& impl) |
| 279 | { |
| 280 | |
| 281 | #if ENABLE(BINDING_INTEGRITY) |
| 282 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| 283 | #if PLATFORM(WIN) |
| 284 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7DynamicsCompressorNode@WebCore@@6B@" )); |
| 285 | #else |
| 286 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore22DynamicsCompressorNodeE[2]); |
| 287 | #endif |
| 288 | |
| 289 | // If this fails DynamicsCompressorNode does not have a vtable, so you need to add the |
| 290 | // ImplementationLacksVTable attribute to the interface definition |
| 291 | static_assert(std::is_polymorphic<DynamicsCompressorNode>::value, "DynamicsCompressorNode is not polymorphic" ); |
| 292 | |
| 293 | // If you hit this assertion you either have a use after free bug, or |
| 294 | // DynamicsCompressorNode has subclasses. If DynamicsCompressorNode has subclasses that get passed |
| 295 | // to toJS() we currently require DynamicsCompressorNode you to opt out of binding hardening |
| 296 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
| 297 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| 298 | #endif |
| 299 | return createWrapper<DynamicsCompressorNode>(globalObject, WTFMove(impl)); |
| 300 | } |
| 301 | |
| 302 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DynamicsCompressorNode& impl) |
| 303 | { |
| 304 | return wrap(state, globalObject, impl); |
| 305 | } |
| 306 | |
| 307 | |
| 308 | } |
| 309 | |
| 310 | #endif // ENABLE(WEB_AUDIO) |
| 311 | |