mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Move children_to_process to layout.
We don't need this for Gecko, and it's hard to implement in that case because there's nowhere obvious to put it (we don't plan to create TSDs for non-dirty nodes, and non-dirty nodes can have dirty children which require the children_to_process atomic). There are various solutions here, but punting is the easiest. We'll need to rethink this if/when we need to do a bottom-up traversal for Gecko.
This commit is contained in:
parent
b1d8eff467
commit
c72fffa8f8
8 changed files with 74 additions and 44 deletions
|
@ -54,6 +54,7 @@ use std::fmt;
|
|||
use std::marker::PhantomData;
|
||||
use std::mem::transmute;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
use string_cache::{Atom, Namespace};
|
||||
use style::atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use style::attr::AttrValue;
|
||||
|
@ -221,6 +222,18 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
|
|||
self.node.set_flag(CAN_BE_FRAGMENTED, value)
|
||||
}
|
||||
|
||||
fn store_children_to_process(&self, n: isize) {
|
||||
let data = self.get_partial_layout_data().unwrap().borrow();
|
||||
data.parallel.children_to_process.store(n, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
fn did_process_child(&self) -> isize {
|
||||
let data = self.get_partial_layout_data().unwrap().borrow();
|
||||
let old_value = data.parallel.children_to_process.fetch_sub(1, Ordering::Relaxed);
|
||||
debug_assert!(old_value >= 1);
|
||||
old_value - 1
|
||||
}
|
||||
|
||||
fn borrow_data(&self) -> Option<AtomicRef<PersistentStyleData>> {
|
||||
self.get_style_data().map(|d| d.borrow())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue