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(WEBGPU) |
24 | |
25 | #include "JSWebGPURenderPipeline.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/FunctionPrototype.h> |
33 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
34 | #include <JavaScriptCore/JSCInlines.h> |
35 | #include <wtf/GetPtr.h> |
36 | #include <wtf/PointerPreparations.h> |
37 | #include <wtf/URL.h> |
38 | |
39 | |
40 | namespace WebCore { |
41 | using namespace JSC; |
42 | |
43 | // Attributes |
44 | |
45 | JSC::EncodedJSValue jsWebGPURenderPipelineConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
46 | bool setJSWebGPURenderPipelineConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
47 | |
48 | class JSWebGPURenderPipelinePrototype : public JSC::JSNonFinalObject { |
49 | public: |
50 | using Base = JSC::JSNonFinalObject; |
51 | static JSWebGPURenderPipelinePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
52 | { |
53 | JSWebGPURenderPipelinePrototype* ptr = new (NotNull, JSC::allocateCell<JSWebGPURenderPipelinePrototype>(vm.heap)) JSWebGPURenderPipelinePrototype(vm, globalObject, structure); |
54 | ptr->finishCreation(vm); |
55 | return ptr; |
56 | } |
57 | |
58 | DECLARE_INFO; |
59 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
60 | { |
61 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
62 | } |
63 | |
64 | private: |
65 | JSWebGPURenderPipelinePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
66 | : JSC::JSNonFinalObject(vm, structure) |
67 | { |
68 | } |
69 | |
70 | void finishCreation(JSC::VM&); |
71 | }; |
72 | |
73 | using JSWebGPURenderPipelineConstructor = JSDOMConstructorNotConstructable<JSWebGPURenderPipeline>; |
74 | |
75 | template<> JSValue JSWebGPURenderPipelineConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
76 | { |
77 | UNUSED_PARAM(vm); |
78 | return globalObject.functionPrototype(); |
79 | } |
80 | |
81 | template<> void JSWebGPURenderPipelineConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
82 | { |
83 | putDirect(vm, vm.propertyNames->prototype, JSWebGPURenderPipeline::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
84 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("GPURenderPipeline"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
85 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
86 | } |
87 | |
88 | template<> const ClassInfo JSWebGPURenderPipelineConstructor::s_info = { "GPURenderPipeline" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGPURenderPipelineConstructor) }; |
89 | |
90 | /* Hash table for prototype */ |
91 | |
92 | static const HashTableValue JSWebGPURenderPipelinePrototypeTableValues[] = |
93 | { |
94 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebGPURenderPipelineConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebGPURenderPipelineConstructor) } }, |
95 | }; |
96 | |
97 | const ClassInfo JSWebGPURenderPipelinePrototype::s_info = { "GPURenderPipelinePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGPURenderPipelinePrototype) }; |
98 | |
99 | void JSWebGPURenderPipelinePrototype::finishCreation(VM& vm) |
100 | { |
101 | Base::finishCreation(vm); |
102 | reifyStaticProperties(vm, JSWebGPURenderPipeline::info(), JSWebGPURenderPipelinePrototypeTableValues, *this); |
103 | } |
104 | |
105 | const ClassInfo JSWebGPURenderPipeline::s_info = { "GPURenderPipeline" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebGPURenderPipeline) }; |
106 | |
107 | JSWebGPURenderPipeline::JSWebGPURenderPipeline(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WebGPURenderPipeline>&& impl) |
108 | : JSDOMWrapper<WebGPURenderPipeline>(structure, globalObject, WTFMove(impl)) |
109 | { |
110 | } |
111 | |
112 | void JSWebGPURenderPipeline::finishCreation(VM& vm) |
113 | { |
114 | Base::finishCreation(vm); |
115 | ASSERT(inherits(vm, info())); |
116 | |
117 | } |
118 | |
119 | JSObject* JSWebGPURenderPipeline::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
120 | { |
121 | return JSWebGPURenderPipelinePrototype::create(vm, &globalObject, JSWebGPURenderPipelinePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
122 | } |
123 | |
124 | JSObject* JSWebGPURenderPipeline::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
125 | { |
126 | return getDOMPrototype<JSWebGPURenderPipeline>(vm, globalObject); |
127 | } |
128 | |
129 | JSValue JSWebGPURenderPipeline::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
130 | { |
131 | return getDOMConstructor<JSWebGPURenderPipelineConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
132 | } |
133 | |
134 | void JSWebGPURenderPipeline::destroy(JSC::JSCell* cell) |
135 | { |
136 | JSWebGPURenderPipeline* thisObject = static_cast<JSWebGPURenderPipeline*>(cell); |
137 | thisObject->JSWebGPURenderPipeline::~JSWebGPURenderPipeline(); |
138 | } |
139 | |
140 | EncodedJSValue jsWebGPURenderPipelineConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
141 | { |
142 | VM& vm = state->vm(); |
143 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
144 | auto* prototype = jsDynamicCast<JSWebGPURenderPipelinePrototype*>(vm, JSValue::decode(thisValue)); |
145 | if (UNLIKELY(!prototype)) |
146 | return throwVMTypeError(state, throwScope); |
147 | return JSValue::encode(JSWebGPURenderPipeline::getConstructor(state->vm(), prototype->globalObject())); |
148 | } |
149 | |
150 | bool setJSWebGPURenderPipelineConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
151 | { |
152 | VM& vm = state->vm(); |
153 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
154 | auto* prototype = jsDynamicCast<JSWebGPURenderPipelinePrototype*>(vm, JSValue::decode(thisValue)); |
155 | if (UNLIKELY(!prototype)) { |
156 | throwVMTypeError(state, throwScope); |
157 | return false; |
158 | } |
159 | // Shadowing a built-in constructor |
160 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
161 | } |
162 | |
163 | void JSWebGPURenderPipeline::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
164 | { |
165 | auto* thisObject = jsCast<JSWebGPURenderPipeline*>(cell); |
166 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
167 | if (thisObject->scriptExecutionContext()) |
168 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
169 | Base::heapSnapshot(cell, builder); |
170 | } |
171 | |
172 | bool JSWebGPURenderPipelineOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
173 | { |
174 | UNUSED_PARAM(handle); |
175 | UNUSED_PARAM(visitor); |
176 | UNUSED_PARAM(reason); |
177 | return false; |
178 | } |
179 | |
180 | void JSWebGPURenderPipelineOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
181 | { |
182 | auto* jsWebGPURenderPipeline = static_cast<JSWebGPURenderPipeline*>(handle.slot()->asCell()); |
183 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
184 | uncacheWrapper(world, &jsWebGPURenderPipeline->wrapped(), jsWebGPURenderPipeline); |
185 | } |
186 | |
187 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<WebGPURenderPipeline>&& impl) |
188 | { |
189 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
190 | // attribute. You should remove that attribute. If the class has subclasses |
191 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
192 | // attribute to WebGPURenderPipeline. |
193 | static_assert(!std::is_polymorphic<WebGPURenderPipeline>::value, "WebGPURenderPipeline is polymorphic but the IDL claims it is not" ); |
194 | return createWrapper<WebGPURenderPipeline>(globalObject, WTFMove(impl)); |
195 | } |
196 | |
197 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, WebGPURenderPipeline& impl) |
198 | { |
199 | return wrap(state, globalObject, impl); |
200 | } |
201 | |
202 | WebGPURenderPipeline* JSWebGPURenderPipeline::toWrapped(JSC::VM& vm, JSC::JSValue value) |
203 | { |
204 | if (auto* wrapper = jsDynamicCast<JSWebGPURenderPipeline*>(vm, value)) |
205 | return &wrapper->wrapped(); |
206 | return nullptr; |
207 | } |
208 | |
209 | } |
210 | |
211 | #endif // ENABLE(WEBGPU) |
212 | |