From e03ef33f580c524c9074592cfdf683f013fd2c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 31 Dec 2016 04:15:17 +0100 Subject: [PATCH] style: Document the parallel traversal. --- components/style/parallel.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/style/parallel.rs b/components/style/parallel.rs index badd0b9f40a..a05b8185b73 100644 --- a/components/style/parallel.rs +++ b/components/style/parallel.rs @@ -20,6 +20,8 @@ //! easy to grep for. At the time of this writing, there is no other unsafe //! code in the parallel traversal. +#![deny(missing_docs)] + use dom::{OpaqueNode, SendNode, TElement, TNode}; use rayon; use scoped_tls::ScopedTLS; @@ -28,8 +30,12 @@ use std::sync::atomic::Ordering; use traversal::{DomTraversal, PerLevelTraversalData, PreTraverseToken}; use traversal::{STYLE_SHARING_CACHE_HITS, STYLE_SHARING_CACHE_MISSES}; +/// The chunk size used to split the parallel traversal nodes. +/// +/// We send each `CHUNK_SIZE` nodes as a different work unit to the work queue. pub const CHUNK_SIZE: usize = 64; +/// A parallel top down traversal, generic over `D`. #[allow(unsafe_code)] pub fn traverse_dom(traversal: &D, root: N::ConcreteElement, @@ -37,7 +43,7 @@ pub fn traverse_dom(traversal: &D, token: PreTraverseToken, queue: &rayon::ThreadPool) where N: TNode, - D: DomTraversal + D: DomTraversal, { if opts::get().style_sharing_stats { STYLE_SHARING_CACHE_HITS.store(0, Ordering::SeqCst); @@ -181,7 +187,7 @@ fn bottom_up_dom(traversal: &D, root: OpaqueNode, mut node: N) where N: TNode, - D: DomTraversal + D: DomTraversal, { loop { // Perform the appropriate operation.