mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Simplify the rule tree GC code a bit.
This commit is contained in:
parent
e448c4a27e
commit
cf6b3a0fcb
1 changed files with 8 additions and 13 deletions
|
@ -855,20 +855,15 @@ impl StrongRuleNode {
|
|||
debug_assert!(me.is_root(), "Can't call GC on a non-root node!");
|
||||
|
||||
while let Some(weak) = self.pop_from_free_list() {
|
||||
let needs_drop = {
|
||||
let node = &*weak.ptr();
|
||||
if node.refcount.load(Ordering::Relaxed) == 0 {
|
||||
node.remove_from_child_list();
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
};
|
||||
|
||||
debug!("GC'ing {:?}: {}", weak.ptr(), needs_drop);
|
||||
if needs_drop {
|
||||
let _ = Box::from_raw(weak.ptr());
|
||||
let node = &*weak.ptr();
|
||||
if node.refcount.load(Ordering::Relaxed) != 0 {
|
||||
// Nothing to do, the node is still alive.
|
||||
continue;
|
||||
}
|
||||
|
||||
debug!("GC'ing {:?}", weak.ptr());
|
||||
node.remove_from_child_list();
|
||||
let _ = Box::from_raw(weak.ptr());
|
||||
}
|
||||
|
||||
me.free_count.store(0, Ordering::Relaxed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue