Add sizeof for AuthorStyles.

This commit is contained in:
Xidorn Quan 2018-02-19 15:12:13 +11:00
parent d423e54d58
commit f518e55c28
6 changed files with 97 additions and 88 deletions

View file

@ -1835,8 +1835,7 @@ impl<'a> SelectorVisitor for StylistSelectorVisitor<'a> {
}
/// A set of rules for element and pseudo-elements.
#[derive(Debug, Default)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Debug, Default, MallocSizeOf)]
struct ElementAndPseudoRules {
/// Rules from stylesheets at this `CascadeData`'s origin.
element_map: SelectorMap<Rule>,
@ -1904,8 +1903,7 @@ impl ElementAndPseudoRules {
///
/// FIXME(emilio): Consider renaming and splitting in `CascadeData` and
/// `InvalidationData`? That'd make `clear_cascade_data()` clearer.
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Debug)]
#[derive(Debug, MallocSizeOf)]
pub struct CascadeData {
/// The data coming from normal style rules that apply to elements at this
/// cascade level.
@ -1927,7 +1925,7 @@ pub struct CascadeData {
/// to avoid taking element snapshots when an irrelevant attribute changes.
/// (We don't bother storing the namespace, since namespaced attributes
/// are rare.)
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "just an array")]
#[ignore_malloc_size_of = "just an array"]
attribute_dependencies: NonCountingBloomFilter,
/// Whether `"style"` appears in an attribute selector. This is not common,
@ -1952,13 +1950,13 @@ pub struct CascadeData {
/// hence in our selector maps). Used to determine when sharing styles is
/// safe: we disallow style sharing for elements whose id matches this
/// filter, and hence might be in one of our selector maps.
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "just an array")]
#[ignore_malloc_size_of = "just an array"]
mapped_ids: NonCountingBloomFilter,
/// Selectors that require explicit cache revalidation (i.e. which depend
/// on state that is not otherwise visible to the cache, like attributes or
/// tree-structural state like child index and pseudos).
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
#[ignore_malloc_size_of = "Arc"]
selectors_for_cache_revalidation: SelectorMap<RevalidationSelectorAndHashes>,
/// A map with all the animations at this `CascadeData`'s origin, indexed