script/dom/webgpu/
gpuinternalerror.rs1use dom_struct::dom_struct;
6use js::rust::HandleObject;
7
8use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUInternalError_Binding::GPUInternalErrorMethods;
9use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::bindings::str::DOMString;
12use crate::dom::globalscope::GlobalScope;
13use crate::dom::types::GPUError;
14use crate::script_runtime::CanGc;
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 global: &GlobalScope,
30 proto: Option<HandleObject>,
31 message: DOMString,
32 can_gc: CanGc,
33 ) -> DomRoot<Self> {
34 reflect_dom_object_with_proto(
35 Box::new(Self::new_inherited(message)),
36 global,
37 proto,
38 can_gc,
39 )
40 }
41}
42
43impl GPUInternalErrorMethods<crate::DomTypeHolder> for GPUInternalError {
44 fn Constructor(
46 global: &GlobalScope,
47 proto: Option<HandleObject>,
48 can_gc: CanGc,
49 message: DOMString,
50 ) -> DomRoot<Self> {
51 Self::new_with_proto(global, proto, message, can_gc)
52 }
53}