| 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(STREAMS_API) |
| 24 | |
| 25 | #include "JSByteLengthQueuingStrategy.h" |
| 26 | |
| 27 | #include "ByteLengthQueuingStrategyBuiltins.h" |
| 28 | #include "JSDOMBinding.h" |
| 29 | #include "JSDOMBuiltinConstructor.h" |
| 30 | #include "JSDOMExceptionHandling.h" |
| 31 | #include "JSDOMOperation.h" |
| 32 | #include "JSDOMWrapperCache.h" |
| 33 | #include <JavaScriptCore/FunctionPrototype.h> |
| 34 | #include <JavaScriptCore/JSCInlines.h> |
| 35 | #include <wtf/GetPtr.h> |
| 36 | #include <wtf/PointerPreparations.h> |
| 37 | |
| 38 | |
| 39 | namespace WebCore { |
| 40 | using namespace JSC; |
| 41 | |
| 42 | // Functions |
| 43 | |
| 44 | |
| 45 | // Attributes |
| 46 | |
| 47 | JSC::EncodedJSValue jsByteLengthQueuingStrategyConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 48 | bool setJSByteLengthQueuingStrategyConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 49 | |
| 50 | class JSByteLengthQueuingStrategyPrototype : public JSC::JSNonFinalObject { |
| 51 | public: |
| 52 | using Base = JSC::JSNonFinalObject; |
| 53 | static JSByteLengthQueuingStrategyPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 54 | { |
| 55 | JSByteLengthQueuingStrategyPrototype* ptr = new (NotNull, JSC::allocateCell<JSByteLengthQueuingStrategyPrototype>(vm.heap)) JSByteLengthQueuingStrategyPrototype(vm, globalObject, structure); |
| 56 | ptr->finishCreation(vm); |
| 57 | return ptr; |
| 58 | } |
| 59 | |
| 60 | DECLARE_INFO; |
| 61 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 62 | { |
| 63 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 64 | } |
| 65 | |
| 66 | private: |
| 67 | JSByteLengthQueuingStrategyPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 68 | : JSC::JSNonFinalObject(vm, structure) |
| 69 | { |
| 70 | } |
| 71 | |
| 72 | void finishCreation(JSC::VM&); |
| 73 | }; |
| 74 | |
| 75 | using JSByteLengthQueuingStrategyConstructor = JSDOMBuiltinConstructor<JSByteLengthQueuingStrategy>; |
| 76 | |
| 77 | template<> JSValue JSByteLengthQueuingStrategyConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 78 | { |
| 79 | UNUSED_PARAM(vm); |
| 80 | return globalObject.functionPrototype(); |
| 81 | } |
| 82 | |
| 83 | template<> void JSByteLengthQueuingStrategyConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 84 | { |
| 85 | putDirect(vm, vm.propertyNames->prototype, JSByteLengthQueuingStrategy::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 86 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("ByteLengthQueuingStrategy"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 87 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 88 | } |
| 89 | |
| 90 | template<> FunctionExecutable* JSByteLengthQueuingStrategyConstructor::initializeExecutable(VM& vm) |
| 91 | { |
| 92 | return byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeGenerator(vm); |
| 93 | } |
| 94 | |
| 95 | template<> const ClassInfo JSByteLengthQueuingStrategyConstructor::s_info = { "ByteLengthQueuingStrategy" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSByteLengthQueuingStrategyConstructor) }; |
| 96 | |
| 97 | /* Hash table for prototype */ |
| 98 | |
| 99 | static const HashTableValue JSByteLengthQueuingStrategyPrototypeTableValues[] = |
| 100 | { |
| 101 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsByteLengthQueuingStrategyConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSByteLengthQueuingStrategyConstructor) } }, |
| 102 | { "size" , static_cast<unsigned>(JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(byteLengthQueuingStrategySizeCodeGenerator), (intptr_t) (0) } }, |
| 103 | }; |
| 104 | |
| 105 | const ClassInfo JSByteLengthQueuingStrategyPrototype::s_info = { "ByteLengthQueuingStrategyPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSByteLengthQueuingStrategyPrototype) }; |
| 106 | |
| 107 | void JSByteLengthQueuingStrategyPrototype::finishCreation(VM& vm) |
| 108 | { |
| 109 | Base::finishCreation(vm); |
| 110 | reifyStaticProperties(vm, JSByteLengthQueuingStrategy::info(), JSByteLengthQueuingStrategyPrototypeTableValues, *this); |
| 111 | } |
| 112 | |
| 113 | const ClassInfo JSByteLengthQueuingStrategy::s_info = { "ByteLengthQueuingStrategy" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSByteLengthQueuingStrategy) }; |
| 114 | |
| 115 | JSByteLengthQueuingStrategy::JSByteLengthQueuingStrategy(Structure* structure, JSDOMGlobalObject& globalObject) |
| 116 | : JSDOMObject(structure, globalObject) { } |
| 117 | |
| 118 | void JSByteLengthQueuingStrategy::finishCreation(VM& vm) |
| 119 | { |
| 120 | Base::finishCreation(vm); |
| 121 | ASSERT(inherits(vm, info())); |
| 122 | |
| 123 | } |
| 124 | |
| 125 | JSObject* JSByteLengthQueuingStrategy::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 126 | { |
| 127 | return JSByteLengthQueuingStrategyPrototype::create(vm, &globalObject, JSByteLengthQueuingStrategyPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
| 128 | } |
| 129 | |
| 130 | JSObject* JSByteLengthQueuingStrategy::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 131 | { |
| 132 | return getDOMPrototype<JSByteLengthQueuingStrategy>(vm, globalObject); |
| 133 | } |
| 134 | |
| 135 | JSValue JSByteLengthQueuingStrategy::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 136 | { |
| 137 | return getDOMConstructor<JSByteLengthQueuingStrategyConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 138 | } |
| 139 | |
| 140 | void JSByteLengthQueuingStrategy::destroy(JSC::JSCell* cell) |
| 141 | { |
| 142 | JSByteLengthQueuingStrategy* thisObject = static_cast<JSByteLengthQueuingStrategy*>(cell); |
| 143 | thisObject->JSByteLengthQueuingStrategy::~JSByteLengthQueuingStrategy(); |
| 144 | } |
| 145 | |
| 146 | template<> inline JSByteLengthQueuingStrategy* IDLOperation<JSByteLengthQueuingStrategy>::cast(ExecState& state) |
| 147 | { |
| 148 | return jsDynamicCast<JSByteLengthQueuingStrategy*>(state.vm(), state.thisValue()); |
| 149 | } |
| 150 | |
| 151 | EncodedJSValue jsByteLengthQueuingStrategyConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 152 | { |
| 153 | VM& vm = state->vm(); |
| 154 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 155 | auto* prototype = jsDynamicCast<JSByteLengthQueuingStrategyPrototype*>(vm, JSValue::decode(thisValue)); |
| 156 | if (UNLIKELY(!prototype)) |
| 157 | return throwVMTypeError(state, throwScope); |
| 158 | return JSValue::encode(JSByteLengthQueuingStrategy::getConstructor(state->vm(), prototype->globalObject())); |
| 159 | } |
| 160 | |
| 161 | bool setJSByteLengthQueuingStrategyConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 162 | { |
| 163 | VM& vm = state->vm(); |
| 164 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 165 | auto* prototype = jsDynamicCast<JSByteLengthQueuingStrategyPrototype*>(vm, JSValue::decode(thisValue)); |
| 166 | if (UNLIKELY(!prototype)) { |
| 167 | throwVMTypeError(state, throwScope); |
| 168 | return false; |
| 169 | } |
| 170 | // Shadowing a built-in constructor |
| 171 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 172 | } |
| 173 | |
| 174 | |
| 175 | } |
| 176 | |
| 177 | #endif // ENABLE(STREAMS_API) |
| 178 | |