mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Pass shared_layout_context to run_queue_with_custom_work_data_type.
This commit is contained in:
parent
342ea7a44b
commit
c214c03375
1 changed files with 14 additions and 21 deletions
|
@ -446,28 +446,29 @@ fn build_display_list(unsafe_flow: UnsafeFlow,
|
||||||
|
|
||||||
fn run_queue_with_custom_work_data_type<To,F>(
|
fn run_queue_with_custom_work_data_type<To,F>(
|
||||||
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>,
|
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>,
|
||||||
callback: F)
|
callback: F,
|
||||||
|
shared_layout_context: &SharedLayoutContext)
|
||||||
where To: 'static + Send, F: FnOnce(&mut WorkQueue<SharedLayoutContextWrapper,To>) {
|
where To: 'static + Send, F: FnOnce(&mut WorkQueue<SharedLayoutContextWrapper,To>) {
|
||||||
unsafe {
|
queue.data = SharedLayoutContextWrapper(shared_layout_context as *const _);
|
||||||
let queue: &mut WorkQueue<SharedLayoutContextWrapper,To> = mem::transmute(queue);
|
|
||||||
callback(queue);
|
let queue: &mut WorkQueue<SharedLayoutContextWrapper,To> = unsafe {
|
||||||
queue.run();
|
mem::transmute(queue)
|
||||||
}
|
};
|
||||||
|
callback(queue);
|
||||||
|
queue.run();
|
||||||
|
|
||||||
|
queue.data = SharedLayoutContextWrapper(ptr::null());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn traverse_dom_preorder(root: LayoutNode,
|
pub fn traverse_dom_preorder(root: LayoutNode,
|
||||||
shared_layout_context: &SharedLayoutContext,
|
shared_layout_context: &SharedLayoutContext,
|
||||||
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>) {
|
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>) {
|
||||||
queue.data = SharedLayoutContextWrapper(shared_layout_context as *const _);
|
|
||||||
|
|
||||||
run_queue_with_custom_work_data_type(queue, |queue| {
|
run_queue_with_custom_work_data_type(queue, |queue| {
|
||||||
queue.push(WorkUnit {
|
queue.push(WorkUnit {
|
||||||
fun: recalc_style,
|
fun: recalc_style,
|
||||||
data: (box vec![layout_node_to_unsafe_layout_node(&root)], 0),
|
data: (box vec![layout_node_to_unsafe_layout_node(&root)], 0),
|
||||||
});
|
});
|
||||||
});
|
}, shared_layout_context);
|
||||||
|
|
||||||
queue.data = SharedLayoutContextWrapper(ptr::null());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn traverse_flow_tree_preorder(
|
pub fn traverse_flow_tree_preorder(
|
||||||
|
@ -482,8 +483,6 @@ pub fn traverse_flow_tree_preorder(
|
||||||
root.traverse_postorder(&bubble_inline_sizes);
|
root.traverse_postorder(&bubble_inline_sizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
queue.data = SharedLayoutContextWrapper(shared_layout_context as *const _);
|
|
||||||
|
|
||||||
run_queue_with_custom_work_data_type(queue, |queue| {
|
run_queue_with_custom_work_data_type(queue, |queue| {
|
||||||
profile(time::ProfilerCategory::LayoutParallelWarmup, profiler_metadata,
|
profile(time::ProfilerCategory::LayoutParallelWarmup, profiler_metadata,
|
||||||
time_profiler_chan, || {
|
time_profiler_chan, || {
|
||||||
|
@ -492,9 +491,7 @@ pub fn traverse_flow_tree_preorder(
|
||||||
data: (box vec![mut_owned_flow_to_unsafe_flow(root)], 0),
|
data: (box vec![mut_owned_flow_to_unsafe_flow(root)], 0),
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
}, shared_layout_context);
|
||||||
|
|
||||||
queue.data = SharedLayoutContextWrapper(ptr::null())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_display_list_for_subtree(
|
pub fn build_display_list_for_subtree(
|
||||||
|
@ -503,8 +500,6 @@ pub fn build_display_list_for_subtree(
|
||||||
time_profiler_chan: time::ProfilerChan,
|
time_profiler_chan: time::ProfilerChan,
|
||||||
shared_layout_context: &SharedLayoutContext,
|
shared_layout_context: &SharedLayoutContext,
|
||||||
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>) {
|
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>) {
|
||||||
queue.data = SharedLayoutContextWrapper(shared_layout_context as *const _);
|
|
||||||
|
|
||||||
run_queue_with_custom_work_data_type(queue, |queue| {
|
run_queue_with_custom_work_data_type(queue, |queue| {
|
||||||
profile(time::ProfilerCategory::LayoutParallelWarmup, profiler_metadata,
|
profile(time::ProfilerCategory::LayoutParallelWarmup, profiler_metadata,
|
||||||
time_profiler_chan, || {
|
time_profiler_chan, || {
|
||||||
|
@ -513,7 +508,5 @@ pub fn build_display_list_for_subtree(
|
||||||
data: (box vec![mut_owned_flow_to_unsafe_flow(root)], 0),
|
data: (box vec![mut_owned_flow_to_unsafe_flow(root)], 0),
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
}, shared_layout_context);
|
||||||
|
|
||||||
queue.data = SharedLayoutContextWrapper(ptr::null())
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue