Skip to content

Commit

Permalink
Create separate layout trace file for each reflow
Browse files Browse the repository at this point in the history
  • Loading branch information
shinglyu committed Sep 9, 2016
1 parent bba3eef commit fc87319
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions components/layout/layout_debug.rs
Expand Up @@ -121,13 +121,13 @@ pub fn begin_trace(flow_root: FlowRef) {
/// End the debug layout trace. This will write the layout
/// trace to disk in the current directory. The output
/// file can then be viewed with an external tool.
pub fn end_trace() {
pub fn end_trace(generation: u32) {
let mut thread_state = STATE_KEY.with(|ref r| r.borrow_mut().take().unwrap());
assert!(thread_state.scope_stack.len() == 1);
let mut root_scope = thread_state.scope_stack.pop().unwrap();
root_scope.post = json::encode(&flow::base(&*thread_state.flow_root)).unwrap();

let result = json::encode(&root_scope).unwrap();
let mut file = File::create("layout_trace.json").unwrap();
let mut file = File::create(format!("layout_trace-{}.json", generation)).unwrap();
file.write_all(result.as_bytes()).unwrap();
}
2 changes: 1 addition & 1 deletion components/layout_thread/lib.rs
Expand Up @@ -1522,7 +1522,7 @@ impl LayoutThread {
self.first_reflow = false;

if opts::get().trace_layout {
layout_debug::end_trace();
layout_debug::end_trace(self.generation);
}

if opts::get().dump_flow_tree {
Expand Down

0 comments on commit fc87319

Please sign in to comment.