mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Change scope macro to be a no-op in release builds.
This commit is contained in:
parent
acedb16670
commit
a0854080cc
5 changed files with 25 additions and 10 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue