mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1631154 - Remove WeakRuleNode::clone. r=emilio
MallocSizeOf for RuleTree should not keep around weak references in case someone runs a GC meanwhile.
This commit is contained in:
parent
f71e5d7ef4
commit
a8dec99fc8
@ -71,14 +71,14 @@ impl MallocSizeOf for RuleTree {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
let mut n = 0;
|
||||
let mut stack = SmallVec::<[_; 32]>::new();
|
||||
stack.push(self.root.downgrade());
|
||||
stack.push(self.root.clone());
|
||||
|
||||
while let Some(node) = stack.pop() {
|
||||
n += unsafe { ops.malloc_size_of(node.ptr()) };
|
||||
let children = unsafe { (*node.ptr()).children.read() };
|
||||
children.shallow_size_of(ops);
|
||||
for c in &*children {
|
||||
stack.push(c.clone());
|
||||
stack.push(c.upgrade());
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,7 +335,6 @@ impl RuleNode {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct WeakRuleNode {
|
||||
p: ptr::NonNull<RuleNode>,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user