mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
parent
1aa8be392b
commit
c5aa2cb986
66 changed files with 302 additions and 59 deletions
|
@ -71,6 +71,7 @@ impl SymbolsType {
|
|||
///
|
||||
/// Since wherever <counter-style> is used, 'none' is a valid value as
|
||||
/// well, we combine them into one type to make code simpler.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum CounterStyleOrNone {
|
||||
/// `none`
|
||||
|
@ -129,6 +130,7 @@ impl Parse for CounterStyleOrNone {
|
|||
///
|
||||
/// For font-feature-settings, this is a tag and an integer,
|
||||
/// for font-variation-settings this is a tag and a float
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
|
||||
pub struct FontSettingTag<T> {
|
||||
|
@ -186,6 +188,7 @@ impl<T: Parse> Parse for FontSettingTag<T> {
|
|||
|
||||
|
||||
/// A font settings value for font-variation-settings or font-feature-settings
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum FontSettings<T> {
|
||||
|
@ -210,6 +213,7 @@ impl<T: Parse> Parse for FontSettings<T> {
|
|||
///
|
||||
/// Do not use this type anywhere except within FontSettings
|
||||
/// because it serializes with the preceding space
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)]
|
||||
pub struct FontSettingTagInt(pub u32);
|
||||
|
@ -218,7 +222,7 @@ pub struct FontSettingTagInt(pub u32);
|
|||
///
|
||||
/// Do not use this type anywhere except within FontSettings
|
||||
/// because it serializes with the preceding space
|
||||
#[cfg_attr(feature = "gecko", derive(Animate, ComputeSquaredDistance))]
|
||||
#[cfg_attr(feature = "gecko", derive(Animate, ComputeSquaredDistance, MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||
pub struct FontSettingTagFloat(pub f32);
|
||||
|
@ -273,12 +277,14 @@ impl ToCss for FontSettingTagFloat {
|
|||
}
|
||||
|
||||
/// A wrapper of Non-negative values.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||
pub struct NonNegative<T>(pub T);
|
||||
|
||||
/// A wrapper of greater-than-or-equal-to-one values.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue