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