diff options
Diffstat (limited to 'src/components/layout/layout_debug.rs')
-rw-r--r-- | src/components/layout/layout_debug.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/components/layout/layout_debug.rs b/src/components/layout/layout_debug.rs index bf4cbbfca2a..58db599c9e2 100644 --- a/src/components/layout/layout_debug.rs +++ b/src/components/layout/layout_debug.rs @@ -5,6 +5,8 @@ //! Supports writing a trace file created during each layout scope //! that can be viewed by an external tool to make layout debugging easier. +#![macro_escape] + use flow_ref::FlowRef; use serialize::json; use std::cell::RefCell; @@ -17,6 +19,17 @@ static mut DEBUG_ID_COUNTER: AtomicUint = INIT_ATOMIC_UINT; pub struct Scope; +#[macro_export] +macro_rules! layout_debug_scope( + ($($arg:tt)*) => ( + if cfg!(not(ndebug)) { + layout_debug::Scope::new(format!($($arg)*)) + } else { + layout_debug::Scope + } + ) +) + #[deriving(Encodable)] struct ScopeData { name: String, @@ -59,6 +72,7 @@ impl Scope { } } +#[cfg(not(ndebug))] impl Drop for Scope { fn drop(&mut self) { let maybe_refcell = state_key.get(); |