diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-07-09 11:15:53 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-07-12 14:14:15 +0200 |
commit | 17888045bd0d55262815bab9b136338a785267bd (patch) | |
tree | c296d097ffa3bd6910cf7d7ed3e27e2478fbd235 /components | |
parent | 9e02ef93478c41a3fc6971611b358da6f73625d6 (diff) | |
download | servo-17888045bd0d55262815bab9b136338a785267bd.tar.gz servo-17888045bd0d55262815bab9b136338a785267bd.zip |
Pass the WorkQueue to LayoutTask::solve_constraints_parallel.
This removes the possibility of a panic by checking a constraint at compile
time rather than at run time.
Diffstat (limited to 'components')
-rw-r--r-- | components/layout/layout_task.rs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index bafdd1088b6..3a51d858c77 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -757,23 +757,18 @@ impl LayoutTask { /// benchmarked against those two. It is marked `#[inline(never)]` to aid profiling. #[inline(never)] fn solve_constraints_parallel(&self, - rw_data: &mut LayoutTaskData, + traversal: &mut WorkQueue<SharedLayoutContext, WorkQueueData>, layout_root: &mut FlowRef, shared_layout_context: &SharedLayoutContext) { let _scope = layout_debug_scope!("solve_constraints_parallel"); - match rw_data.parallel_traversal { - None => panic!("solve_contraints_parallel() called with no parallel traversal ready"), - Some(ref mut traversal) => { - // NOTE: this currently computes borders, so any pruning should separate that - // operation out. - parallel::traverse_flow_tree_preorder(layout_root, - self.profiler_metadata(), - self.time_profiler_chan.clone(), - shared_layout_context, - traversal); - } - } + // NOTE: this currently computes borders, so any pruning should separate that + // operation out. + parallel::traverse_flow_tree_preorder(layout_root, + self.profiler_metadata(), + self.time_profiler_chan.clone(), + shared_layout_context, + traversal); } /// Verifies that every node was either marked as a leaf or as a nonleaf in the flow tree. @@ -1152,9 +1147,9 @@ impl LayoutTask { // Sequential mode. self.solve_constraints(&mut root_flow, &layout_context) } - Some(_) => { + Some(ref mut parallel) => { // Parallel mode. - self.solve_constraints_parallel(rw_data, + self.solve_constraints_parallel(parallel, &mut root_flow, &mut *layout_context); } |