aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/layout/layout_debug.rs
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2014-09-05 08:37:42 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2014-09-05 09:41:43 +1000
commita0854080ccbcdd1e1af7ef35e04865a436fb70be (patch)
tree521dded4ce53e6299027943c6ecc4ffde22a4071 /src/components/layout/layout_debug.rs
parentacedb166707aa2e8fd02e6c7d943147394c34609 (diff)
downloadservo-a0854080ccbcdd1e1af7ef35e04865a436fb70be.tar.gz
servo-a0854080ccbcdd1e1af7ef35e04865a436fb70be.zip
Change scope macro to be a no-op in release builds.
Diffstat (limited to 'src/components/layout/layout_debug.rs')
-rw-r--r--src/components/layout/layout_debug.rs14
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();