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 "JSWebGPUShaderModuleDescriptor.h"
26
27#include "JSDOMConvertBoolean.h"
28#include "JSDOMConvertStrings.h"
29#include <JavaScriptCore/JSCInlines.h>
30
31
32namespace WebCore {
33using namespace JSC;
34
35#if ENABLE(WEBGPU)
36
37template<> WebGPUShaderModuleDescriptor convertDictionary<WebGPUShaderModuleDescriptor>(ExecState& state, JSValue value)
38{
39 VM& vm = state.vm();
40 auto throwScope = DECLARE_THROW_SCOPE(vm);
41 bool isNullOrUndefined = value.isUndefinedOrNull();
42 auto* object = isNullOrUndefined ? nullptr : value.getObject();
43 if (UNLIKELY(!isNullOrUndefined && !object)) {
44 throwTypeError(&state, throwScope);
45 return { };
46 }
47 WebGPUShaderModuleDescriptor result;
48 JSValue codeValue;
49 if (isNullOrUndefined)
50 codeValue = jsUndefined();
51 else {
52 codeValue = object->get(&state, Identifier::fromString(&state, "code"));
53 RETURN_IF_EXCEPTION(throwScope, { });
54 }
55 if (!codeValue.isUndefined()) {
56 result.code = convert<IDLDOMString>(state, codeValue);
57 RETURN_IF_EXCEPTION(throwScope, { });
58 } else {
59 throwRequiredMemberTypeError(state, throwScope, "code", "WebGPUShaderModuleDescriptor", "DOMString");
60 return { };
61 }
62 JSValue isWHLSLValue;
63 if (isNullOrUndefined)
64 isWHLSLValue = jsUndefined();
65 else {
66 isWHLSLValue = object->get(&state, Identifier::fromString(&state, "isWHLSL"));
67 RETURN_IF_EXCEPTION(throwScope, { });
68 }
69 if (!isWHLSLValue.isUndefined()) {
70 result.isWHLSL = convert<IDLBoolean>(state, isWHLSLValue);
71 RETURN_IF_EXCEPTION(throwScope, { });
72 } else
73 result.isWHLSL = false;
74 return result;
75}
76
77#endif
78
79} // namespace WebCore
80
81#endif // ENABLE(WEBGPU)
82