style: Make WorkQueue creation fallible.

Fixes bug 1290205 in bugzilla.
This commit is contained in:
Emilio Cobos Álvarez 2016-08-25 11:37:55 -07:00
parent 8a5e1b70b7
commit 4194ba063a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 43 additions and 15 deletions

View file

@ -103,11 +103,11 @@ fn restyle_subtree(node: GeckoNode, raw_data: *mut RawServoStyleSet) {
// We ensure this is true before calling Servo_RestyleSubtree()
debug_assert!(node.is_dirty() || node.has_dirty_descendants());
if per_doc_data.num_threads == 1 {
if per_doc_data.num_threads == 1 || per_doc_data.work_queue.is_none() {
sequential::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context);
} else {
parallel::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context,
&mut per_doc_data.work_queue);
per_doc_data.work_queue.as_mut().unwrap());
}
}