diff options
author | Kunal Mohan <kunalmohan99@gmail.com> | 2020-08-08 20:20:07 +0530 |
---|---|---|
committer | Kunal Mohan <kunalmohan99@gmail.com> | 2020-08-08 20:20:07 +0530 |
commit | 8ff00f0e9c5c7eb232401407c4e5d455423a68d8 (patch) | |
tree | 54ff03ff835439c777f1e19be2af0c9ca0e87880 /components/script/dom/gpucommandbuffer.rs | |
parent | 33a4bca74d1075b4bbb1a161b757427e34f94ad2 (diff) | |
download | servo-8ff00f0e9c5c7eb232401407c4e5d455423a68d8.tar.gz servo-8ff00f0e9c5c7eb232401407c4e5d455423a68d8.zip |
Remove entries from error_command_buffers on drop
Diffstat (limited to 'components/script/dom/gpucommandbuffer.rs')
-rw-r--r-- | components/script/dom/gpucommandbuffer.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/components/script/dom/gpucommandbuffer.rs b/components/script/dom/gpucommandbuffer.rs index 6e1eb8446f0..eb6ede84c26 100644 --- a/components/script/dom/gpucommandbuffer.rs +++ b/components/script/dom/gpucommandbuffer.rs @@ -13,7 +13,7 @@ use crate::dom::gpubuffer::GPUBuffer; use dom_struct::dom_struct; use std::collections::HashSet; use std::hash::{Hash, Hasher}; -use webgpu::{WebGPU, WebGPUCommandBuffer}; +use webgpu::{WebGPU, WebGPUCommandBuffer, WebGPURequest}; impl Eq for DomRoot<GPUBuffer> {} impl Hash for DomRoot<GPUBuffer> { @@ -67,6 +67,20 @@ impl GPUCommandBuffer { } } +impl Drop for GPUCommandBuffer { + fn drop(&mut self) { + if let Err(e) = self.channel.0.send(( + None, + WebGPURequest::FreeCommandBuffer(self.command_buffer.0), + )) { + warn!( + "Failed to send FreeCommandBuffer({:?}) ({})", + self.command_buffer.0, e + ); + } + } +} + impl GPUCommandBuffer { pub fn id(&self) -> WebGPUCommandBuffer { self.command_buffer |