WebGPU: improve lifecyle management of resources #32148
Labels
A-content/webgpu
The WebGPU implementation.
B-feature-tracking
This issue tracks a particular high-level feature
Proposed follow-up for #31995
I think there are two problems:
Drop
of dom structs, see Drop impls for DOM types should be forbidden #26488Instead I propose we centralize resource management, and loosely integrate with the DOM lifecyle.
We should centralize all logic around the
gpu_id_hub
, which is shared per globalservo/components/script/dom/globalscope.rs
Line 3087 in 81c4f2a
and then used by dom struct to get new id, for example
servo/components/script/dom/gpudevice.rs
Line 633 in 81c4f2a
So the individual dom struct should not manage their own IDs, the global should keep some kind of map of id to weak ref of dom object(see weakref.rs).
Then, we can integrate the
gpu_id_hub
intoperform_a_dom_garbage_collection_checkpoint
, where we loop over all Ids, collect those that need to be freed, and then:The text was updated successfully, but these errors were encountered: