Clean up debug options

This commit is contained in:
Martin Robinson 2023-04-28 08:58:18 +02:00
parent 3e3bd9c728
commit dc192172ad
10 changed files with 172 additions and 308 deletions

View file

@ -58,55 +58,14 @@ pub struct Opts {
pub output_file: Option<String>, 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, pub headless: bool,
/// True to exit on thread failure instead of displaying about:failure. /// True to exit on thread failure instead of displaying about:failure.
pub hard_fail: bool, pub hard_fail: bool,
/// True if we should bubble intrinsic widths sequentially (`-b`). If this is true, then /// Debug options that are used by developers to control Servo
/// intrinsic widths are computed as a separate pass instead of during flow construction. You /// behavior for debugging purposes.
/// may wish to turn this flag on in order to benchmark style recalculation against other pub debug: DebugOptions,
/// 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,
/// Port number to start a server to listen to remote Firefox devtools connections. /// Port number to start a server to listen to remote Firefox devtools connections.
/// 0 for random port. /// 0 for random port.
@ -139,63 +98,15 @@ pub struct Opts {
/// used for testing the hardening of the constellation. /// used for testing the hardening of the constellation.
pub random_pipeline_closure_seed: Option<usize>, 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`). /// True to exit after the page load (`-x`).
pub exit_after_load: bool, 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. /// Load shaders from disk.
pub shaders_dir: Option<PathBuf>, 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 /// Directory for a default config directory
pub config_dir: Option<PathBuf>, 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. /// Print the version and exit.
pub is_printing_version: bool, 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 /// Debug options for Servo, currently set on the command line with -Z
#[derive(Default)] #[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct DebugOptions { pub struct DebugOptions {
/// List all the debug options. /// List all the debug options.
pub help: bool, pub help: bool,
/// Bubble intrinsic widths separately like other engines. /// True if we should bubble intrinsic widths sequentially. If this is true,
pub bubble_widths: bool, /// 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. /// If set with `disable-text-aa`, disable antialiasing on fonts. This is
pub disable_text_aa: bool, /// 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. /// 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. /// 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. /// Print the DOM after each restyle.
pub dump_style_tree: bool, pub dump_style_tree: bool,
@ -256,7 +175,7 @@ pub struct DebugOptions {
/// Print notifications when there is a relayout. /// Print notifications when there is a relayout.
pub relayout_event: bool, 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, pub profile_script_events: bool,
/// Paint borders along fragment boundaries. /// Paint borders along fragment boundaries.
@ -265,14 +184,16 @@ pub struct DebugOptions {
/// Mark which thread laid each flow out with colors. /// Mark which thread laid each flow out with colors.
pub show_parallel_layout: bool, 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, pub trace_layout: bool,
/// Disable the style sharing cache. /// Disable the style sharing cache.
pub disable_share_style_cache: bool, pub disable_share_style_cache: bool,
/// Whether to show in stdout style sharing cache stats after a restyle. /// 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. /// Translate mouse input into touch events.
pub convert_mouse_to_touch: bool, pub convert_mouse_to_touch: bool,
@ -290,15 +211,6 @@ pub struct DebugOptions {
/// Show webrender profiling stats on screen. /// Show webrender profiling stats on screen.
pub webrender_stats: bool, 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 /// True to compile all webrender shaders at init time. This is mostly
/// useful when modifying the shaders, to ensure they all compile /// useful when modifying the shaders, to ensure they all compile
/// after each change is made. /// after each change is made.
@ -314,127 +226,131 @@ impl DebugOptions {
for option in debug_string.split(',') { for option in debug_string.split(',') {
match option { match option {
"help" => self.help = true, "help" => self.help = true,
"bubble-widths" => self.bubble_widths = true, "bubble-inline-sizes-separately" => self.bubble_inline_sizes_separately = true,
"disable-text-aa" => self.disable_text_aa = true, "convert-mouse-to-touch" => self.convert_mouse_to_touch = true,
"disable-subpixel-aa" => self.disable_subpixel_aa = true, "disable-canvas-aa" => self.disable_canvas_antialiasing = true,
"disable-canvas-aa" => self.disable_text_aa = true, "disable-share-style-cache" => self.disable_share_style_cache = true,
"dump-style-tree" => self.dump_style_tree = true, "disable-subpixel-aa" => self.disable_subpixel_text_antialiasing = true,
"dump-rule-tree" => self.dump_rule_tree = true, "disable-text-aa" => self.disable_text_antialiasing = true,
"dump-flow-tree" => self.dump_flow_tree = true,
"dump-display-list" => self.dump_display_list = true, "dump-display-list" => self.dump_display_list = true,
"dump-display-list-json" => self.dump_display_list_json = true, "dump-display-list-json" => self.dump_display_list_json = true,
"relayout-event" => self.relayout_event = true, "dump-flow-tree" => self.dump_flow_tree = true,
"profile-script-events" => self.profile_script_events = true, "dump-rule-tree" => self.dump_rule_tree = true,
"show-fragment-borders" => self.show_fragment_borders = true, "dump-style-tree" => self.dump_style_tree = 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,
"gc-profile" => self.gc_profile = true, "gc-profile" => self.gc_profile = true,
"load-webfonts-synchronously" => self.load_webfonts_synchronously = 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, "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, "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)), _ => return Err(String::from(option)),
}; };
} }
if self.trace_layout {
self.bubble_inline_sizes_separately = true;
}
Ok(()) Ok(())
} }
}
fn print_debug_usage(app: &str) -> ! { fn print_usage(app: &str) {
fn print_option(name: &str, description: &str) { fn print_option(name: &str, description: &str) {
println!("\t{:<35} {}", name, description); println!("\t{:<35} {}", name, description);
}
println!(
"Usage: {} debug option,[options,...]\n\twhere options include\n\nOptions:",
app
);
print_option(
"bubble-inline-sizes-separately",
"Bubble intrinsic widths separately like other engines.",
);
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(
"disable-share-style-cache",
"Disable the style sharing cache.",
);
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.",
);
print_option(
"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(
"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.",
);
print_option(
"show-parallel-layout",
"Mark which thread laid each flow out with colors.",
);
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)
} }
println!(
"Usage: {} debug option,[options,...]\n\twhere options include\n\nOptions:",
app
);
print_option(
"bubble-widths",
"Bubble intrinsic widths separately like other engines.",
);
print_option("disable-text-aa", "Disable antialiasing of rendered text.");
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.",
);
print_option("dump-flow-tree", "Print the flow tree after each layout.");
print_option(
"dump-display-list",
"Print the display list after each layout.",
);
print_option(
"dump-display-list-json",
"Print the display list in JSON form.",
);
print_option(
"relayout-event",
"Print notifications when there is a relayout.",
);
print_option(
"profile-script-events",
"Enable profiling of script-related events.",
);
print_option(
"show-fragment-borders",
"Paint borders along fragment boundaries.",
);
print_option(
"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)",
);
println!();
process::exit(0)
} }
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
@ -468,18 +384,8 @@ pub fn default_opts() -> Opts {
userscripts: None, userscripts: None,
user_stylesheets: Vec::new(), user_stylesheets: Vec::new(),
output_file: None, output_file: None,
replace_surrogates: false,
gc_profile: false,
load_webfonts_synchronously: false,
headless: false, headless: false,
hard_fail: true, 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_port: 0,
devtools_server_enabled: false, devtools_server_enabled: false,
webdriver_port: None, webdriver_port: None,
@ -489,26 +395,11 @@ pub fn default_opts() -> Opts {
random_pipeline_closure_probability: None, random_pipeline_closure_probability: None,
random_pipeline_closure_seed: None, random_pipeline_closure_seed: None,
sandbox: false, sandbox: false,
dump_style_tree: false, debug: Default::default(),
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,
exit_after_load: false, exit_after_load: false,
webrender_stats: false,
config_dir: None, config_dir: None,
full_backtraces: false,
is_printing_version: false, is_printing_version: false,
webrender_record: false,
webrender_batch: true,
shaders_dir: None, shaders_dir: None,
precache_shaders: false,
signpost: false,
certificate_path: None, certificate_path: None,
unminify_js: false, unminify_js: false,
local_script_source: None, 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(); let mut debug_options = DebugOptions::default();
for debug_string in opt_match.opt_strs("Z") { for debug_string in opt_match.opt_strs("Z") {
if let Err(e) = debug_options.extend(debug_string) { if let Err(e) = debug_options.extend(debug_string) {
args_fail(&format!("error: unrecognized debug option: {}", e)); 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 { if debug_options.help {
print_debug_usage(app_name) DebugOptions::print_usage(app_name)
} }
let cwd = env::current_dir().unwrap(); 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 { if debug_options.trace_layout {
layout_threads = Some(1); layout_threads = Some(1);
bubble_inline_sizes_separately = true;
} }
let (devtools_server_enabled, devtools_port) = if opt_match.opt_present("devtools") { 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(); .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 is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version");
let opts = Opts { let opts = Opts {
debug: debug_options.clone(),
is_running_problem_test, is_running_problem_test,
url: url_opt, url: url_opt,
tile_size, tile_size,
@ -857,14 +743,8 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
userscripts: opt_match.opt_default("userscripts", ""), userscripts: opt_match.opt_default("userscripts", ""),
user_stylesheets, user_stylesheets,
output_file: opt_match.opt_str("o"), 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"), headless: opt_match.opt_present("z"),
hard_fail: opt_match.opt_present("f") && !opt_match.opt_present("F"), 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_port,
devtools_server_enabled, devtools_server_enabled,
webdriver_port, webdriver_port,
@ -874,30 +754,10 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
sandbox: opt_match.opt_present("S"), sandbox: opt_match.opt_present("S"),
random_pipeline_closure_probability, random_pipeline_closure_probability,
random_pipeline_closure_seed, 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"), 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), config_dir: opt_match.opt_str("config-dir").map(Into::into),
full_backtraces: debug_options.full_backtraces,
is_printing_version, 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), 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"), certificate_path: opt_match.opt_str("certificate-path"),
unminify_js: opt_match.opt_present("unminify-js"), unminify_js: opt_match.opt_present("unminify-js"),
local_script_source: opt_match.opt_str("local-script-source"), local_script_source: opt_match.opt_str("local-script-source"),

View file

@ -576,9 +576,9 @@ impl UnprivilegedPipelineContent {
inherited_secure_context: self.load_data.inherited_secure_context.clone(), inherited_secure_context: self.load_data.inherited_secure_context.clone(),
}, },
self.load_data.clone(), self.load_data.clone(),
self.opts.profile_script_events, self.opts.debug.profile_script_events,
self.opts.print_pwm, self.opts.print_pwm,
self.opts.relayout_event, self.opts.debug.relayout_event,
self.opts.output_file.is_some() || self.opts.output_file.is_some() ||
self.opts.exit_after_load || self.opts.exit_after_load ||
self.opts.webdriver_port.is_some(), self.opts.webdriver_port.is_some(),
@ -586,7 +586,7 @@ impl UnprivilegedPipelineContent {
self.opts.local_script_source, self.opts.local_script_source,
self.opts.userscripts, self.opts.userscripts,
self.opts.headless, self.opts.headless,
self.opts.replace_surrogates, self.opts.debug.replace_surrogates,
self.user_agent, self.user_agent,
); );
@ -607,16 +607,16 @@ impl UnprivilegedPipelineContent {
self.webrender_api_sender, self.webrender_api_sender,
paint_time_metrics, paint_time_metrics,
layout_thread_busy_flag.clone(), layout_thread_busy_flag.clone(),
self.opts.load_webfonts_synchronously, self.opts.debug.load_webfonts_synchronously,
self.window_size, self.window_size,
self.opts.dump_display_list, self.opts.debug.dump_display_list,
self.opts.dump_display_list_json, self.opts.debug.dump_display_list_json,
self.opts.dump_style_tree, self.opts.debug.dump_style_tree,
self.opts.dump_rule_tree, self.opts.debug.dump_rule_tree,
self.opts.relayout_event, self.opts.debug.relayout_event,
self.opts.nonincremental_layout, self.opts.nonincremental_layout,
self.opts.trace_layout, self.opts.debug.trace_layout,
self.opts.dump_flow_tree, self.opts.debug.dump_flow_tree,
); );
if wait_for_completion { if wait_for_completion {

View file

@ -2068,7 +2068,7 @@ impl FlowRef {
/// All flows must be finished at some point, or they will not have their intrinsic inline-sizes /// 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.) /// properly computed. (This is not, however, a memory safety problem.)
fn finish(&mut self) { 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).bubble_inline_sizes();
FlowRef::deref_mut(self) FlowRef::deref_mut(self)
.mut_base() .mut_base()

View file

@ -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) self.build_debug_borders_around_fragment(state, stacking_relative_border_box, clip)
} }
} }
@ -1772,7 +1772,7 @@ impl Fragment {
clip, clip,
); );
if opts::get().show_debug_fragment_borders { if opts::get().debug.show_fragment_borders {
self.build_debug_borders_around_text_fragments( self.build_debug_borders_around_text_fragments(
state, state,
self.style(), self.style(),
@ -1793,7 +1793,7 @@ impl Fragment {
clip, clip,
); );
if opts::get().show_debug_fragment_borders { if opts::get().debug.show_fragment_borders {
self.build_debug_borders_around_text_fragments( self.build_debug_borders_around_text_fragments(
state, state,
self.style(), self.style(),
@ -1817,7 +1817,7 @@ impl Fragment {
SpecificFragmentInfo::InlineAbsolute(_) | SpecificFragmentInfo::InlineAbsolute(_) |
SpecificFragmentInfo::TruncatedFragment(_) | SpecificFragmentInfo::TruncatedFragment(_) |
SpecificFragmentInfo::Svg(_) => { SpecificFragmentInfo::Svg(_) => {
if opts::get().show_debug_fragment_borders { if opts::get().debug.show_fragment_borders {
self.build_debug_borders_around_fragment( self.build_debug_borders_around_fragment(
state, state,
stacking_relative_border_box, stacking_relative_border_box,
@ -2885,7 +2885,7 @@ impl BaseFlow {
state: &mut DisplayListBuildState, state: &mut DisplayListBuildState,
node: OpaqueNode, node: OpaqueNode,
) { ) {
if !opts::get().show_debug_parallel_layout { if !opts::get().debug.show_parallel_layout {
return; return;
} }

View file

@ -196,7 +196,7 @@ pub fn reflow(
context: &LayoutContext, context: &LayoutContext,
queue: &rayon::ThreadPool, queue: &rayon::ThreadPool,
) { ) {
if opts::get().bubble_inline_sizes_separately { if opts::get().debug.bubble_inline_sizes_separately {
let bubble_inline_sizes = BubbleISizes { let bubble_inline_sizes = BubbleISizes {
layout_context: &context, layout_context: &context,
}; };

View file

@ -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 { let bubble_inline_sizes = BubbleISizes {
layout_context: &layout_context, layout_context: &layout_context,
}; };

View file

@ -133,7 +133,7 @@ pub fn profile<T, F>(
where where
F: FnOnce() -> T, F: FnOnce() -> T,
{ {
if opts::get().signpost { if opts::get().debug.signpost {
signpost::start(category as u32, &[0, 0, 0, (category as usize) >> 4]); signpost::start(category as u32, &[0, 0, 0, (category as usize) >> 4]);
} }
let start_time = precise_time_ns(); let start_time = precise_time_ns();
@ -141,7 +141,7 @@ where
let val = callback(); let val = callback();
let end_time = precise_time_ns(); 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]); signpost::end(category as u32, &[0, 0, 0, (category as usize) >> 4]);
} }

View file

@ -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" please comment on https://github.com/servo/servo/issues/6564"
}; };
} }
if opts::get().replace_surrogates { if opts::get().debug.replace_surrogates {
error!(message!()); error!(message!());
s.push('\u{FFFD}'); s.push('\u{FFFD}');
} else { } else {

View file

@ -483,7 +483,7 @@ unsafe fn new_rt_and_cx_with_parent(
JS_SetGCCallback(cx, Some(debug_gc_callback), ptr::null_mut()); 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)); SetGCSliceCallback(cx, Some(gc_slice_callback));
} }

View file

@ -293,9 +293,9 @@ where
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
style::context::DEFAULT_DISABLE_STYLE_SHARING_CACHE 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 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 style::traversal::IS_SERVO_NONINCREMENTAL_LAYOUT
.store(opts.nonincremental_layout, Ordering::Relaxed); .store(opts.nonincremental_layout, Ordering::Relaxed);
@ -374,7 +374,10 @@ where
let (mut webrender, webrender_api_sender) = { let (mut webrender, webrender_api_sender) = {
let mut debug_flags = webrender::DebugFlags::empty(); 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())); let render_notifier = Box::new(RenderNotifier::new(compositor_proxy.clone()));
@ -387,14 +390,15 @@ where
webrender::RendererOptions { webrender::RendererOptions {
device_pixel_ratio, device_pixel_ratio,
resource_override_path: opts.shaders_dir.clone(), resource_override_path: opts.shaders_dir.clone(),
enable_aa: opts.enable_text_antialiasing, enable_aa: !opts.debug.disable_text_antialiasing,
debug_flags: debug_flags, debug_flags: debug_flags,
precache_flags: if opts.precache_shaders { precache_flags: if opts.debug.precache_shaders {
ShaderPrecacheFlags::FULL_COMPILE ShaderPrecacheFlags::FULL_COMPILE
} else { } else {
ShaderPrecacheFlags::empty() 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), allow_texture_swizzling: pref!(gfx.texture_swizzling.enabled),
clear_color: None, clear_color: None,
..Default::default() ..Default::default()
@ -542,7 +546,7 @@ where
opts.output_file.clone(), opts.output_file.clone(),
opts.is_running_problem_test, opts.is_running_problem_test,
opts.exit_after_load, opts.exit_after_load,
opts.convert_mouse_to_touch, opts.debug.convert_mouse_to_touch,
browser_id, browser_id,
); );
@ -936,7 +940,7 @@ fn create_constellation(
opts.random_pipeline_closure_seed, opts.random_pipeline_closure_seed,
opts.is_running_problem_test, opts.is_running_problem_test,
opts.hard_fail, opts.hard_fail,
opts.enable_canvas_antialiasing, !opts.debug.disable_canvas_antialiasing,
canvas_chan, canvas_chan,
ipc_canvas_chan, ipc_canvas_chan,
); );