Rename add_size_of_children() methods as add_size_of().

This makes them match `size_of` from `MallocSizeOf`.
This commit is contained in:
Nicholas Nethercote 2017-09-18 19:03:40 +10:00
parent 2d24d2dd04
commit e030c0d96a
4 changed files with 12 additions and 12 deletions

View file

@ -39,8 +39,8 @@
//! - If you need an additional synchronization argument, provide a function //! - If you need an additional synchronization argument, provide a function
//! that is like the standard trait method, but with the extra argument. //! that is like the standard trait method, but with the extra argument.
//! - If you need multiple measurements for a type, provide a function named //! - If you need multiple measurements for a type, provide a function named
//! `add_size_of_children` that takes a mutable reference to a struct that //! `add_size_of` that takes a mutable reference to a struct that contains
//! contains the multiple measurement fields. //! the multiple measurement fields.
//! - When deep measurement (via `MallocSizeOf`) cannot be implemented for a //! - When deep measurement (via `MallocSizeOf`) cannot be implemented for a
//! type, shallow measurement (via `MallocShallowSizeOf`) in combination with //! type, shallow measurement (via `MallocShallowSizeOf`) in combination with
//! iteration can be a useful substitute. //! iteration can be a useful substitute.

View file

@ -181,8 +181,8 @@ impl PerDocumentStyleDataImpl {
} }
/// Measure heap usage. /// Measure heap usage.
pub fn add_size_of_children(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) { pub fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) {
self.stylist.add_size_of_children(ops, sizes); self.stylist.add_size_of(ops, sizes);
} }
} }

View file

@ -174,7 +174,7 @@ struct UserAgentCascadeData {
impl UserAgentCascadeData { impl UserAgentCascadeData {
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) { fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) {
self.cascade_data.add_size_of_children(ops, sizes); self.cascade_data.add_size_of(ops, sizes);
sizes.mPrecomputedPseudos += self.precomputed_pseudo_element_decls.size_of(ops); sizes.mPrecomputedPseudos += self.precomputed_pseudo_element_decls.size_of(ops);
} }
} }
@ -329,9 +329,9 @@ impl DocumentCascadeData {
/// Measures heap usage. /// Measures heap usage.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub fn add_size_of_children(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) { pub fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) {
self.user.add_size_of_children(ops, sizes); self.user.add_size_of(ops, sizes);
self.author.add_size_of_children(ops, sizes); self.author.add_size_of(ops, sizes);
} }
} }
@ -1530,8 +1530,8 @@ impl Stylist {
/// Measures heap usage. /// Measures heap usage.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub fn add_size_of_children(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) { pub fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) {
self.cascade_data.add_size_of_children(ops, sizes); self.cascade_data.add_size_of(ops, sizes);
sizes.mRuleTree += self.rule_tree.size_of(ops); sizes.mRuleTree += self.rule_tree.size_of(ops);
// We may measure other fields in the future if DMD says it's worth it. // We may measure other fields in the future if DMD says it's worth it.
@ -2225,7 +2225,7 @@ impl CascadeData {
/// Measures heap usage. /// Measures heap usage.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub fn add_size_of_children(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) { pub fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) {
sizes.mElementAndPseudosMaps += self.element_map.size_of(ops); sizes.mElementAndPseudosMaps += self.element_map.size_of(ops);
for elem in self.pseudos_map.iter() { for elem in self.pseudos_map.iter() {

View file

@ -3781,7 +3781,7 @@ pub extern "C" fn Servo_StyleSet_AddSizeOfExcludingThis(
malloc_enclosing_size_of.unwrap(), malloc_enclosing_size_of.unwrap(),
None); None);
let sizes = unsafe { sizes.as_mut() }.unwrap(); let sizes = unsafe { sizes.as_mut() }.unwrap();
data.add_size_of_children(&mut ops, sizes); data.add_size_of(&mut ops, sizes);
} }
#[no_mangle] #[no_mangle]