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;
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(cx, Box::new(Self::new_inherited(message)), global, proto)
35 }
36}
37
38impl GPUInternalErrorMethods<crate::DomTypeHolder> for GPUInternalError {
39 fn Constructor(
41 cx: &mut JSContext,
42 global: &GlobalScope,
43 proto: Option<HandleObject>,
44 message: DOMString,
45 ) -> DomRoot<Self> {
46 Self::new_with_proto(cx, global, proto, message)
47 }
48}