aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/gpuadapter.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/gpuadapter.rs')
-rw-r--r--components/script/dom/gpuadapter.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/components/script/dom/gpuadapter.rs b/components/script/dom/gpuadapter.rs
index 9392f1414fa..ca4eaacd2ae 100644
--- a/components/script/dom/gpuadapter.rs
+++ b/components/script/dom/gpuadapter.rs
@@ -20,7 +20,7 @@ use dom_struct::dom_struct;
use js::jsapi::{Heap, JSObject};
use std::ptr::NonNull;
use std::rc::Rc;
-use webgpu::{wgt, WebGPU, WebGPUAdapter, WebGPURequest, WebGPUResponse};
+use webgpu::{wgt, WebGPU, WebGPUAdapter, WebGPURequest, WebGPUResponse, WebGPUResponseResult};
#[dom_struct]
pub struct GPUAdapter {
@@ -114,14 +114,14 @@ impl GPUAdapterMethods for GPUAdapter {
}
impl AsyncWGPUListener for GPUAdapter {
- fn handle_response(&self, response: WebGPUResponse, promise: &Rc<Promise>) {
+ fn handle_response(&self, response: WebGPUResponseResult, promise: &Rc<Promise>) {
match response {
- WebGPUResponse::RequestDevice {
+ Ok(WebGPUResponse::RequestDevice {
device_id,
queue_id,
_descriptor,
label,
- } => {
+ }) => {
let device = GPUDevice::new(
&self.global(),
self.channel.clone(),
@@ -135,7 +135,14 @@ impl AsyncWGPUListener for GPUAdapter {
self.global().add_gpu_device(&device);
promise.resolve_native(&device);
},
- _ => promise.reject_error(Error::Operation),
+ Err(e) => {
+ warn!("Could not get GPUDevice({:?})", e);
+ promise.reject_error(Error::Operation);
+ },
+ _ => {
+ warn!("GPUAdapter received wrong WebGPUResponse");
+ promise.reject_error(Error::Operation);
+ },
}
}
}