aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/layout_debug.rs
diff options
context:
space:
mode:
authorMitchell Hentges <mitchhentges@protonmail.com>2016-05-26 18:36:19 +0200
committerMitchell Hentges <mitchhentges@protonmail.com>2016-06-04 19:19:42 +0200
commit43396c027dcbc357f0fef674e55f9413f56f7535 (patch)
tree6d98fdc1512542243d072af548821c2910851893 /components/layout/layout_debug.rs
parentd890453f786e2f6aa37095d9ed298cd11be0854d (diff)
downloadservo-43396c027dcbc357f0fef674e55f9413f56f7535.tar.gz
servo-43396c027dcbc357f0fef674e55f9413f56f7535.zip
Fragment debug_id u16 only exists in debug, prod will format mem address
Diffstat (limited to 'components/layout/layout_debug.rs')
-rw-r--r--components/layout/layout_debug.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs
index 90b5870e468..20e8a16714b 100644
--- a/components/layout/layout_debug.rs
+++ b/components/layout/layout_debug.rs
@@ -15,10 +15,12 @@ use std::borrow::ToOwned;
use std::cell::RefCell;
use std::fs::File;
use std::io::Write;
+#[cfg(debug_assertions)]
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
thread_local!(static STATE_KEY: RefCell<Option<State>> = RefCell::new(None));
+#[cfg(debug_assertions)]
static DEBUG_ID_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
pub struct Scope;
@@ -96,6 +98,7 @@ impl Drop for Scope {
/// Generate a unique ID. This is used for items such as Fragment
/// which are often reallocated but represent essentially the
/// same data.
+#[cfg(debug_assertions)]
pub fn generate_unique_debug_id() -> u16 {
DEBUG_ID_COUNTER.fetch_add(1, Ordering::SeqCst) as u16
}