Implementing `Drop` for DOM types is being forbidden. This moves the
resource cleanup logic for `GPUShaderModule`, `GPUTexture`, and
`GPUTextureView` to separate helper structs and removes the
`allowDropImpl` flag from the bindings configuration.
Testing: WebGpu tests just cover their cases
Fixes: Partially #26488
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
Implement MallocSizeOf for most of WebXr. Mostly uncontroversal changes.
Of note:
- Implementation of size_of for euclid::RigidTransform
- Implementation of size_of for euclid::Vector3D
- Join is currently ignored as the type is very complicated.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
*Describe the changes that this pull request makes here. This will be
the commit message.*
Testing: Compilation is the test.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Reviewable per commits:
As noted in
https://github.com/servo/servo/pull/42180#discussion_r2749861902
transmuting `&Reflector<AssociatedMemory>` to `&Reflector<()>` will
ignore AssociatedMemory information and thus it will not remove extra
associated memory. By returning `&Reflector<Self::ReflectorType>` from
`DomObject::reflector()` we will preserve this information and thus
correctly handle cases with associated memory. We also do not need
`overrideMemoryUsage` in bindings.conf anymore. 🎉
Instead of removing associated memory in drop code we should do it as
part of finalizers, otherwise we have problems in nested (inherited)
structs, where drop is run for both parent and child, but we only added
associated memory for child (on init_reflector) which already included
size of parent. The only exception here is promise, because it is RCed
and not finalized.
Testing: Tested locally that it fixes speedometer.
Fixes#42269
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
By reporting memory usage of rust objects back to SM it can trigger GC
sooner and release more memory (I hope that we could use this to avoid
OOB in webgpu in the future).
Currently we use simple `size_of::<DomStruct>() +
size_of::<Box<DomStruct>>()` but it's possible to override reported
memory with `update_memory_size(self, nbytes);` on reflector. This is
mostly useful for canvases and buffers which usually have large
associated data.
Testing: None, but I am wondering if we can connect this to
`about:memory`.
Fixes: #42168
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This changes routed_promise to use the GenericCallback functionality.
This mostly effected WebGPU but also Clipboard and Memory Reporting.
We also added a GenericCallback::new_blocking() functionality which
produces a callback and a channel
which then can be blocked on. This was used a couple of times in the
code.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Testing: This should not change functionality.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This breaks the `script_traits` dependency on `webgpu`. In general, the
`traits` crates shouldn't depend on Servo non-`traits` crates. This is
necessary to move "script to constellation" messages to the
`constellation_traits` crate, making it the entire API for talking to
the
constellation. This will break a circular dependency when that happens.
Testing: Successfully building is enough of a test for this one as
it is mainly moving types around.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Using the RoutedPromiseListener let us define a different
response type for each promise. This removes unreachable branches
that used to exist when they all shared the same WebGPUResponse.
Signed-off-by: webbeef <me@webbeef.org>