diff options
Diffstat (limited to 'components/layout/layout_debug.rs')
-rw-r--r-- | components/layout/layout_debug.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index f16a18e1dfb..94ddad456f6 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -14,7 +14,7 @@ use std::cell::RefCell; use std::io::File; use std::sync::atomic::{AtomicUint, SeqCst, INIT_ATOMIC_UINT}; -thread_local!(static state_key: RefCell<Option<State>> = RefCell::new(None)) +thread_local!(static STATE_KEY: RefCell<Option<State>> = RefCell::new(None)) static mut DEBUG_ID_COUNTER: AtomicUint = INIT_ATOMIC_UINT; @@ -59,7 +59,7 @@ struct State { /// will be output at the beginning and end of this scope. impl Scope { pub fn new(name: String) -> Scope { - state_key.with(|ref r| { + STATE_KEY.with(|ref r| { match &mut *r.borrow_mut() { &Some(ref mut state) => { let flow_trace = json::encode(&flow::base(state.flow_root.deref())); @@ -76,7 +76,7 @@ impl Scope { #[cfg(not(ndebug))] impl Drop for Scope { fn drop(&mut self) { - state_key.with(|ref r| { + STATE_KEY.with(|ref r| { match &mut *r.borrow_mut() { &Some(ref mut state) => { let mut current_scope = state.scope_stack.pop().unwrap(); @@ -100,9 +100,9 @@ pub fn generate_unique_debug_id() -> u16 { /// Begin a layout debug trace. If this has not been called, /// creating debug scopes has no effect. pub fn begin_trace(flow_root: FlowRef) { - assert!(state_key.with(|ref r| r.borrow().is_none())); + assert!(STATE_KEY.with(|ref r| r.borrow().is_none())); - state_key.with(|ref r| { + STATE_KEY.with(|ref r| { let flow_trace = json::encode(&flow::base(flow_root.deref())); let state = State { scope_stack: vec![box ScopeData::new("root".into_string(), flow_trace)], @@ -116,7 +116,7 @@ pub fn begin_trace(flow_root: FlowRef) { /// trace to disk in the current directory. The output /// file can then be viewed with an external tool. pub fn end_trace() { - let mut task_state = state_key.with(|ref r| r.borrow_mut().take().unwrap()); + let mut task_state = STATE_KEY.with(|ref r| r.borrow_mut().take().unwrap()); assert!(task_state.scope_stack.len() == 1); let mut root_scope = task_state.scope_stack.pop().unwrap(); root_scope.post = json::encode(&flow::base(task_state.flow_root.deref())); |