mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Auto merge of #29693 - mrobinson:cleanup-options, r=mukilan
Clean up how command-line options are passed around <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #29678 - [x] These changes do not require tests because they do not change behavior.
This commit is contained in:
commit
a8f7c45811
15 changed files with 221 additions and 549 deletions
|
@ -58,55 +58,14 @@ pub struct Opts {
|
|||
|
||||
pub output_file: Option<String>,
|
||||
|
||||
/// Replace unpaired surrogates in DOM strings with U+FFFD.
|
||||
/// See <https://github.com/servo/servo/issues/6564>
|
||||
pub replace_surrogates: bool,
|
||||
|
||||
/// Log GC passes and their durations.
|
||||
pub gc_profile: bool,
|
||||
|
||||
/// Load web fonts synchronously to avoid non-deterministic network-driven reflows.
|
||||
pub load_webfonts_synchronously: bool,
|
||||
|
||||
pub headless: bool,
|
||||
|
||||
/// True to exit on thread failure instead of displaying about:failure.
|
||||
pub hard_fail: bool,
|
||||
|
||||
/// True if we should bubble intrinsic widths sequentially (`-b`). If this is true, then
|
||||
/// intrinsic widths are computed as a separate pass instead of during flow construction. You
|
||||
/// may wish to turn this flag on in order to benchmark style recalculation against other
|
||||
/// browser engines.
|
||||
pub bubble_inline_sizes_separately: bool,
|
||||
|
||||
/// True if we should show borders on all fragments for debugging purposes
|
||||
/// (`--show-debug-fragment-borders`).
|
||||
pub show_debug_fragment_borders: bool,
|
||||
|
||||
/// True if we should paint borders around flows based on which thread painted them.
|
||||
pub show_debug_parallel_layout: bool,
|
||||
|
||||
/// If set with --disable-text-aa, disable antialiasing on fonts. This is primarily useful for reftests
|
||||
/// where pixel perfect results are required when using fonts such as the Ahem
|
||||
/// font for layout tests.
|
||||
pub enable_text_antialiasing: bool,
|
||||
|
||||
/// If set with --disable-subpixel, use subpixel antialiasing for glyphs. In the future
|
||||
/// this will likely become the default, but for now it's opt-in while we work
|
||||
/// out any bugs and improve the implementation.
|
||||
pub enable_subpixel_text_antialiasing: bool,
|
||||
|
||||
/// If set with --disable-canvas-aa, disable antialiasing on the HTML canvas element.
|
||||
/// Like --disable-text-aa, this is useful for reftests where pixel perfect results are required.
|
||||
pub enable_canvas_antialiasing: bool,
|
||||
|
||||
/// True if each step of layout is traced to an external JSON file
|
||||
/// for debugging purposes. Setting this implies sequential layout
|
||||
/// and paint.
|
||||
pub trace_layout: bool,
|
||||
|
||||
/// Periodically print out on which events script threads spend their processing time.
|
||||
pub profile_script_events: bool,
|
||||
/// Debug options that are used by developers to control Servo
|
||||
/// behavior for debugging purposes.
|
||||
pub debug: DebugOptions,
|
||||
|
||||
/// Port number to start a server to listen to remote Firefox devtools connections.
|
||||
/// 0 for random port.
|
||||
|
@ -139,63 +98,15 @@ pub struct Opts {
|
|||
/// used for testing the hardening of the constellation.
|
||||
pub random_pipeline_closure_seed: Option<usize>,
|
||||
|
||||
/// Dumps the DOM after restyle.
|
||||
pub dump_style_tree: bool,
|
||||
|
||||
/// Dumps the rule tree.
|
||||
pub dump_rule_tree: bool,
|
||||
|
||||
/// Dumps the flow tree after a layout.
|
||||
pub dump_flow_tree: bool,
|
||||
|
||||
/// Dumps the display list after a layout.
|
||||
pub dump_display_list: bool,
|
||||
|
||||
/// Dumps the display list in JSON form after a layout.
|
||||
pub dump_display_list_json: bool,
|
||||
|
||||
/// Emits notifications when there is a relayout.
|
||||
pub relayout_event: bool,
|
||||
|
||||
/// Whether Style Sharing Cache is used
|
||||
pub disable_share_style_cache: bool,
|
||||
|
||||
/// Whether to show in stdout style sharing cache stats after a restyle.
|
||||
pub style_sharing_stats: bool,
|
||||
|
||||
/// Translate mouse input into touch events.
|
||||
pub convert_mouse_to_touch: bool,
|
||||
|
||||
/// True to exit after the page load (`-x`).
|
||||
pub exit_after_load: bool,
|
||||
|
||||
/// True to show webrender profiling stats on screen.
|
||||
pub webrender_stats: bool,
|
||||
|
||||
/// True if webrender recording should be enabled.
|
||||
pub webrender_record: bool,
|
||||
|
||||
/// True if webrender is allowed to batch draw calls as instances.
|
||||
pub webrender_batch: bool,
|
||||
|
||||
/// Load shaders from disk.
|
||||
pub shaders_dir: Option<PathBuf>,
|
||||
|
||||
/// True to compile all webrender shaders at init time. This is mostly
|
||||
/// useful when modifying the shaders, to ensure they all compile
|
||||
/// after each change is made.
|
||||
pub precache_shaders: bool,
|
||||
|
||||
/// Directory for a default config directory
|
||||
pub config_dir: Option<PathBuf>,
|
||||
|
||||
// don't skip any backtraces on panic
|
||||
pub full_backtraces: bool,
|
||||
|
||||
/// True to use OS native signposting facilities. This makes profiling events (script activity,
|
||||
/// reflow, compositing, etc.) appear in Instruments.app on macOS.
|
||||
pub signpost: bool,
|
||||
|
||||
/// Print the version and exit.
|
||||
pub is_printing_version: bool,
|
||||
|
||||
|
@ -221,22 +132,30 @@ fn print_usage(app: &str, opts: &Options) {
|
|||
}
|
||||
|
||||
/// Debug options for Servo, currently set on the command line with -Z
|
||||
#[derive(Default)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
pub struct DebugOptions {
|
||||
/// List all the debug options.
|
||||
pub help: bool,
|
||||
|
||||
/// Bubble intrinsic widths separately like other engines.
|
||||
pub bubble_widths: bool,
|
||||
/// True if we should bubble intrinsic widths sequentially. If this is true,
|
||||
/// then intrinsic widths are computed as a separate pass instead of during
|
||||
/// flow construction. You may wish to turn this flag on in order to
|
||||
/// benchmark style recalculation against other browser engines.
|
||||
pub bubble_inline_sizes_separately: bool,
|
||||
|
||||
/// Disable antialiasing of rendered text.
|
||||
pub disable_text_aa: bool,
|
||||
/// If set with `disable-text-aa`, disable antialiasing on fonts. This is
|
||||
/// primarily useful for reftests where pixel perfect results are required
|
||||
/// when using fonts such as the Ahem font for layout tests.
|
||||
pub disable_text_antialiasing: bool,
|
||||
|
||||
/// Disable subpixel antialiasing of rendered text.
|
||||
pub disable_subpixel_aa: bool,
|
||||
pub disable_subpixel_text_antialiasing: bool,
|
||||
|
||||
/// Disable antialiasing of rendered text on the HTML canvas element.
|
||||
pub disable_canvas_aa: bool,
|
||||
/// If set with `disable-canvas-aa`, disable antialiasing on the HTML canvas
|
||||
/// element. Like `disable-text-aa`, this is useful for reftests where
|
||||
/// pixel perfect results are required.
|
||||
pub disable_canvas_antialiasing: bool,
|
||||
|
||||
/// Print the DOM after each restyle.
|
||||
pub dump_style_tree: bool,
|
||||
|
@ -256,7 +175,7 @@ pub struct DebugOptions {
|
|||
/// Print notifications when there is a relayout.
|
||||
pub relayout_event: bool,
|
||||
|
||||
/// Profile which events script threads spend their time on.
|
||||
/// Periodically print out on which events script threads spend their processing time.
|
||||
pub profile_script_events: bool,
|
||||
|
||||
/// Paint borders along fragment boundaries.
|
||||
|
@ -265,14 +184,16 @@ pub struct DebugOptions {
|
|||
/// Mark which thread laid each flow out with colors.
|
||||
pub show_parallel_layout: bool,
|
||||
|
||||
/// Write layout trace to an external file for debugging.
|
||||
/// True if each step of layout is traced to an external JSON file
|
||||
/// for debugging purposes. Setting this implies sequential layout
|
||||
/// and paint.
|
||||
pub trace_layout: bool,
|
||||
|
||||
/// Disable the style sharing cache.
|
||||
pub disable_share_style_cache: bool,
|
||||
|
||||
/// Whether to show in stdout style sharing cache stats after a restyle.
|
||||
pub style_sharing_stats: bool,
|
||||
pub dump_style_statistics: bool,
|
||||
|
||||
/// Translate mouse input into touch events.
|
||||
pub convert_mouse_to_touch: bool,
|
||||
|
@ -290,15 +211,6 @@ pub struct DebugOptions {
|
|||
/// Show webrender profiling stats on screen.
|
||||
pub webrender_stats: bool,
|
||||
|
||||
/// Enable webrender recording.
|
||||
pub webrender_record: bool,
|
||||
|
||||
/// Enable webrender instanced draw call batching.
|
||||
pub webrender_disable_batch: bool,
|
||||
|
||||
// don't skip any backtraces on panic
|
||||
pub full_backtraces: bool,
|
||||
|
||||
/// True to compile all webrender shaders at init time. This is mostly
|
||||
/// useful when modifying the shaders, to ensure they all compile
|
||||
/// after each change is made.
|
||||
|
@ -314,41 +226,42 @@ impl DebugOptions {
|
|||
for option in debug_string.split(',') {
|
||||
match option {
|
||||
"help" => self.help = true,
|
||||
"bubble-widths" => self.bubble_widths = true,
|
||||
"disable-text-aa" => self.disable_text_aa = true,
|
||||
"disable-subpixel-aa" => self.disable_subpixel_aa = true,
|
||||
"disable-canvas-aa" => self.disable_text_aa = true,
|
||||
"dump-style-tree" => self.dump_style_tree = true,
|
||||
"dump-rule-tree" => self.dump_rule_tree = true,
|
||||
"dump-flow-tree" => self.dump_flow_tree = true,
|
||||
"bubble-inline-sizes-separately" => self.bubble_inline_sizes_separately = true,
|
||||
"convert-mouse-to-touch" => self.convert_mouse_to_touch = true,
|
||||
"disable-canvas-aa" => self.disable_canvas_antialiasing = true,
|
||||
"disable-share-style-cache" => self.disable_share_style_cache = true,
|
||||
"disable-subpixel-aa" => self.disable_subpixel_text_antialiasing = true,
|
||||
"disable-text-aa" => self.disable_text_antialiasing = true,
|
||||
"dump-display-list" => self.dump_display_list = true,
|
||||
"dump-display-list-json" => self.dump_display_list_json = true,
|
||||
"relayout-event" => self.relayout_event = true,
|
||||
"profile-script-events" => self.profile_script_events = true,
|
||||
"show-fragment-borders" => self.show_fragment_borders = true,
|
||||
"show-parallel-layout" => self.show_parallel_layout = true,
|
||||
"trace-layout" => self.trace_layout = true,
|
||||
"disable-share-style-cache" => self.disable_share_style_cache = true,
|
||||
"style-sharing-stats" => self.style_sharing_stats = true,
|
||||
"convert-mouse-to-touch" => self.convert_mouse_to_touch = true,
|
||||
"replace-surrogates" => self.replace_surrogates = true,
|
||||
"dump-flow-tree" => self.dump_flow_tree = true,
|
||||
"dump-rule-tree" => self.dump_rule_tree = true,
|
||||
"dump-style-tree" => self.dump_style_tree = true,
|
||||
"gc-profile" => self.gc_profile = true,
|
||||
"load-webfonts-synchronously" => self.load_webfonts_synchronously = true,
|
||||
"wr-stats" => self.webrender_stats = true,
|
||||
"wr-record" => self.webrender_record = true,
|
||||
"wr-no-batch" => self.webrender_disable_batch = true,
|
||||
"full-backtraces" => self.full_backtraces = true,
|
||||
"precache-shaders" => self.precache_shaders = true,
|
||||
"profile-script-events" => self.profile_script_events = true,
|
||||
"relayout-event" => self.relayout_event = true,
|
||||
"replace-surrogates" => self.replace_surrogates = true,
|
||||
"show-fragment-borders" => self.show_fragment_borders = true,
|
||||
"show-parallel-layout" => self.show_parallel_layout = true,
|
||||
"signpost" => self.signpost = true,
|
||||
"dump-style-stats" => self.dump_style_statistics = true,
|
||||
"trace-layout" => self.trace_layout = true,
|
||||
"wr-stats" => self.webrender_stats = true,
|
||||
"" => {},
|
||||
_ => return Err(String::from(option)),
|
||||
};
|
||||
}
|
||||
|
||||
if self.trace_layout {
|
||||
self.bubble_inline_sizes_separately = true;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn print_debug_usage(app: &str) -> ! {
|
||||
fn print_usage(app: &str) {
|
||||
fn print_option(name: &str, description: &str) {
|
||||
println!("\t{:<35} {}", name, description);
|
||||
}
|
||||
|
@ -359,19 +272,26 @@ fn print_debug_usage(app: &str) -> ! {
|
|||
);
|
||||
|
||||
print_option(
|
||||
"bubble-widths",
|
||||
"bubble-inline-sizes-separately",
|
||||
"Bubble intrinsic widths separately like other engines.",
|
||||
);
|
||||
print_option("disable-text-aa", "Disable antialiasing of rendered text.");
|
||||
print_option(
|
||||
"convert-mouse-to-touch",
|
||||
"Send touch events instead of mouse events",
|
||||
);
|
||||
print_option(
|
||||
"disable-canvas-aa",
|
||||
"Disable antialiasing on the HTML canvas element.",
|
||||
);
|
||||
print_option(
|
||||
"dump-style-tree",
|
||||
"Print the DOM with computed styles after each restyle.",
|
||||
"disable-share-style-cache",
|
||||
"Disable the style sharing cache.",
|
||||
);
|
||||
print_option("dump-flow-tree", "Print the flow tree after each layout.");
|
||||
print_option(
|
||||
"disable-subpixel-aa",
|
||||
"Disable subpixel text antialiasing overriding preference.",
|
||||
);
|
||||
print_option("disable-text-aa", "Disable antialiasing of rendered text.");
|
||||
print_option(
|
||||
"dump-display-list",
|
||||
"Print the display list after each layout.",
|
||||
|
@ -380,14 +300,35 @@ fn print_debug_usage(app: &str) -> ! {
|
|||
"dump-display-list-json",
|
||||
"Print the display list in JSON form.",
|
||||
);
|
||||
print_option("dump-flow-tree", "Print the flow tree after each layout.");
|
||||
print_option(
|
||||
"relayout-event",
|
||||
"Print notifications when there is a relayout.",
|
||||
"dump-rule-tree",
|
||||
"Print the style rule tree after each layout.",
|
||||
);
|
||||
print_option(
|
||||
"dump-style-tree",
|
||||
"Print the DOM with computed styles after each restyle.",
|
||||
);
|
||||
print_option("dump-style-stats", "Print style statistics each restyle.");
|
||||
print_option("gc-profile", "Log GC passes and their durations.");
|
||||
print_option(
|
||||
"load-webfonts-synchronously",
|
||||
"Load web fonts synchronously to avoid non-deterministic network-driven reflows",
|
||||
);
|
||||
print_option(
|
||||
"parallel-display-list-building",
|
||||
"Build display lists in parallel.",
|
||||
);
|
||||
print_option("precache-shaders", "Compile all shaders during init.");
|
||||
print_option(
|
||||
"profile-script-events",
|
||||
"Enable profiling of script-related events.",
|
||||
);
|
||||
print_option(
|
||||
"relayout-event",
|
||||
"Print notifications when there is a relayout.",
|
||||
);
|
||||
print_option("replace-surrogates", "Replace unpaires surrogates in DOM strings with U+FFFD. See https://github.com/servo/servo/issues/6564");
|
||||
print_option(
|
||||
"show-fragment-borders",
|
||||
"Paint borders along fragment boundaries.",
|
||||
|
@ -396,45 +337,20 @@ fn print_debug_usage(app: &str) -> ! {
|
|||
"show-parallel-layout",
|
||||
"Mark which thread laid each flow out with colors.",
|
||||
);
|
||||
print_option(
|
||||
"trace-layout",
|
||||
"Write layout trace to an external file for debugging.",
|
||||
);
|
||||
print_option(
|
||||
"disable-share-style-cache",
|
||||
"Disable the style sharing cache.",
|
||||
);
|
||||
print_option(
|
||||
"parallel-display-list-building",
|
||||
"Build display lists in parallel.",
|
||||
);
|
||||
print_option(
|
||||
"convert-mouse-to-touch",
|
||||
"Send touch events instead of mouse events",
|
||||
);
|
||||
print_option(
|
||||
"replace-surrogates",
|
||||
"Replace unpaires surrogates in DOM strings with U+FFFD. \
|
||||
See https://github.com/servo/servo/issues/6564",
|
||||
);
|
||||
print_option("gc-profile", "Log GC passes and their durations.");
|
||||
print_option(
|
||||
"load-webfonts-synchronously",
|
||||
"Load web fonts synchronously to avoid non-deterministic network-driven reflows",
|
||||
);
|
||||
print_option("wr-stats", "Show WebRender profiler on screen.");
|
||||
print_option("full-backtraces", "Print full backtraces for all errors");
|
||||
print_option("wr-debug", "Display webrender tile borders.");
|
||||
print_option("wr-no-batch", "Disable webrender instanced batching.");
|
||||
print_option("precache-shaders", "Compile all shaders during init.");
|
||||
print_option(
|
||||
"signpost",
|
||||
"Emit native OS signposts for profile events (currently macOS only)",
|
||||
);
|
||||
print_option(
|
||||
"trace-layout",
|
||||
"Write layout trace to an external file for debugging.",
|
||||
);
|
||||
print_option("wr-stats", "Show WebRender profiler on screen.");
|
||||
|
||||
println!();
|
||||
|
||||
process::exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
|
@ -468,18 +384,8 @@ pub fn default_opts() -> Opts {
|
|||
userscripts: None,
|
||||
user_stylesheets: Vec::new(),
|
||||
output_file: None,
|
||||
replace_surrogates: false,
|
||||
gc_profile: false,
|
||||
load_webfonts_synchronously: false,
|
||||
headless: false,
|
||||
hard_fail: true,
|
||||
bubble_inline_sizes_separately: false,
|
||||
show_debug_fragment_borders: false,
|
||||
show_debug_parallel_layout: false,
|
||||
enable_text_antialiasing: true,
|
||||
enable_subpixel_text_antialiasing: true,
|
||||
enable_canvas_antialiasing: true,
|
||||
trace_layout: false,
|
||||
devtools_port: 0,
|
||||
devtools_server_enabled: false,
|
||||
webdriver_port: None,
|
||||
|
@ -489,26 +395,11 @@ pub fn default_opts() -> Opts {
|
|||
random_pipeline_closure_probability: None,
|
||||
random_pipeline_closure_seed: None,
|
||||
sandbox: false,
|
||||
dump_style_tree: false,
|
||||
dump_rule_tree: false,
|
||||
dump_flow_tree: false,
|
||||
dump_display_list: false,
|
||||
dump_display_list_json: false,
|
||||
relayout_event: false,
|
||||
profile_script_events: false,
|
||||
disable_share_style_cache: false,
|
||||
style_sharing_stats: false,
|
||||
convert_mouse_to_touch: false,
|
||||
debug: Default::default(),
|
||||
exit_after_load: false,
|
||||
webrender_stats: false,
|
||||
config_dir: None,
|
||||
full_backtraces: false,
|
||||
is_printing_version: false,
|
||||
webrender_record: false,
|
||||
webrender_batch: true,
|
||||
shaders_dir: None,
|
||||
precache_shaders: false,
|
||||
signpost: false,
|
||||
certificate_path: None,
|
||||
unminify_js: false,
|
||||
local_script_source: None,
|
||||
|
@ -673,7 +564,6 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
|||
}
|
||||
|
||||
let mut debug_options = DebugOptions::default();
|
||||
|
||||
for debug_string in opt_match.opt_strs("Z") {
|
||||
if let Err(e) = debug_options.extend(debug_string) {
|
||||
args_fail(&format!("error: unrecognized debug option: {}", e));
|
||||
|
@ -681,7 +571,7 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
|||
}
|
||||
|
||||
if debug_options.help {
|
||||
print_debug_usage(app_name)
|
||||
DebugOptions::print_usage(app_name)
|
||||
}
|
||||
|
||||
let cwd = env::current_dir().unwrap();
|
||||
|
@ -778,10 +668,8 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
|||
})
|
||||
});
|
||||
|
||||
let mut bubble_inline_sizes_separately = debug_options.bubble_widths;
|
||||
if debug_options.trace_layout {
|
||||
layout_threads = Some(1);
|
||||
bubble_inline_sizes_separately = true;
|
||||
}
|
||||
|
||||
let (devtools_server_enabled, devtools_port) = if opt_match.opt_present("devtools") {
|
||||
|
@ -841,12 +729,10 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
|||
})
|
||||
.collect();
|
||||
|
||||
let enable_subpixel_text_antialiasing =
|
||||
!debug_options.disable_subpixel_aa && pref!(gfx.subpixel_text_antialiasing.enabled);
|
||||
|
||||
let is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version");
|
||||
|
||||
let opts = Opts {
|
||||
debug: debug_options.clone(),
|
||||
is_running_problem_test,
|
||||
url: url_opt,
|
||||
tile_size,
|
||||
|
@ -857,14 +743,8 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
|||
userscripts: opt_match.opt_default("userscripts", ""),
|
||||
user_stylesheets,
|
||||
output_file: opt_match.opt_str("o"),
|
||||
replace_surrogates: debug_options.replace_surrogates,
|
||||
gc_profile: debug_options.gc_profile,
|
||||
load_webfonts_synchronously: debug_options.load_webfonts_synchronously,
|
||||
headless: opt_match.opt_present("z"),
|
||||
hard_fail: opt_match.opt_present("f") && !opt_match.opt_present("F"),
|
||||
bubble_inline_sizes_separately,
|
||||
profile_script_events: debug_options.profile_script_events,
|
||||
trace_layout: debug_options.trace_layout,
|
||||
devtools_port,
|
||||
devtools_server_enabled,
|
||||
webdriver_port,
|
||||
|
@ -874,30 +754,10 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
|||
sandbox: opt_match.opt_present("S"),
|
||||
random_pipeline_closure_probability,
|
||||
random_pipeline_closure_seed,
|
||||
show_debug_fragment_borders: debug_options.show_fragment_borders,
|
||||
show_debug_parallel_layout: debug_options.show_parallel_layout,
|
||||
enable_text_antialiasing: !debug_options.disable_text_aa,
|
||||
enable_subpixel_text_antialiasing,
|
||||
enable_canvas_antialiasing: !debug_options.disable_canvas_aa,
|
||||
dump_style_tree: debug_options.dump_style_tree,
|
||||
dump_rule_tree: debug_options.dump_rule_tree,
|
||||
dump_flow_tree: debug_options.dump_flow_tree,
|
||||
dump_display_list: debug_options.dump_display_list,
|
||||
dump_display_list_json: debug_options.dump_display_list_json,
|
||||
relayout_event: debug_options.relayout_event,
|
||||
disable_share_style_cache: debug_options.disable_share_style_cache,
|
||||
style_sharing_stats: debug_options.style_sharing_stats,
|
||||
convert_mouse_to_touch: debug_options.convert_mouse_to_touch,
|
||||
exit_after_load: opt_match.opt_present("x"),
|
||||
webrender_stats: debug_options.webrender_stats,
|
||||
config_dir: opt_match.opt_str("config-dir").map(Into::into),
|
||||
full_backtraces: debug_options.full_backtraces,
|
||||
is_printing_version,
|
||||
webrender_record: debug_options.webrender_record,
|
||||
webrender_batch: !debug_options.webrender_disable_batch,
|
||||
shaders_dir: opt_match.opt_str("shaders").map(Into::into),
|
||||
precache_shaders: debug_options.precache_shaders,
|
||||
signpost: debug_options.signpost,
|
||||
certificate_path: opt_match.opt_str("certificate-path"),
|
||||
unminify_js: opt_match.opt_present("unminify-js"),
|
||||
local_script_source: opt_match.opt_str("local-script-source"),
|
||||
|
|
|
@ -576,17 +576,6 @@ impl UnprivilegedPipelineContent {
|
|||
inherited_secure_context: self.load_data.inherited_secure_context.clone(),
|
||||
},
|
||||
self.load_data.clone(),
|
||||
self.opts.profile_script_events,
|
||||
self.opts.print_pwm,
|
||||
self.opts.relayout_event,
|
||||
self.opts.output_file.is_some() ||
|
||||
self.opts.exit_after_load ||
|
||||
self.opts.webdriver_port.is_some(),
|
||||
self.opts.unminify_js,
|
||||
self.opts.local_script_source,
|
||||
self.opts.userscripts,
|
||||
self.opts.headless,
|
||||
self.opts.replace_surrogates,
|
||||
self.user_agent,
|
||||
);
|
||||
|
||||
|
@ -607,16 +596,7 @@ impl UnprivilegedPipelineContent {
|
|||
self.webrender_api_sender,
|
||||
paint_time_metrics,
|
||||
layout_thread_busy_flag.clone(),
|
||||
self.opts.load_webfonts_synchronously,
|
||||
self.window_size,
|
||||
self.opts.dump_display_list,
|
||||
self.opts.dump_display_list_json,
|
||||
self.opts.dump_style_tree,
|
||||
self.opts.dump_rule_tree,
|
||||
self.opts.relayout_event,
|
||||
self.opts.nonincremental_layout,
|
||||
self.opts.trace_layout,
|
||||
self.opts.dump_flow_tree,
|
||||
);
|
||||
|
||||
if wait_for_completion {
|
||||
|
|
|
@ -2068,7 +2068,7 @@ impl FlowRef {
|
|||
/// All flows must be finished at some point, or they will not have their intrinsic inline-sizes
|
||||
/// properly computed. (This is not, however, a memory safety problem.)
|
||||
fn finish(&mut self) {
|
||||
if !opts::get().bubble_inline_sizes_separately {
|
||||
if !opts::get().debug.bubble_inline_sizes_separately {
|
||||
FlowRef::deref_mut(self).bubble_inline_sizes();
|
||||
FlowRef::deref_mut(self)
|
||||
.mut_base()
|
||||
|
|
|
@ -1713,7 +1713,7 @@ impl Fragment {
|
|||
);
|
||||
});
|
||||
|
||||
if opts::get().show_debug_fragment_borders {
|
||||
if opts::get().debug.show_fragment_borders {
|
||||
self.build_debug_borders_around_fragment(state, stacking_relative_border_box, clip)
|
||||
}
|
||||
}
|
||||
|
@ -1772,7 +1772,7 @@ impl Fragment {
|
|||
clip,
|
||||
);
|
||||
|
||||
if opts::get().show_debug_fragment_borders {
|
||||
if opts::get().debug.show_fragment_borders {
|
||||
self.build_debug_borders_around_text_fragments(
|
||||
state,
|
||||
self.style(),
|
||||
|
@ -1793,7 +1793,7 @@ impl Fragment {
|
|||
clip,
|
||||
);
|
||||
|
||||
if opts::get().show_debug_fragment_borders {
|
||||
if opts::get().debug.show_fragment_borders {
|
||||
self.build_debug_borders_around_text_fragments(
|
||||
state,
|
||||
self.style(),
|
||||
|
@ -1817,7 +1817,7 @@ impl Fragment {
|
|||
SpecificFragmentInfo::InlineAbsolute(_) |
|
||||
SpecificFragmentInfo::TruncatedFragment(_) |
|
||||
SpecificFragmentInfo::Svg(_) => {
|
||||
if opts::get().show_debug_fragment_borders {
|
||||
if opts::get().debug.show_fragment_borders {
|
||||
self.build_debug_borders_around_fragment(
|
||||
state,
|
||||
stacking_relative_border_box,
|
||||
|
@ -2885,7 +2885,7 @@ impl BaseFlow {
|
|||
state: &mut DisplayListBuildState,
|
||||
node: OpaqueNode,
|
||||
) {
|
||||
if !opts::get().show_debug_parallel_layout {
|
||||
if !opts::get().debug.show_parallel_layout {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ pub fn reflow(
|
|||
context: &LayoutContext,
|
||||
queue: &rayon::ThreadPool,
|
||||
) {
|
||||
if opts::get().bubble_inline_sizes_separately {
|
||||
if opts::get().debug.bubble_inline_sizes_separately {
|
||||
let bubble_inline_sizes = BubbleISizes {
|
||||
layout_context: &context,
|
||||
};
|
||||
|
|
|
@ -55,7 +55,7 @@ pub fn reflow(root: &mut dyn Flow, layout_context: &LayoutContext, relayout_mode
|
|||
}
|
||||
}
|
||||
|
||||
if opts::get().bubble_inline_sizes_separately {
|
||||
if opts::get().debug.bubble_inline_sizes_separately {
|
||||
let bubble_inline_sizes = BubbleISizes {
|
||||
layout_context: &layout_context,
|
||||
};
|
||||
|
|
|
@ -86,7 +86,7 @@ use script_traits::{Painter, WebrenderIpcSender};
|
|||
use script_traits::{ScrollState, UntrustedNodeAddress, WindowSizeData};
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_atoms::Atom;
|
||||
use servo_config::opts;
|
||||
use servo_config::opts::{self, DebugOptions};
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
@ -221,34 +221,12 @@ pub struct LayoutThread {
|
|||
/// Flag that indicates if LayoutThread is busy handling a request.
|
||||
busy: Arc<AtomicBool>,
|
||||
|
||||
/// Load web fonts synchronously to avoid non-deterministic network-driven reflows.
|
||||
load_webfonts_synchronously: bool,
|
||||
|
||||
/// Dumps the display list form after a layout.
|
||||
dump_display_list: bool,
|
||||
|
||||
/// Dumps the display list in JSON form after a layout.
|
||||
dump_display_list_json: bool,
|
||||
|
||||
/// Dumps the DOM after restyle.
|
||||
dump_style_tree: bool,
|
||||
|
||||
/// Dumps the flow tree after a layout.
|
||||
dump_rule_tree: bool,
|
||||
|
||||
/// Emits notifications when there is a relayout.
|
||||
relayout_event: bool,
|
||||
/// Debug options, copied from configuration to this `LayoutThread` in order
|
||||
/// to avoid having to constantly access the thread-safe global options.
|
||||
debug: DebugOptions,
|
||||
|
||||
/// True to turn off incremental layout.
|
||||
nonincremental_layout: bool,
|
||||
|
||||
/// True if each step of layout is traced to an external JSON file
|
||||
/// for debugging purposes. Setting this implies sequential layout
|
||||
/// and paint.
|
||||
trace_layout: bool,
|
||||
|
||||
/// Dumps the flow tree after a layout.
|
||||
dump_flow_tree: bool,
|
||||
}
|
||||
|
||||
impl LayoutThreadFactory for LayoutThread {
|
||||
|
@ -272,16 +250,7 @@ impl LayoutThreadFactory for LayoutThread {
|
|||
webrender_api_sender: WebrenderIpcSender,
|
||||
paint_time_metrics: PaintTimeMetrics,
|
||||
busy: Arc<AtomicBool>,
|
||||
load_webfonts_synchronously: bool,
|
||||
window_size: WindowSizeData,
|
||||
dump_display_list: bool,
|
||||
dump_display_list_json: bool,
|
||||
dump_style_tree: bool,
|
||||
dump_rule_tree: bool,
|
||||
relayout_event: bool,
|
||||
nonincremental_layout: bool,
|
||||
trace_layout: bool,
|
||||
dump_flow_tree: bool,
|
||||
) {
|
||||
thread::Builder::new()
|
||||
.name(format!("Layout{}", id))
|
||||
|
@ -320,16 +289,7 @@ impl LayoutThreadFactory for LayoutThread {
|
|||
webrender_api_sender,
|
||||
paint_time_metrics,
|
||||
busy,
|
||||
load_webfonts_synchronously,
|
||||
window_size,
|
||||
dump_display_list,
|
||||
dump_display_list_json,
|
||||
dump_style_tree,
|
||||
dump_rule_tree,
|
||||
relayout_event,
|
||||
nonincremental_layout,
|
||||
trace_layout,
|
||||
dump_flow_tree,
|
||||
);
|
||||
|
||||
let reporter_name = format!("layout-reporter-{}", id);
|
||||
|
@ -489,16 +449,7 @@ impl LayoutThread {
|
|||
webrender_api: WebrenderIpcSender,
|
||||
paint_time_metrics: PaintTimeMetrics,
|
||||
busy: Arc<AtomicBool>,
|
||||
load_webfonts_synchronously: bool,
|
||||
window_size: WindowSizeData,
|
||||
dump_display_list: bool,
|
||||
dump_display_list_json: bool,
|
||||
dump_style_tree: bool,
|
||||
dump_rule_tree: bool,
|
||||
relayout_event: bool,
|
||||
nonincremental_layout: bool,
|
||||
trace_layout: bool,
|
||||
dump_flow_tree: bool,
|
||||
) -> LayoutThread {
|
||||
// Let webrender know about this pipeline by sending an empty display list.
|
||||
webrender_api.send_initial_transaction(id.to_webrender());
|
||||
|
@ -519,22 +470,22 @@ impl LayoutThread {
|
|||
ROUTER.route_ipc_receiver_to_new_crossbeam_receiver(ipc_font_cache_receiver);
|
||||
|
||||
LayoutThread {
|
||||
id: id,
|
||||
id,
|
||||
top_level_browsing_context_id: top_level_browsing_context_id,
|
||||
url: url,
|
||||
is_iframe: is_iframe,
|
||||
port: port,
|
||||
url,
|
||||
is_iframe,
|
||||
port,
|
||||
pipeline_port: pipeline_receiver,
|
||||
script_chan: script_chan,
|
||||
script_chan,
|
||||
background_hang_monitor,
|
||||
constellation_chan: constellation_chan.clone(),
|
||||
time_profiler_chan: time_profiler_chan,
|
||||
mem_profiler_chan: mem_profiler_chan,
|
||||
time_profiler_chan,
|
||||
mem_profiler_chan,
|
||||
registered_painters: RegisteredPaintersImpl(Default::default()),
|
||||
image_cache: image_cache,
|
||||
font_cache_thread: font_cache_thread,
|
||||
image_cache,
|
||||
font_cache_thread,
|
||||
first_reflow: Cell::new(true),
|
||||
font_cache_receiver: font_cache_receiver,
|
||||
font_cache_receiver,
|
||||
font_cache_sender: ipc_font_cache_sender,
|
||||
parallel_flag: true,
|
||||
generation: Cell::new(0),
|
||||
|
@ -546,7 +497,7 @@ impl LayoutThread {
|
|||
webrender_api,
|
||||
stylist: Stylist::new(device, QuirksMode::NoQuirks),
|
||||
rw_data: Arc::new(Mutex::new(LayoutThreadData {
|
||||
constellation_chan: constellation_chan,
|
||||
constellation_chan,
|
||||
display_list: None,
|
||||
indexable_text: IndexableText::default(),
|
||||
content_box_response: None,
|
||||
|
@ -564,19 +515,12 @@ impl LayoutThread {
|
|||
inner_window_dimensions_response: None,
|
||||
})),
|
||||
webrender_image_cache: Arc::new(RwLock::new(FnvHashMap::default())),
|
||||
paint_time_metrics: paint_time_metrics,
|
||||
paint_time_metrics,
|
||||
layout_query_waiting_time: Histogram::new(),
|
||||
last_iframe_sizes: Default::default(),
|
||||
busy,
|
||||
load_webfonts_synchronously,
|
||||
dump_display_list,
|
||||
dump_display_list_json,
|
||||
dump_style_tree,
|
||||
dump_rule_tree,
|
||||
relayout_event,
|
||||
nonincremental_layout,
|
||||
trace_layout,
|
||||
dump_flow_tree,
|
||||
debug: opts::get().debug.clone(),
|
||||
nonincremental_layout: opts::get().nonincremental_layout,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -855,16 +799,7 @@ impl LayoutThread {
|
|||
self.webrender_api.clone(),
|
||||
info.paint_time_metrics,
|
||||
info.layout_is_busy,
|
||||
self.load_webfonts_synchronously,
|
||||
info.window_size,
|
||||
self.dump_display_list,
|
||||
self.dump_display_list_json,
|
||||
self.dump_style_tree,
|
||||
self.dump_rule_tree,
|
||||
self.relayout_event,
|
||||
self.nonincremental_layout,
|
||||
self.trace_layout,
|
||||
self.dump_flow_tree,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -917,7 +852,7 @@ impl LayoutThread {
|
|||
&self.font_cache_thread,
|
||||
&self.font_cache_sender,
|
||||
&self.outstanding_web_fonts,
|
||||
self.load_webfonts_synchronously,
|
||||
self.debug.load_webfonts_synchronously,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1124,10 +1059,10 @@ impl LayoutThread {
|
|||
|
||||
let display_list = rw_data.display_list.as_mut().unwrap();
|
||||
|
||||
if self.dump_display_list {
|
||||
if self.debug.dump_display_list {
|
||||
display_list.print();
|
||||
}
|
||||
if self.dump_display_list_json {
|
||||
if self.debug.dump_display_list_json {
|
||||
println!("{}", serde_json::to_string_pretty(&display_list).unwrap());
|
||||
}
|
||||
|
||||
|
@ -1467,14 +1402,14 @@ impl LayoutThread {
|
|||
|
||||
layout_context = traversal.destroy();
|
||||
|
||||
if self.dump_style_tree {
|
||||
if self.debug.dump_style_tree {
|
||||
println!(
|
||||
"{:?}",
|
||||
ShowSubtreeDataAndPrimaryValues(root_element.as_node())
|
||||
);
|
||||
}
|
||||
|
||||
if self.dump_rule_tree {
|
||||
if self.debug.dump_rule_tree {
|
||||
layout_context
|
||||
.style_context
|
||||
.stylist
|
||||
|
@ -1724,7 +1659,7 @@ impl LayoutThread {
|
|||
},
|
||||
);
|
||||
|
||||
if self.trace_layout {
|
||||
if self.debug.trace_layout {
|
||||
layout_debug::begin_trace(root_flow.clone());
|
||||
}
|
||||
|
||||
|
@ -1821,11 +1756,11 @@ impl LayoutThread {
|
|||
rw_data,
|
||||
);
|
||||
|
||||
if self.trace_layout {
|
||||
if self.debug.trace_layout {
|
||||
layout_debug::end_trace(self.generation.get());
|
||||
}
|
||||
|
||||
if self.dump_flow_tree {
|
||||
if self.debug.dump_flow_tree {
|
||||
root_flow.print("Post layout flow tree".to_owned());
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ use script_traits::{
|
|||
};
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_atoms::Atom;
|
||||
use servo_config::opts;
|
||||
use servo_config::opts::{self, DebugOptions};
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::HashMap;
|
||||
|
@ -200,30 +200,9 @@ pub struct LayoutThread {
|
|||
/// Flag that indicates if LayoutThread is busy handling a request.
|
||||
busy: Arc<AtomicBool>,
|
||||
|
||||
/// Load web fonts synchronously to avoid non-deterministic network-driven reflows.
|
||||
load_webfonts_synchronously: bool,
|
||||
|
||||
/// Dumps the display list form after a layout.
|
||||
dump_display_list: bool,
|
||||
|
||||
/// Dumps the display list in JSON form after a layout.
|
||||
dump_display_list_json: bool,
|
||||
|
||||
/// Dumps the DOM after restyle.
|
||||
dump_style_tree: bool,
|
||||
|
||||
/// Dumps the flow tree after a layout.
|
||||
dump_rule_tree: bool,
|
||||
|
||||
/// Dumps the flow tree after a layout.
|
||||
dump_flow_tree: bool,
|
||||
|
||||
/// Emits notifications when there is a relayout.
|
||||
relayout_event: bool,
|
||||
|
||||
/// True if each step of layout is traced to an external JSON file
|
||||
/// for debugging purposes.
|
||||
trace_layout: bool,
|
||||
/// Debug options, copied from configuration to this `LayoutThread` in order
|
||||
/// to avoid having to constantly access the thread-safe global options.
|
||||
debug: DebugOptions,
|
||||
}
|
||||
|
||||
impl LayoutThreadFactory for LayoutThread {
|
||||
|
@ -247,16 +226,7 @@ impl LayoutThreadFactory for LayoutThread {
|
|||
webrender_api_sender: WebrenderIpcSender,
|
||||
paint_time_metrics: PaintTimeMetrics,
|
||||
busy: Arc<AtomicBool>,
|
||||
load_webfonts_synchronously: bool,
|
||||
window_size: WindowSizeData,
|
||||
dump_display_list: bool,
|
||||
dump_display_list_json: bool,
|
||||
dump_style_tree: bool,
|
||||
dump_rule_tree: bool,
|
||||
relayout_event: bool,
|
||||
_nonincremental_layout: bool,
|
||||
trace_layout: bool,
|
||||
dump_flow_tree: bool,
|
||||
) {
|
||||
thread::Builder::new()
|
||||
.name(format!("Layout{}", id))
|
||||
|
@ -295,15 +265,7 @@ impl LayoutThreadFactory for LayoutThread {
|
|||
webrender_api_sender,
|
||||
paint_time_metrics,
|
||||
busy,
|
||||
load_webfonts_synchronously,
|
||||
window_size,
|
||||
relayout_event,
|
||||
dump_display_list,
|
||||
dump_display_list_json,
|
||||
dump_style_tree,
|
||||
dump_rule_tree,
|
||||
dump_flow_tree,
|
||||
trace_layout,
|
||||
);
|
||||
|
||||
let reporter_name = format!("layout-reporter-{}", id);
|
||||
|
@ -463,15 +425,7 @@ impl LayoutThread {
|
|||
webrender_api_sender: WebrenderIpcSender,
|
||||
paint_time_metrics: PaintTimeMetrics,
|
||||
busy: Arc<AtomicBool>,
|
||||
load_webfonts_synchronously: bool,
|
||||
window_size: WindowSizeData,
|
||||
relayout_event: bool,
|
||||
dump_display_list: bool,
|
||||
dump_display_list_json: bool,
|
||||
dump_style_tree: bool,
|
||||
dump_rule_tree: bool,
|
||||
dump_flow_tree: bool,
|
||||
trace_layout: bool,
|
||||
) -> LayoutThread {
|
||||
// Let webrender know about this pipeline by sending an empty display list.
|
||||
webrender_api_sender.send_initial_transaction(id.to_webrender());
|
||||
|
@ -494,22 +448,22 @@ impl LayoutThread {
|
|||
ROUTER.route_ipc_receiver_to_new_crossbeam_receiver(ipc_font_cache_receiver);
|
||||
|
||||
LayoutThread {
|
||||
id: id,
|
||||
id,
|
||||
top_level_browsing_context_id: top_level_browsing_context_id,
|
||||
url: url,
|
||||
is_iframe: is_iframe,
|
||||
port: port,
|
||||
url,
|
||||
is_iframe,
|
||||
port,
|
||||
pipeline_port: pipeline_receiver,
|
||||
constellation_chan,
|
||||
script_chan: script_chan.clone(),
|
||||
background_hang_monitor,
|
||||
time_profiler_chan: time_profiler_chan,
|
||||
mem_profiler_chan: mem_profiler_chan,
|
||||
time_profiler_chan,
|
||||
mem_profiler_chan,
|
||||
registered_painters: RegisteredPaintersImpl(Default::default()),
|
||||
image_cache,
|
||||
font_cache_thread: font_cache_thread,
|
||||
font_cache_thread,
|
||||
first_reflow: Cell::new(true),
|
||||
font_cache_receiver: font_cache_receiver,
|
||||
font_cache_receiver,
|
||||
font_cache_sender: ipc_font_cache_sender,
|
||||
generation: Cell::new(0),
|
||||
outstanding_web_fonts: Arc::new(AtomicUsize::new(0)),
|
||||
|
@ -540,14 +494,7 @@ impl LayoutThread {
|
|||
paint_time_metrics: paint_time_metrics,
|
||||
last_iframe_sizes: Default::default(),
|
||||
busy,
|
||||
load_webfonts_synchronously,
|
||||
relayout_event,
|
||||
dump_display_list,
|
||||
dump_display_list_json,
|
||||
dump_style_tree,
|
||||
dump_rule_tree,
|
||||
dump_flow_tree,
|
||||
trace_layout,
|
||||
debug: opts::get().debug.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -803,16 +750,7 @@ impl LayoutThread {
|
|||
self.webrender_api.clone(),
|
||||
info.paint_time_metrics,
|
||||
info.layout_is_busy,
|
||||
self.load_webfonts_synchronously,
|
||||
info.window_size,
|
||||
self.dump_display_list,
|
||||
self.dump_display_list_json,
|
||||
self.dump_style_tree,
|
||||
self.dump_rule_tree,
|
||||
self.relayout_event,
|
||||
true, // nonincremental_layout
|
||||
self.trace_layout, // trace_layout
|
||||
self.dump_flow_tree, // dump_flow_tree
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -850,7 +788,7 @@ impl LayoutThread {
|
|||
&self.font_cache_thread,
|
||||
&self.font_cache_sender,
|
||||
&self.outstanding_web_fonts,
|
||||
self.load_webfonts_synchronously,
|
||||
self.debug.load_webfonts_synchronously,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1116,14 +1054,14 @@ impl LayoutThread {
|
|||
unsafe { element.unset_snapshot_flags() }
|
||||
}
|
||||
|
||||
if self.dump_style_tree {
|
||||
if self.debug.dump_style_tree {
|
||||
println!(
|
||||
"{:?}",
|
||||
style::dom::ShowSubtreeDataAndPrimaryValues(root_element.as_node())
|
||||
);
|
||||
}
|
||||
|
||||
if self.dump_rule_tree {
|
||||
if self.debug.dump_rule_tree {
|
||||
layout_context
|
||||
.style_context
|
||||
.stylist
|
||||
|
@ -1302,7 +1240,7 @@ impl LayoutThread {
|
|||
&fragment_tree,
|
||||
);
|
||||
|
||||
if self.trace_layout {
|
||||
if self.debug.trace_layout {
|
||||
if let Some(box_tree) = &*self.box_tree.borrow() {
|
||||
layout_debug::begin_trace(box_tree.clone(), fragment_tree.clone());
|
||||
}
|
||||
|
@ -1330,13 +1268,13 @@ impl LayoutThread {
|
|||
// the display list for printing the serialized version when `finalize()` is called.
|
||||
// We need to call this before adding any display items so that they are printed
|
||||
// during `finalize()`.
|
||||
if self.dump_display_list {
|
||||
if self.debug.dump_display_list {
|
||||
display_list.wr.dump_serialized_display_list();
|
||||
}
|
||||
|
||||
fragment_tree.build_display_list(&mut display_list);
|
||||
|
||||
if self.dump_flow_tree {
|
||||
if self.debug.dump_flow_tree {
|
||||
fragment_tree.print();
|
||||
}
|
||||
debug!("Layout done!");
|
||||
|
@ -1364,7 +1302,7 @@ impl LayoutThread {
|
|||
|
||||
self.update_iframe_sizes(display_list.iframe_sizes);
|
||||
|
||||
if self.trace_layout {
|
||||
if self.debug.trace_layout {
|
||||
layout_debug::end_trace(self.generation.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -46,15 +46,6 @@ pub trait LayoutThreadFactory {
|
|||
webrender_api_sender: WebrenderIpcSender,
|
||||
paint_time_metrics: PaintTimeMetrics,
|
||||
busy: Arc<AtomicBool>,
|
||||
load_webfonts_synchronously: bool,
|
||||
window_size: WindowSizeData,
|
||||
dump_display_list: bool,
|
||||
dump_display_list_json: bool,
|
||||
dump_style_tree: bool,
|
||||
dump_rule_tree: bool,
|
||||
relayout_event: bool,
|
||||
nonincremental_layout: bool,
|
||||
trace_layout: bool,
|
||||
dump_flow_tree: bool,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ pub fn profile<T, F>(
|
|||
where
|
||||
F: FnOnce() -> T,
|
||||
{
|
||||
if opts::get().signpost {
|
||||
if opts::get().debug.signpost {
|
||||
signpost::start(category as u32, &[0, 0, 0, (category as usize) >> 4]);
|
||||
}
|
||||
let start_time = precise_time_ns();
|
||||
|
@ -141,7 +141,7 @@ where
|
|||
let val = callback();
|
||||
|
||||
let end_time = precise_time_ns();
|
||||
if opts::get().signpost {
|
||||
if opts::get().debug.signpost {
|
||||
signpost::end(category as u32, &[0, 0, 0, (category as usize) >> 4]);
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ pub unsafe fn jsstring_to_str(cx: *mut JSContext, s: *mut JSString) -> DOMString
|
|||
please comment on https://github.com/servo/servo/issues/6564"
|
||||
};
|
||||
}
|
||||
if opts::get().replace_surrogates {
|
||||
if opts::get().debug.replace_surrogates {
|
||||
error!(message!());
|
||||
s.push('\u{FFFD}');
|
||||
} else {
|
||||
|
|
|
@ -483,7 +483,7 @@ unsafe fn new_rt_and_cx_with_parent(
|
|||
JS_SetGCCallback(cx, Some(debug_gc_callback), ptr::null_mut());
|
||||
}
|
||||
|
||||
if opts::get().gc_profile {
|
||||
if opts::get().debug.gc_profile {
|
||||
SetGCSliceCallback(cx, Some(gc_slice_callback));
|
||||
}
|
||||
|
||||
|
|
|
@ -755,15 +755,6 @@ impl ScriptThreadFactory for ScriptThread {
|
|||
fn create(
|
||||
state: InitialScriptState,
|
||||
load_data: LoadData,
|
||||
profile_script_events: bool,
|
||||
print_pwm: bool,
|
||||
relayout_event: bool,
|
||||
prepare_for_screenshot: bool,
|
||||
unminify_js: bool,
|
||||
local_script_source: Option<String>,
|
||||
userscripts_path: Option<String>,
|
||||
headless: bool,
|
||||
replace_surrogates: bool,
|
||||
user_agent: Cow<'static, str>,
|
||||
) -> (Sender<message::Msg>, Receiver<message::Msg>) {
|
||||
let (script_chan, script_port) = unbounded();
|
||||
|
@ -788,21 +779,8 @@ impl ScriptThreadFactory for ScriptThread {
|
|||
let window_size = state.window_size;
|
||||
let layout_is_busy = state.layout_is_busy.clone();
|
||||
|
||||
let script_thread = ScriptThread::new(
|
||||
state,
|
||||
script_port,
|
||||
script_chan.clone(),
|
||||
profile_script_events,
|
||||
print_pwm,
|
||||
relayout_event,
|
||||
prepare_for_screenshot,
|
||||
unminify_js,
|
||||
local_script_source,
|
||||
userscripts_path,
|
||||
headless,
|
||||
replace_surrogates,
|
||||
user_agent,
|
||||
);
|
||||
let script_thread =
|
||||
ScriptThread::new(state, script_port, script_chan.clone(), user_agent);
|
||||
|
||||
SCRIPT_THREAD_ROOT.with(|root| {
|
||||
root.set(Some(&script_thread as *const _));
|
||||
|
@ -1273,17 +1251,12 @@ impl ScriptThread {
|
|||
state: InitialScriptState,
|
||||
port: Receiver<MainThreadScriptMsg>,
|
||||
chan: Sender<MainThreadScriptMsg>,
|
||||
profile_script_events: bool,
|
||||
print_pwm: bool,
|
||||
relayout_event: bool,
|
||||
prepare_for_screenshot: bool,
|
||||
unminify_js: bool,
|
||||
local_script_source: Option<String>,
|
||||
userscripts_path: Option<String>,
|
||||
headless: bool,
|
||||
replace_surrogates: bool,
|
||||
user_agent: Cow<'static, str>,
|
||||
) -> ScriptThread {
|
||||
let opts = opts::get();
|
||||
let prepare_for_screenshot =
|
||||
opts.output_file.is_some() || opts.exit_after_load || opts.webdriver_port.is_some();
|
||||
|
||||
let boxed_script_sender = Box::new(MainThreadScriptChan(chan.clone()));
|
||||
|
||||
let runtime = new_rt_and_cx(Some(NetworkingTaskSource(
|
||||
|
@ -1392,17 +1365,17 @@ impl ScriptThread {
|
|||
webrender_document: state.webrender_document,
|
||||
webrender_api_sender: state.webrender_api_sender,
|
||||
|
||||
profile_script_events,
|
||||
print_pwm,
|
||||
profile_script_events: opts.debug.profile_script_events,
|
||||
print_pwm: opts.print_pwm,
|
||||
relayout_event: opts.debug.relayout_event,
|
||||
|
||||
relayout_event,
|
||||
prepare_for_screenshot,
|
||||
unminify_js,
|
||||
local_script_source,
|
||||
unminify_js: opts.unminify_js,
|
||||
local_script_source: opts.local_script_source.clone(),
|
||||
|
||||
userscripts_path,
|
||||
headless,
|
||||
replace_surrogates,
|
||||
userscripts_path: opts.userscripts.clone(),
|
||||
headless: opts.headless,
|
||||
replace_surrogates: opts.debug.replace_surrogates,
|
||||
user_agent,
|
||||
player_context: state.player_context,
|
||||
event_loop_waker: state.event_loop_waker,
|
||||
|
|
|
@ -700,15 +700,6 @@ pub trait ScriptThreadFactory {
|
|||
fn create(
|
||||
state: InitialScriptState,
|
||||
load_data: LoadData,
|
||||
profile_script_events: bool,
|
||||
print_pwm: bool,
|
||||
relayout_event: bool,
|
||||
prepare_for_screenshot: bool,
|
||||
unminify_js: bool,
|
||||
local_script_source: Option<String>,
|
||||
userscripts_path: Option<String>,
|
||||
headless: bool,
|
||||
replace_surrogates: bool,
|
||||
user_agent: Cow<'static, str>,
|
||||
) -> (Sender<Self::Message>, Receiver<Self::Message>);
|
||||
}
|
||||
|
|
|
@ -293,9 +293,9 @@ where
|
|||
use std::sync::atomic::Ordering;
|
||||
|
||||
style::context::DEFAULT_DISABLE_STYLE_SHARING_CACHE
|
||||
.store(opts.disable_share_style_cache, Ordering::Relaxed);
|
||||
.store(opts.debug.disable_share_style_cache, Ordering::Relaxed);
|
||||
style::context::DEFAULT_DUMP_STYLE_STATISTICS
|
||||
.store(opts.style_sharing_stats, Ordering::Relaxed);
|
||||
.store(opts.debug.dump_style_statistics, Ordering::Relaxed);
|
||||
style::traversal::IS_SERVO_NONINCREMENTAL_LAYOUT
|
||||
.store(opts.nonincremental_layout, Ordering::Relaxed);
|
||||
|
||||
|
@ -374,7 +374,10 @@ where
|
|||
|
||||
let (mut webrender, webrender_api_sender) = {
|
||||
let mut debug_flags = webrender::DebugFlags::empty();
|
||||
debug_flags.set(webrender::DebugFlags::PROFILER_DBG, opts.webrender_stats);
|
||||
debug_flags.set(
|
||||
webrender::DebugFlags::PROFILER_DBG,
|
||||
opts.debug.webrender_stats,
|
||||
);
|
||||
|
||||
let render_notifier = Box::new(RenderNotifier::new(compositor_proxy.clone()));
|
||||
|
||||
|
@ -387,14 +390,15 @@ where
|
|||
webrender::RendererOptions {
|
||||
device_pixel_ratio,
|
||||
resource_override_path: opts.shaders_dir.clone(),
|
||||
enable_aa: opts.enable_text_antialiasing,
|
||||
enable_aa: !opts.debug.disable_text_antialiasing,
|
||||
debug_flags: debug_flags,
|
||||
precache_flags: if opts.precache_shaders {
|
||||
precache_flags: if opts.debug.precache_shaders {
|
||||
ShaderPrecacheFlags::FULL_COMPILE
|
||||
} else {
|
||||
ShaderPrecacheFlags::empty()
|
||||
},
|
||||
enable_subpixel_aa: opts.enable_subpixel_text_antialiasing,
|
||||
enable_subpixel_aa: pref!(gfx.subpixel_text_antialiasing.enabled) &&
|
||||
!opts.debug.disable_subpixel_text_antialiasing,
|
||||
allow_texture_swizzling: pref!(gfx.texture_swizzling.enabled),
|
||||
clear_color: None,
|
||||
..Default::default()
|
||||
|
@ -542,7 +546,7 @@ where
|
|||
opts.output_file.clone(),
|
||||
opts.is_running_problem_test,
|
||||
opts.exit_after_load,
|
||||
opts.convert_mouse_to_touch,
|
||||
opts.debug.convert_mouse_to_touch,
|
||||
browser_id,
|
||||
);
|
||||
|
||||
|
@ -936,7 +940,7 @@ fn create_constellation(
|
|||
opts.random_pipeline_closure_seed,
|
||||
opts.is_running_problem_test,
|
||||
opts.hard_fail,
|
||||
opts.enable_canvas_antialiasing,
|
||||
!opts.debug.disable_canvas_antialiasing,
|
||||
canvas_chan,
|
||||
ipc_canvas_chan,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue