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 "JSReadableStreamBYOBReader.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 "ReadableStreamBYOBReaderBuiltins.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 jsReadableStreamBYOBReaderConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSReadableStreamBYOBReaderConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50
51class JSReadableStreamBYOBReaderPrototype : public JSC::JSNonFinalObject {
52public:
53 using Base = JSC::JSNonFinalObject;
54 static JSReadableStreamBYOBReaderPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
55 {
56 JSReadableStreamBYOBReaderPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableStreamBYOBReaderPrototype>(vm.heap)) JSReadableStreamBYOBReaderPrototype(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 JSReadableStreamBYOBReaderPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
69 : JSC::JSNonFinalObject(vm, structure)
70 {
71 }
72
73 void finishCreation(JSC::VM&);
74};
75
76using JSReadableStreamBYOBReaderConstructor = JSDOMBuiltinConstructor<JSReadableStreamBYOBReader>;
77
78template<> JSValue JSReadableStreamBYOBReaderConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
79{
80 UNUSED_PARAM(vm);
81 return globalObject.functionPrototype();
82}
83
84template<> void JSReadableStreamBYOBReaderConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
85{
86 putDirect(vm, vm.propertyNames->prototype, JSReadableStreamBYOBReader::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("ReadableStreamBYOBReader"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
88 putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89}
90
91template<> FunctionExecutable* JSReadableStreamBYOBReaderConstructor::initializeExecutable(VM& vm)
92{
93 return readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeGenerator(vm);
94}
95
96template<> const ClassInfo JSReadableStreamBYOBReaderConstructor::s_info = { "ReadableStreamBYOBReader", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamBYOBReaderConstructor) };
97
98/* Hash table for prototype */
99
100static const HashTableValue JSReadableStreamBYOBReaderPrototypeTableValues[] =
101{
102 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsReadableStreamBYOBReaderConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSReadableStreamBYOBReaderConstructor) } },
103 { "closed", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::Accessor | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamBYOBReaderClosedCodeGenerator), (intptr_t) (0) } },
104 { "read", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamBYOBReaderReadCodeGenerator), (intptr_t) (0) } },
105 { "cancel", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamBYOBReaderCancelCodeGenerator), (intptr_t) (0) } },
106 { "releaseLock", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamBYOBReaderReleaseLockCodeGenerator), (intptr_t) (0) } },
107};
108
109const ClassInfo JSReadableStreamBYOBReaderPrototype::s_info = { "ReadableStreamBYOBReaderPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamBYOBReaderPrototype) };
110
111void JSReadableStreamBYOBReaderPrototype::finishCreation(VM& vm)
112{
113 Base::finishCreation(vm);
114 reifyStaticProperties(vm, JSReadableStreamBYOBReader::info(), JSReadableStreamBYOBReaderPrototypeTableValues, *this);
115}
116
117const ClassInfo JSReadableStreamBYOBReader::s_info = { "ReadableStreamBYOBReader", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamBYOBReader) };
118
119JSReadableStreamBYOBReader::JSReadableStreamBYOBReader(Structure* structure, JSDOMGlobalObject& globalObject)
120 : JSDOMObject(structure, globalObject) { }
121
122void JSReadableStreamBYOBReader::finishCreation(VM& vm)
123{
124 Base::finishCreation(vm);
125 ASSERT(inherits(vm, info()));
126
127}
128
129JSObject* JSReadableStreamBYOBReader::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
130{
131 return JSReadableStreamBYOBReaderPrototype::create(vm, &globalObject, JSReadableStreamBYOBReaderPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
132}
133
134JSObject* JSReadableStreamBYOBReader::prototype(VM& vm, JSDOMGlobalObject& globalObject)
135{
136 return getDOMPrototype<JSReadableStreamBYOBReader>(vm, globalObject);
137}
138
139JSValue JSReadableStreamBYOBReader::getConstructor(VM& vm, const JSGlobalObject* globalObject)
140{
141 return getDOMConstructor<JSReadableStreamBYOBReaderConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
142}
143
144void JSReadableStreamBYOBReader::destroy(JSC::JSCell* cell)
145{
146 JSReadableStreamBYOBReader* thisObject = static_cast<JSReadableStreamBYOBReader*>(cell);
147 thisObject->JSReadableStreamBYOBReader::~JSReadableStreamBYOBReader();
148}
149
150template<> inline JSReadableStreamBYOBReader* IDLAttribute<JSReadableStreamBYOBReader>::cast(ExecState& state, EncodedJSValue thisValue)
151{
152 return jsDynamicCast<JSReadableStreamBYOBReader*>(state.vm(), JSValue::decode(thisValue));
153}
154
155template<> inline JSReadableStreamBYOBReader* IDLOperation<JSReadableStreamBYOBReader>::cast(ExecState& state)
156{
157 return jsDynamicCast<JSReadableStreamBYOBReader*>(state.vm(), state.thisValue());
158}
159
160EncodedJSValue jsReadableStreamBYOBReaderConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
161{
162 VM& vm = state->vm();
163 auto throwScope = DECLARE_THROW_SCOPE(vm);
164 auto* prototype = jsDynamicCast<JSReadableStreamBYOBReaderPrototype*>(vm, JSValue::decode(thisValue));
165 if (UNLIKELY(!prototype))
166 return throwVMTypeError(state, throwScope);
167 return JSValue::encode(JSReadableStreamBYOBReader::getConstructor(state->vm(), prototype->globalObject()));
168}
169
170bool setJSReadableStreamBYOBReaderConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
171{
172 VM& vm = state->vm();
173 auto throwScope = DECLARE_THROW_SCOPE(vm);
174 auto* prototype = jsDynamicCast<JSReadableStreamBYOBReaderPrototype*>(vm, JSValue::decode(thisValue));
175 if (UNLIKELY(!prototype)) {
176 throwVMTypeError(state, throwScope);
177 return false;
178 }
179 // Shadowing a built-in constructor
180 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
181}
182
183
184}
185
186#endif // ENABLE(STREAMS_API)
187