Skip to content

Commit

Permalink
Make the rule tree actually threadsafe
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nox committed Apr 20, 2020
1 parent 1c2de56 commit 7f54d14
Show file tree
Hide file tree
Showing 4 changed files with 315 additions and 319 deletions.
4 changes: 1 addition & 3 deletions components/layout_thread/lib.rs
Expand Up @@ -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() {
Expand Down
4 changes: 1 addition & 3 deletions components/layout_thread_2020/lib.rs
Expand Up @@ -1184,9 +1184,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(root) = &*self.fragment_tree_root.borrow() {
Expand Down

0 comments on commit 7f54d14

Please sign in to comment.