mirror of
https://github.com/servo/servo.git
synced 2025-08-20 12:55:33 +01:00
Measure Arc<Locked<T>> fields properly.
Currently when we measure various Arc<Locked<T>> fields we don't measure the T itself, but only the descendants of the T. This patch fixes this. This fix requires introducing a new trait, MallocUnconditionalShallowSizeOf, which is implemented for servo_arc::Arc. A similar trait, MallocConditionalShallowSizeOf, is also introduced, though it has no uses as yet.
This commit is contained in:
parent
7f4cb1861b
commit
779fbda81d
8 changed files with 61 additions and 22 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
use cssparser::SourceLocation;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use properties::PropertyDeclarationBlock;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
|
@ -37,7 +37,7 @@ impl PageRule {
|
|||
#[cfg(feature = "gecko")]
|
||||
pub fn size_of(&self, guard: &SharedRwLockReadGuard, ops: &mut MallocSizeOfOps) -> usize {
|
||||
// Measurement of other fields may be added later.
|
||||
self.block.read_with(guard).size_of(ops)
|
||||
self.block.unconditional_shallow_size_of(ops) + self.block.read_with(guard).size_of(ops)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue