mirror of
https://github.com/servo/servo.git
synced 2025-07-31 19:20:22 +01:00
Ensure GPUDevice cleanup in GlobalScope
This commit is contained in:
parent
37d606621d
commit
785497af63
4 changed files with 52 additions and 3 deletions
|
@ -2954,6 +2954,10 @@ impl GlobalScope {
|
|||
.insert(device.id(), Dom::from_ref(device));
|
||||
}
|
||||
|
||||
pub fn remove_gpu_device(&self, device: WebGPUDevice) {
|
||||
let _ = self.gpu_devices.borrow_mut().remove(&device);
|
||||
}
|
||||
|
||||
pub fn handle_wgpu_msg(&self, device: WebGPUDevice, scope: u64, result: WebGPUOpResult) {
|
||||
let result = match result {
|
||||
WebGPUOpResult::Success => Ok(()),
|
||||
|
|
|
@ -2069,6 +2069,13 @@ impl ScriptThread {
|
|||
let global = self.documents.borrow().find_global(pipeline_id).unwrap();
|
||||
global.handle_wgpu_msg(device, scope_id, result);
|
||||
},
|
||||
WebGPUMsg::CleanDevice {
|
||||
pipeline_id,
|
||||
device,
|
||||
} => {
|
||||
let global = self.documents.borrow().find_global(pipeline_id).unwrap();
|
||||
global.remove_gpu_device(device);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue