Measure PropertyDeclaration more thoroughly.

This patch replaces the handwritten MallocSizeOf implementation for
PropertyDeclaration with a derived one, which gives much more thorough
measurement.

This requires (a) deriving MallocSizeOf for a *lot* of additional types (most
of which already have `derive(HeapSizeOf)` in Servo builds), and (b)
implementing MallocSizeOf for a few more types in the `malloc_size_of` crate.

These changes would significantly improve the reporting coverage for gmail if
it weren't for the fact that SpecifiedUrl isn't measured due to a lack of
clarity about its fields; that can be fixed as a follow-up once bug 1397971 has
landed.
This commit is contained in:
Nicholas Nethercote 2017-09-14 13:18:03 +10:00
parent 1aa8be392b
commit c5aa2cb986
66 changed files with 302 additions and 59 deletions

View file

@ -20,6 +20,8 @@ cssparser = "0.21.0"
euclid = "0.15"
heapsize = {version = "0.4", optional = true}
heapsize_derive = {version = "0.1", optional = true}
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
selectors = { path = "../selectors" }
serde = {version = "1.0", optional = true}
webrender_api = {git = "https://github.com/servo/webrender", optional = true}

View file

@ -17,6 +17,7 @@ macro_rules! define_cursor {
) => {
/// https://drafts.csswg.org/css-ui/#cursor
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize, HeapSizeOf))]
#[repr(u8)]
#[allow(missing_docs)]

View file

@ -19,6 +19,8 @@ extern crate app_units;
extern crate euclid;
#[cfg(feature = "servo")] extern crate heapsize;
#[cfg(feature = "servo")] #[macro_use] extern crate heapsize_derive;
#[cfg(feature = "gecko")] extern crate malloc_size_of;
#[cfg(feature = "gecko")] #[macro_use] extern crate malloc_size_of_derive;
extern crate selectors;
#[cfg(feature = "servo")] #[macro_use] extern crate serde;
#[cfg(feature = "servo")] extern crate webrender_api;

View file

@ -415,9 +415,12 @@ macro_rules! __define_css_keyword_enum__add_optional_traits {
#[cfg(not(feature = "servo"))]
#[macro_export]
macro_rules! __define_css_keyword_enum__add_optional_traits {
($name: ident [ $( $css: expr => $variant: ident ),+ ] [ $( $alias: expr => $alias_variant: ident),* ]) => {
($name: ident [ $( $css: expr => $variant: ident ),+ ]
[ $( $alias: expr => $alias_variant: ident),* ]) => {
__define_css_keyword_enum__actual! {
$name [] [ $( $css => $variant ),+ ] [ $( $alias => $alias_variant ),* ]
$name [ MallocSizeOf ]
[ $( $css => $variant ),+ ]
[ $( $alias => $alias_variant ),* ]
}
};
}
@ -472,6 +475,7 @@ pub mod specified {
/// Whether to allow negative lengths or not.
#[repr(u8)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd)]
pub enum AllowedNumericType {