mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +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
|
@ -811,7 +811,7 @@ impl BlockFlow {
|
|||
pub fn assign_block_size_block_base<'a>(&mut self,
|
||||
layout_context: &'a LayoutContext<'a>,
|
||||
margins_may_collapse: MarginsMayCollapseFlag) {
|
||||
let _scope = layout_debug::Scope::new(format!("assign_block_size_block_base {:s}", self.base.debug_id()));
|
||||
let _scope = layout_debug_scope!("assign_block_size_block_base {:s}", self.base.debug_id());
|
||||
|
||||
// Our current border-box position.
|
||||
let mut cur_b = Au(0);
|
||||
|
@ -1059,7 +1059,7 @@ impl BlockFlow {
|
|||
///
|
||||
/// It does not calculate the block-size of the flow itself.
|
||||
pub fn assign_block_size_float<'a>(&mut self, ctx: &'a LayoutContext<'a>) {
|
||||
let _scope = layout_debug::Scope::new(format!("assign_block_size_float {:s}", self.base.debug_id()));
|
||||
let _scope = layout_debug_scope!("assign_block_size_float {:s}", self.base.debug_id());
|
||||
|
||||
let mut floats = Floats::new(self.fragment.style.writing_mode);
|
||||
for kid in self.base.child_iter() {
|
||||
|
@ -1457,7 +1457,7 @@ impl Flow for BlockFlow {
|
|||
///
|
||||
/// TODO(pcwalton): Inline blocks.
|
||||
fn bubble_inline_sizes(&mut self, _: &LayoutContext) {
|
||||
let _scope = layout_debug::Scope::new(format!("block::bubble_inline_sizes {:s}", self.base.debug_id()));
|
||||
let _scope = layout_debug_scope!("bubble_inline_sizes {:s}", self.base.debug_id());
|
||||
|
||||
let mut flags = self.base.flags;
|
||||
flags.set_has_left_floated_descendants(false);
|
||||
|
@ -1503,7 +1503,7 @@ impl Flow for BlockFlow {
|
|||
/// Dual fragments consume some inline-size first, and the remainder is assigned to all child (block)
|
||||
/// contexts.
|
||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
let _scope = layout_debug::Scope::new(format!("block::assign_inline_sizes {:s}", self.base.debug_id()));
|
||||
let _scope = layout_debug_scope!("block::assign_inline_sizes {:s}", self.base.debug_id());
|
||||
|
||||
debug!("assign_inline_sizes({}): assigning inline_size for flow",
|
||||
if self.is_float() {
|
||||
|
|
|
@ -907,7 +907,7 @@ impl Flow for InlineFlow {
|
|||
}
|
||||
|
||||
fn bubble_inline_sizes(&mut self, _: &LayoutContext) {
|
||||
let _scope = layout_debug::Scope::new(format!("inline::bubble_inline_sizes {:s}", self.base.debug_id()));
|
||||
let _scope = layout_debug_scope!("inline::bubble_inline_sizes {:s}", self.base.debug_id());
|
||||
|
||||
let writing_mode = self.base.writing_mode;
|
||||
for kid in self.base.child_iter() {
|
||||
|
@ -934,7 +934,7 @@ impl Flow for InlineFlow {
|
|||
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments. When called
|
||||
/// on this context, the context has had its inline-size set by the parent context.
|
||||
fn assign_inline_sizes(&mut self, _: &LayoutContext) {
|
||||
let _scope = layout_debug::Scope::new(format!("inline::assign_inline_sizes {:s}", self.base.debug_id()));
|
||||
let _scope = layout_debug_scope!("inline::assign_inline_sizes {:s}", self.base.debug_id());
|
||||
|
||||
// Initialize content fragment inline-sizes if they haven't been initialized already.
|
||||
//
|
||||
|
@ -964,8 +964,7 @@ impl Flow for InlineFlow {
|
|||
|
||||
/// Calculate and set the block-size of this flow. See CSS 2.1 § 10.6.1.
|
||||
fn assign_block_size(&mut self, ctx: &LayoutContext) {
|
||||
let _scope = layout_debug::Scope::new(format!("inline::assign_block_size {:s}", self.base.debug_id()));
|
||||
debug!("assign_block_size_inline: assigning block_size for flow");
|
||||
let _scope = layout_debug_scope!("inline::assign_block_size {:s}", self.base.debug_id());
|
||||
|
||||
// Divide the fragments into lines.
|
||||
//
|
||||
|
|
|
@ -35,6 +35,9 @@ extern crate libc;
|
|||
extern crate sync;
|
||||
extern crate url;
|
||||
|
||||
// Listed first because of macro definitions
|
||||
pub mod layout_debug;
|
||||
|
||||
pub mod block;
|
||||
pub mod construct;
|
||||
pub mod context;
|
||||
|
@ -43,7 +46,6 @@ pub mod flow;
|
|||
pub mod flow_list;
|
||||
pub mod flow_ref;
|
||||
pub mod fragment;
|
||||
pub mod layout_debug;
|
||||
pub mod layout_task;
|
||||
pub mod inline;
|
||||
pub mod model;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -531,7 +531,7 @@ impl LayoutTask {
|
|||
fn solve_constraints<'a>(&mut self,
|
||||
layout_root: &mut Flow,
|
||||
layout_context: &'a LayoutContext<'a>) {
|
||||
let _scope = layout_debug::Scope::new("solve_constraints".to_string());
|
||||
let _scope = layout_debug_scope!("solve_constraints");
|
||||
|
||||
if layout_context.shared.opts.bubble_inline_sizes_separately {
|
||||
let mut traversal = BubbleISizesTraversal {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue