mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
script: Measure heap usage of various ignored fields (#38791)
These changes allow using MallocSizeOf/`#[conditional_malloc_size_of]` on WebIDL callback values, and then fix a grab bag of places in the script crate that previously ignored those values. There are also some commits removing ignored fields that involved Arc/Rc that are not WebIDL callbacks, since they are now easier to support with the `#[conditional_malloc_size_of]` attribute. Testing: Manual testing on about:memory for servo.org. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
604b6ea26d
commit
636e7211e0
16 changed files with 44 additions and 38 deletions
|
@ -55,11 +55,13 @@ pub enum ExceptionHandling {
|
|||
|
||||
/// A common base class for representing IDL callback function and
|
||||
/// callback interface types.
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
|
||||
pub struct CallbackObject<D: DomTypes> {
|
||||
/// The underlying `JSObject`.
|
||||
#[ignore_malloc_size_of = "measured by mozjs"]
|
||||
callback: Heap<*mut JSObject>,
|
||||
#[ignore_malloc_size_of = "measured by mozjs"]
|
||||
permanent_js_root: Heap<JSVal>,
|
||||
|
||||
/// The ["callback context"], that is, the global to use as incumbent
|
||||
|
@ -147,7 +149,7 @@ pub trait CallbackContainer<D: DomTypes> {
|
|||
}
|
||||
|
||||
/// A common base class for representing IDL callback function types.
|
||||
#[derive(JSTraceable, PartialEq)]
|
||||
#[derive(JSTraceable, MallocSizeOf, PartialEq)]
|
||||
#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
|
||||
pub struct CallbackFunction<D: DomTypes> {
|
||||
object: CallbackObject<D>,
|
||||
|
@ -180,7 +182,7 @@ impl<D: DomTypes> CallbackFunction<D> {
|
|||
}
|
||||
|
||||
/// A common base class for representing IDL callback interface types.
|
||||
#[derive(JSTraceable, PartialEq)]
|
||||
#[derive(JSTraceable, MallocSizeOf, PartialEq)]
|
||||
#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
|
||||
pub struct CallbackInterface<D: DomTypes> {
|
||||
object: CallbackObject<D>,
|
||||
|
|
|
@ -8057,7 +8057,7 @@ class CGCallback(CGClass):
|
|||
constructors=self.getConstructors(),
|
||||
methods=realMethods,
|
||||
templateSpecialization=['D: DomTypes'],
|
||||
decorators="#[derive(JSTraceable, PartialEq)]\n"
|
||||
decorators="#[derive(JSTraceable, MallocSizeOf, PartialEq)]\n"
|
||||
"#[cfg_attr(crown, allow(crown::unrooted_must_root))]\n"
|
||||
"#[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue