mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +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::{Parser, Token, SourceLocation, BasicParseError};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::MallocSizeOfOps;
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use media_queries::Device;
|
||||
use parser::{Parse, ParserContext};
|
||||
use servo_arc::Arc;
|
||||
|
@ -34,7 +34,8 @@ impl DocumentRule {
|
|||
#[cfg(feature = "gecko")]
|
||||
pub fn size_of(&self, guard: &SharedRwLockReadGuard, ops: &mut MallocSizeOfOps) -> usize {
|
||||
// Measurement of other fields may be added later.
|
||||
self.rules.read_with(guard).size_of(guard, ops)
|
||||
self.rules.unconditional_shallow_size_of(ops) +
|
||||
self.rules.read_with(guard).size_of(guard, ops)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue