aboutsummaryrefslogtreecommitdiffstats
path: root/components/util
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-02-20 16:46:17 -0800
committerPatrick Walton <pcwalton@mimiga.net>2015-02-20 19:11:35 -0800
commit40a3b417580f1050c63acf890ed5aaefb6197d1a (patch)
tree5ead5acf386c4f99e30da2c203065e362f247dde /components/util
parent172db80703fc19ff078f2f46fb299cadd99a483b (diff)
downloadservo-40a3b417580f1050c63acf890ed5aaefb6197d1a.tar.gz
servo-40a3b417580f1050c63acf890ed5aaefb6197d1a.zip
layout: Add an option to visualize parallel layout
Diffstat (limited to 'components/util')
-rw-r--r--components/util/opts.rs9
-rw-r--r--components/util/workqueue.rs8
2 files changed, 16 insertions, 1 deletions
diff --git a/components/util/opts.rs b/components/util/opts.rs
index d868d47dd92..baad6654b8b 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -72,12 +72,16 @@ pub struct Opts {
/// debugging purposes (`--show-debug-borders`).
pub show_debug_borders: bool,
- /// True if we should show borders on all fragments for debugging purposes (`--show-debug-fragment-borders`).
+ /// 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 tiles with overlays based on which thread painted them.
pub show_debug_parallel_paint: 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.
@@ -132,6 +136,7 @@ pub fn print_debug_usage(app: &str) {
print_option("show-compositor-borders", "Paint borders along layer and tile boundaries.");
print_option("show-fragment-borders", "Paint borders along fragment boundaries.");
print_option("show-parallel-paint", "Overlay tiles with colors showing which thread painted them.");
+ 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("validate-display-list-geometry",
"Display an error when display list geometry escapes overflow region.");
@@ -171,6 +176,7 @@ pub fn default_opts() -> Opts {
show_debug_borders: false,
show_debug_fragment_borders: false,
show_debug_parallel_paint: false,
+ show_debug_parallel_layout: false,
enable_text_antialiasing: false,
trace_layout: false,
devtools_port: None,
@@ -321,6 +327,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
show_debug_borders: debug_options.contains(&"show-compositor-borders"),
show_debug_fragment_borders: debug_options.contains(&"show-fragment-borders"),
show_debug_parallel_paint: debug_options.contains(&"show-parallel-paint"),
+ show_debug_parallel_layout: debug_options.contains(&"show-parallel-layout"),
enable_text_antialiasing: !debug_options.contains(&"disable-text-aa"),
dump_flow_tree: debug_options.contains(&"dump-flow-tree"),
validate_display_list_geometry: debug_options.contains(&"validate-display-list-geometry"),
diff --git a/components/util/workqueue.rs b/components/util/workqueue.rs
index 69fbce97b7e..ad39b1e349f 100644
--- a/components/util/workqueue.rs
+++ b/components/util/workqueue.rs
@@ -157,6 +157,7 @@ impl<QueueData: Send, WorkData: Send> WorkerThread<QueueData, WorkData> {
worker: &mut deque,
ref_count: ref_count,
queue_data: queue_data,
+ worker_index: self.index as u8,
};
(work_unit.fun)(work_unit.data, &mut proxy);
@@ -180,6 +181,7 @@ pub struct WorkerProxy<'a, QueueData: 'a, WorkData: 'a> {
worker: &'a mut Worker<WorkUnit<QueueData, WorkData>>,
ref_count: *mut AtomicUint,
queue_data: *const QueueData,
+ worker_index: u8,
}
impl<'a, QueueData: 'static, WorkData: Send> WorkerProxy<'a, QueueData, WorkData> {
@@ -199,6 +201,12 @@ impl<'a, QueueData: 'static, WorkData: Send> WorkerProxy<'a, QueueData, WorkData
mem::transmute(self.queue_data)
}
}
+
+ /// Retrieves the index of the worker.
+ #[inline]
+ pub fn worker_index(&self) -> u8 {
+ self.worker_index
+ }
}
/// A work queue on which units of work can be submitted.