Skip to content

Commit

Permalink
Adding cmdling argument for disabling style share cache, fix #5581
Browse files Browse the repository at this point in the history
  • Loading branch information
pgonda committed Apr 10, 2015
1 parent c1b7c0c commit 881112d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/layout/css/matching.rs
Expand Up @@ -32,6 +32,7 @@ use style::properties::{ComputedValues, cascade};
use style::selector_matching::{Stylist, DeclarationBlock};
use util::arc_ptr_eq;
use util::cache::{LRUCache, SimpleHashCache};
use util::opts;
use util::smallvec::{SmallVec, SmallVec16};

pub struct ApplicableDeclarations {
Expand Down Expand Up @@ -564,6 +565,9 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
&mut StyleSharingCandidateCache,
parent: Option<LayoutNode>)
-> StyleSharingResult {
if opts::get().disable_share_style_cache {
return StyleSharingResult::CannotShare(false)
}
if !self.is_element() {
return StyleSharingResult::CannotShare(false)
}
Expand Down
7 changes: 7 additions & 0 deletions components/util/opts.rs
Expand Up @@ -135,6 +135,9 @@ pub struct Opts {

/// Whether MIME sniffing should be used
pub sniff_mime_types: bool,

/// Whether Style Sharing Cache is used
pub disable_share_style_cache: bool,
}

fn print_usage(app: &str, opts: &[getopts::OptGroup]) {
Expand Down Expand Up @@ -162,6 +165,8 @@ pub fn print_debug_usage(app: &str) {
print_option("trace-layout", "Write layout trace to an external file for debugging.");
print_option("validate-display-list-geometry",
"Display an error when display list geometry escapes overflow region.");
print_option("disable-share-style-cache",
"Disable the style sharing cache.");

println!("");
}
Expand Down Expand Up @@ -216,6 +221,7 @@ pub fn default_opts() -> Opts {
profile_tasks: false,
resources_path: None,
sniff_mime_types: false,
disable_share_style_cache: false,
}
}

Expand Down Expand Up @@ -377,6 +383,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
validate_display_list_geometry: debug_options.contains(&"validate-display-list-geometry"),
resources_path: opt_match.opt_str("resources-path"),
sniff_mime_types: opt_match.opt_present("sniff-mime-types"),
disable_share_style_cache: debug_options.contains(&"disable-share-style-cache"),
};

set_opts(opts);
Expand Down

0 comments on commit 881112d

Please sign in to comment.