mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
task -> thread
This commit is contained in:
parent
f00532bab0
commit
1f02c4ebbb
119 changed files with 1209 additions and 1207 deletions
|
@ -21,7 +21,7 @@ pub type Generation = u32;
|
|||
/// matches. Thanks to the bloom filter, we can avoid walking up the tree
|
||||
/// looking for ancestors that aren't there in the majority of cases.
|
||||
///
|
||||
/// As we walk down the DOM tree a task-local bloom filter is built of all the
|
||||
/// As we walk down the DOM tree a thread-local bloom filter is built of all the
|
||||
/// CSS `SimpleSelector`s which are part of a `Descendant` compound selector
|
||||
/// (i.e. paired with a `Descendant` combinator, in the `next` field of a
|
||||
/// `CompoundSelector`.
|
||||
|
@ -35,15 +35,15 @@ pub type Generation = u32;
|
|||
///
|
||||
/// Since a work-stealing queue is used for styling, sometimes, the bloom filter
|
||||
/// will no longer be the for the parent of the node we're currently on. When
|
||||
/// this happens, the task local bloom filter will be thrown away and rebuilt.
|
||||
/// this happens, the thread local bloom filter will be thrown away and rebuilt.
|
||||
thread_local!(
|
||||
pub static STYLE_BLOOM: RefCell<Option<(Box<BloomFilter>, UnsafeNode, Generation)>> = RefCell::new(None));
|
||||
|
||||
/// Returns the task local bloom filter.
|
||||
/// Returns the thread local bloom filter.
|
||||
///
|
||||
/// If one does not exist, a new one will be made for you. If it is out of date,
|
||||
/// it will be cleared and reused.
|
||||
fn take_task_local_bloom_filter<'ln, N>(parent_node: Option<N>,
|
||||
fn take_thread_local_bloom_filter<'ln, N>(parent_node: Option<N>,
|
||||
root: OpaqueNode,
|
||||
context: &SharedStyleContext)
|
||||
-> Box<BloomFilter>
|
||||
|
@ -79,12 +79,12 @@ fn take_task_local_bloom_filter<'ln, N>(parent_node: Option<N>,
|
|||
})
|
||||
}
|
||||
|
||||
pub fn put_task_local_bloom_filter(bf: Box<BloomFilter>,
|
||||
pub fn put_thread_local_bloom_filter(bf: Box<BloomFilter>,
|
||||
unsafe_node: &UnsafeNode,
|
||||
context: &SharedStyleContext) {
|
||||
STYLE_BLOOM.with(move |style_bloom| {
|
||||
assert!(style_bloom.borrow().is_none(),
|
||||
"Putting into a never-taken task-local bloom filter");
|
||||
"Putting into a never-taken thread-local bloom filter");
|
||||
*style_bloom.borrow_mut() = Some((bf, *unsafe_node, context.generation));
|
||||
})
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ pub fn recalc_style_at<'a, 'ln, N: TNode<'ln>, C: StyleContext<'a>> (context: &'
|
|||
let parent_opt = node.layout_parent_node(root);
|
||||
|
||||
// Get the style bloom filter.
|
||||
let mut bf = take_task_local_bloom_filter(parent_opt, root, context.shared_context());
|
||||
let mut bf = take_thread_local_bloom_filter(parent_opt, root, context.shared_context());
|
||||
|
||||
let nonincremental_layout = opts::get().nonincremental_layout;
|
||||
if nonincremental_layout || node.is_dirty() {
|
||||
|
@ -254,6 +254,6 @@ pub fn recalc_style_at<'a, 'ln, N: TNode<'ln>, C: StyleContext<'a>> (context: &'
|
|||
node.insert_into_bloom_filter(&mut *bf);
|
||||
|
||||
// NB: flow construction updates the bloom filter on the way up.
|
||||
put_task_local_bloom_filter(bf, &unsafe_layout_node, context.shared_context());
|
||||
put_thread_local_bloom_filter(bf, &unsafe_layout_node, context.shared_context());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue