Gate all use of tracing behind Cargo feature (#33845)

Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
Delan Azabani 2024-10-16 18:24:24 +08:00 committed by GitHub
parent 103d3aa7bb
commit fa1f7e5839
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 534 additions and 156 deletions

View file

@ -13,6 +13,9 @@ path = "lib.rs"
test = true
doctest = false
[features]
tracing = ["dep:tracing"]
[dependencies]
app_units = { workspace = true }
atomic_refcell = { workspace = true }
@ -45,8 +48,8 @@ servo_config = { path = "../config" }
servo_geometry = { path = "../geometry" }
servo_url = { path = "../url" }
style = { workspace = true }
tracing = { workspace = true }
style_traits = { workspace = true }
tracing = { workspace = true, optional = true }
unicode-bidi = { workspace = true }
unicode-script = { workspace = true }
url = { workspace = true }

View file

@ -19,7 +19,6 @@ use style::values::generics::flex::GenericFlexBasis as FlexBasis;
use style::values::generics::length::{GenericLengthPercentageOrAuto, LengthPercentageOrNormal};
use style::values::specified::align::AlignFlags;
use style::Zero;
use tracing::instrument;
use super::geom::{FlexAxis, FlexRelativeRect, FlexRelativeSides, FlexRelativeVec2};
use super::{FlexContainer, FlexContainerConfig, FlexItemBox, FlexLevelBox};
@ -340,10 +339,13 @@ struct FlexItemBoxInlineContentSizesInfo {
}
impl FlexContainer {
#[instrument(
name = "FlexContainer::inline_content_sizes",
skip_all,
fields(servo_profiling = true)
#[cfg_attr(
feature = "tracing",
tracing::instrument(
name = "FlexContainer::inline_content_sizes",
skip_all,
fields(servo_profiling = true)
)
)]
pub fn inline_content_sizes(
&mut self,
@ -551,10 +553,13 @@ impl FlexContainer {
}
/// <https://drafts.csswg.org/css-flexbox/#layout-algorithm>
#[instrument(
name = "FlexContainer::layout",
skip_all,
fields(servo_profiling = true)
#[cfg_attr(
feature = "tracing",
tracing::instrument(
name = "FlexContainer::layout",
skip_all,
fields(servo_profiling = true)
)
)]
pub(crate) fn layout(
&self,
@ -2490,10 +2495,13 @@ impl FlexItemBox {
}
#[allow(clippy::too_many_arguments)]
#[instrument(
name = "FlexContainer::layout_for_block_content_size",
skip_all,
fields(servo_profiling = true)
#[cfg_attr(
feature = "tracing",
tracing::instrument(
name = "FlexContainer::layout_for_block_content_size",
skip_all,
fields(servo_profiling = true)
)
)]
fn layout_for_block_content_size(
&mut self,

View file

@ -24,7 +24,6 @@ use style::values::computed::{
use style::values::generics::box_::{GenericVerticalAlign as VerticalAlign, VerticalAlignKeyword};
use style::values::generics::length::GenericLengthPercentageOrAuto::{Auto, LengthPercentage};
use style::Zero;
use tracing::instrument;
use super::{Table, TableCaption, TableSlot, TableSlotCell, TableTrack, TableTrackGroup};
use crate::context::LayoutContext;
@ -1634,7 +1633,10 @@ impl<'a> TableLayout<'a> {
/// Lay out the table (grid and captions) of this [`TableLayout`] into fragments. This should
/// only be be called after calling [`TableLayout.compute_measures`].
#[instrument(name = "Table::layout", skip_all, fields(servo_profiling = true))]
#[cfg_attr(
feature = "tracing",
tracing::instrument(name = "Table::layout", skip_all, fields(servo_profiling = true))
)]
fn layout(
mut self,
layout_context: &LayoutContext,
@ -2606,10 +2608,13 @@ impl Table {
}
}
#[instrument(
name = "Table::inline_content_sizes",
skip_all,
fields(servo_profiling = true)
#[cfg_attr(
feature = "tracing",
tracing::instrument(
name = "Table::inline_content_sizes",
skip_all,
fields(servo_profiling = true)
)
)]
pub(crate) fn inline_content_sizes(
&mut self,