mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Bug 1336646 - Move opts check for statistics into should_dump. r=emilio
This makes things more consistent between the parallel and sequential traversal drivers.
This commit is contained in:
parent
e7a8f5ec30
commit
37b8d5231d
2 changed files with 3 additions and 3 deletions
|
@ -15,6 +15,7 @@ use euclid::Size2D;
|
||||||
use matching::StyleSharingCandidateCache;
|
use matching::StyleSharingCandidateCache;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use properties::ComputedValues;
|
use properties::ComputedValues;
|
||||||
|
use servo_config::opts;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -160,7 +161,7 @@ lazy_static! {
|
||||||
impl TraversalStatistics {
|
impl TraversalStatistics {
|
||||||
/// Returns whether statistics dumping is enabled.
|
/// Returns whether statistics dumping is enabled.
|
||||||
pub fn should_dump() -> bool {
|
pub fn should_dump() -> bool {
|
||||||
*DUMP_STYLE_STATISTICS
|
*DUMP_STYLE_STATISTICS || opts::get().style_sharing_stats
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ use context::TraversalStatistics;
|
||||||
use dom::{OpaqueNode, SendNode, TElement, TNode};
|
use dom::{OpaqueNode, SendNode, TElement, TNode};
|
||||||
use rayon;
|
use rayon;
|
||||||
use scoped_tls::ScopedTLS;
|
use scoped_tls::ScopedTLS;
|
||||||
use servo_config::opts;
|
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use traversal::{DomTraversal, PerLevelTraversalData, PreTraverseToken};
|
use traversal::{DomTraversal, PerLevelTraversalData, PreTraverseToken};
|
||||||
|
|
||||||
|
@ -75,7 +74,7 @@ pub fn traverse_dom<E, D>(traversal: &D,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dump statistics to stdout if requested.
|
// Dump statistics to stdout if requested.
|
||||||
if TraversalStatistics::should_dump() || opts::get().style_sharing_stats {
|
if TraversalStatistics::should_dump() {
|
||||||
let slots = unsafe { tls.unsafe_get() };
|
let slots = unsafe { tls.unsafe_get() };
|
||||||
let aggregate = slots.iter().fold(TraversalStatistics::default(), |acc, t| {
|
let aggregate = slots.iter().fold(TraversalStatistics::default(), |acc, t| {
|
||||||
match *t.borrow() {
|
match *t.borrow() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue