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 "JSWebGPUBindGroupDescriptor.h"
26
27#include "JSDOMConvertInterface.h"
28#include "JSDOMConvertSequences.h"
29#include "JSWebGPUBindGroupBinding.h"
30#include "JSWebGPUBindGroupLayout.h"
31#include <JavaScriptCore/JSArray.h>
32#include <JavaScriptCore/JSCInlines.h>
33
34
35namespace WebCore {
36using namespace JSC;
37
38#if ENABLE(WEBGPU)
39
40template<> WebGPUBindGroupDescriptor convertDictionary<WebGPUBindGroupDescriptor>(ExecState& state, JSValue value)
41{
42 VM& vm = state.vm();
43 auto throwScope = DECLARE_THROW_SCOPE(vm);
44 bool isNullOrUndefined = value.isUndefinedOrNull();
45 auto* object = isNullOrUndefined ? nullptr : value.getObject();
46 if (UNLIKELY(!isNullOrUndefined && !object)) {
47 throwTypeError(&state, throwScope);
48 return { };
49 }
50 WebGPUBindGroupDescriptor result;
51 JSValue bindingsValue;
52 if (isNullOrUndefined)
53 bindingsValue = jsUndefined();
54 else {
55 bindingsValue = object->get(&state, Identifier::fromString(&state, "bindings"));
56 RETURN_IF_EXCEPTION(throwScope, { });
57 }
58 if (!bindingsValue.isUndefined()) {
59 result.bindings = convert<IDLSequence<IDLDictionary<WebGPUBindGroupBinding>>>(state, bindingsValue);
60 RETURN_IF_EXCEPTION(throwScope, { });
61 } else {
62 throwRequiredMemberTypeError(state, throwScope, "bindings", "WebGPUBindGroupDescriptor", "sequence");
63 return { };
64 }
65 JSValue layoutValue;
66 if (isNullOrUndefined)
67 layoutValue = jsUndefined();
68 else {
69 layoutValue = object->get(&state, Identifier::fromString(&state, "layout"));
70 RETURN_IF_EXCEPTION(throwScope, { });
71 }
72 if (!layoutValue.isUndefined()) {
73 result.layout = convert<IDLInterface<WebGPUBindGroupLayout>>(state, layoutValue);
74 RETURN_IF_EXCEPTION(throwScope, { });
75 } else {
76 throwRequiredMemberTypeError(state, throwScope, "layout", "WebGPUBindGroupDescriptor", "WebGPUBindGroupLayout");
77 return { };
78 }
79 return result;
80}
81
82#endif
83
84} // namespace WebCore
85
86#endif // ENABLE(WEBGPU)
87