script/dom/webgpu/
gpuinternalerror.rs1use dom_struct::dom_struct;
6use js::context::JSContext;
7use js::rust::HandleObject;
8use script_bindings::reflector::reflect_dom_object_with_proto_and_cx;
9
10use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUInternalError_Binding::GPUInternalErrorMethods;
11use crate::dom::bindings::root::DomRoot;
12use crate::dom::bindings::str::DOMString;
13use crate::dom::globalscope::GlobalScope;
14use crate::dom::types::GPUError;
15
16#[dom_struct]
17pub(crate) struct GPUInternalError {
18 gpu_error: GPUError,
19}
20
21impl GPUInternalError {
22 fn new_inherited(message: DOMString) -> Self {
23 Self {
24 gpu_error: GPUError::new_inherited(message),
25 }
26 }
27
28 pub(crate) fn new_with_proto(
29 cx: &mut JSContext,
30 global: &GlobalScope,
31 proto: Option<HandleObject>,
32 message: DOMString,
33 ) -> DomRoot<Self> {
34 reflect_dom_object_with_proto_and_cx(
35 Box::new(Self::new_inherited(message)),
36 global,
37 proto,
38 cx,
39 )
40 }
41}
42
43impl GPUInternalErrorMethods<crate::DomTypeHolder> for GPUInternalError {
44 fn Constructor(
46 cx: &mut JSContext,
47 global: &GlobalScope,
48 proto: Option<HandleObject>,
49 message: DOMString,
50 ) -> DomRoot<Self> {
51 Self::new_with_proto(cx, global, proto, message)
52 }
53}