Make the rule tree actually threadsafe

RuleTree::gc is now a safe method that any thread can call
at any time, and StrongRuleNode values can all be dropped
whenever their owner want to, on any thread.
This commit is contained in:
Anthony Ramine 2020-04-20 11:54:37 +02:00
parent 1c2de5641c
commit 7f54d14904
4 changed files with 316 additions and 320 deletions

View file

@ -1543,9 +1543,7 @@ impl LayoutThread {
}
// GC the rule tree if some heuristics are met.
unsafe {
layout_context.style_context.stylist.rule_tree().maybe_gc();
}
layout_context.style_context.stylist.rule_tree().maybe_gc();
// Perform post-style recalculation layout passes.
if let Some(mut root_flow) = self.root_flow.borrow().clone() {