mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
This pull request refactors existing tracing annotations to leverage the new `servo_tracing::instrument` macro introduced in #36573. Specifically, the following transformations were applied: - Removed `#[cfg_attr(feature = "tracing", ...)]` wrappers. - Replaced `tracing::instrument` with `servo_tracing::instrument`. - Removed `level = "trace"` - Removed `fields(servo_profiling = true)` from tracing attributes however retained others like `name`. `skip type` Closes: #36661 --------- Signed-off-by: Bhuwan Pandit <bhuwanpandit109@gmail.com> Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
This commit is contained in:
parent
bdf8c0ebc8
commit
04bcafa140
16 changed files with 137 additions and 527 deletions
|
@ -62,6 +62,7 @@ unicode-script = { workspace = true }
|
|||
url = { workspace = true }
|
||||
webrender_api = { workspace = true }
|
||||
xi-unicode = { workspace = true }
|
||||
servo-tracing = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
num-traits = { workspace = true }
|
||||
|
|
|
@ -109,15 +109,7 @@ impl StackingContextTreeClipStore {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(
|
||||
name = "StackingContextClipStore::add_for_basic_shape",
|
||||
skip_all,
|
||||
fields(servo_profiling = true),
|
||||
level = "trace",
|
||||
)
|
||||
)]
|
||||
#[servo_tracing::instrument(name = "StackingContextClipStore::add_for_basic_shape", skip_all)]
|
||||
fn add_for_basic_shape(
|
||||
&mut self,
|
||||
shape: BasicShape,
|
||||
|
|
|
@ -426,15 +426,7 @@ struct FlexItemBoxInlineContentSizesInfo {
|
|||
}
|
||||
|
||||
impl ComputeInlineContentSizes for FlexContainer {
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(
|
||||
name = "FlexContainer::compute_inline_content_sizes",
|
||||
skip_all,
|
||||
fields(servo_profiling = true),
|
||||
level = "trace",
|
||||
)
|
||||
)]
|
||||
#[servo_tracing::instrument(name = "FlexContainer::compute_inline_content_sizes", skip_all)]
|
||||
fn compute_inline_content_sizes(
|
||||
&self,
|
||||
layout_context: &LayoutContext,
|
||||
|
@ -635,14 +627,10 @@ impl FlexContainer {
|
|||
}
|
||||
|
||||
/// <https://drafts.csswg.org/css-flexbox/#layout-algorithm>
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(
|
||||
name = "FlexContainer::layout",
|
||||
skip_all,
|
||||
fields(servo_profiling = true, self_address = self as *const _ as usize),
|
||||
level = "trace",
|
||||
)
|
||||
#[servo_tracing::instrument(
|
||||
name = "FlexContainer::layout",
|
||||
skip_all,
|
||||
fields(self_address = self as *const _ as usize)
|
||||
)]
|
||||
pub(crate) fn layout(
|
||||
&self,
|
||||
|
@ -1743,18 +1731,13 @@ impl FlexItem<'_> {
|
|||
/// From <https://drafts.csswg.org/css-flexbox/#algo-cross-item>:
|
||||
/// > performing layout as if it were an in-flow block-level box with the used main
|
||||
/// > size and the given available space, treating `auto` as `fit-content`.
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(
|
||||
name = "FlexItem::layout",
|
||||
skip_all,
|
||||
fields(
|
||||
servo_profiling = true,
|
||||
self_address = self as *const _ as usize,
|
||||
box_address = self.box_ as *const _ as usize,
|
||||
for_stretch = non_stretch_layout_result.is_some(),
|
||||
),
|
||||
level = "trace",
|
||||
#[servo_tracing::instrument(
|
||||
name = "FlexItem::layout",
|
||||
skip_all,
|
||||
fields(
|
||||
self_address = self as *const _ as usize,
|
||||
box_address = self.box_ as *const _ as usize,
|
||||
for_stretch = non_stretch_layout_result.is_some()
|
||||
)
|
||||
)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -2595,15 +2578,7 @@ impl FlexItemBox {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(
|
||||
name = "FlexContainer::layout_for_block_content_size",
|
||||
skip_all,
|
||||
fields(servo_profiling = true),
|
||||
level = "trace",
|
||||
)
|
||||
)]
|
||||
#[servo_tracing::instrument(name = "FlexContainer::layout_for_block_content_size", skip_all)]
|
||||
fn layout_for_block_content_size(
|
||||
&self,
|
||||
flex_context: &FlexContext,
|
||||
|
|
|
@ -1634,15 +1634,7 @@ impl From<&InheritedText> for SegmentContentFlags {
|
|||
}
|
||||
|
||||
impl InlineFormattingContext {
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(
|
||||
name = "InlineFormattingContext::new_with_builder",
|
||||
skip_all,
|
||||
fields(servo_profiling = true),
|
||||
level = "trace",
|
||||
)
|
||||
)]
|
||||
#[servo_tracing::instrument(name = "InlineFormattingContext::new_with_builder", skip_all)]
|
||||
pub(super) fn new_with_builder(
|
||||
builder: InlineFormattingContextBuilder,
|
||||
layout_context: &LayoutContext,
|
||||
|
|
|
@ -276,14 +276,9 @@ impl IndependentNonReplacedContents {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(
|
||||
name = "IndependentNonReplacedContents::layout_with_caching",
|
||||
skip_all,
|
||||
fields(servo_profiling = true),
|
||||
level = "trace",
|
||||
)
|
||||
#[servo_tracing::instrument(
|
||||
name = "IndependentNonReplacedContents::layout_with_caching",
|
||||
skip_all
|
||||
)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn layout(
|
||||
|
|
|
@ -223,10 +223,7 @@ impl Layout for LayoutThread {
|
|||
);
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn add_stylesheet(
|
||||
&mut self,
|
||||
stylesheet: ServoArc<Stylesheet>,
|
||||
|
@ -246,10 +243,7 @@ impl Layout for LayoutThread {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn remove_stylesheet(&mut self, stylesheet: ServoArc<Stylesheet>) {
|
||||
let guard = stylesheet.shared_lock.read();
|
||||
let stylesheet = DocumentStyleSheet(stylesheet.clone());
|
||||
|
@ -258,37 +252,25 @@ impl Layout for LayoutThread {
|
|||
.remove_all_web_fonts_from_stylesheet(&stylesheet);
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_content_box(&self, node: TrustedNodeAddress) -> Option<UntypedRect<Au>> {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_content_box_request(node)
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_content_boxes(&self, node: TrustedNodeAddress) -> Vec<UntypedRect<Au>> {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_content_boxes_request(node)
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_client_rect(&self, node: TrustedNodeAddress) -> UntypedRect<i32> {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_client_rect_request(node)
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_element_inner_outer_text(
|
||||
&self,
|
||||
node: script_layout_interface::TrustedNodeAddress,
|
||||
|
@ -297,10 +279,7 @@ impl Layout for LayoutThread {
|
|||
get_the_text_steps(node)
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_nodes_from_point(
|
||||
&self,
|
||||
point: UntypedPoint2D<f32>,
|
||||
|
@ -323,19 +302,13 @@ impl Layout for LayoutThread {
|
|||
results.iter().map(|result| result.node).collect()
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_offset_parent(&self, node: TrustedNodeAddress) -> OffsetParentResponse {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_offset_parent_query(node).unwrap_or_default()
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_resolved_style(
|
||||
&self,
|
||||
node: TrustedNodeAddress,
|
||||
|
@ -364,10 +337,7 @@ impl Layout for LayoutThread {
|
|||
process_resolved_style_request(&shared_style_context, node, &pseudo, &property_id)
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_resolved_font_style(
|
||||
&self,
|
||||
node: TrustedNodeAddress,
|
||||
|
@ -400,19 +370,13 @@ impl Layout for LayoutThread {
|
|||
)
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_scrolling_area(&self, node: Option<TrustedNodeAddress>) -> UntypedRect<i32> {
|
||||
let node = node.map(|node| unsafe { ServoLayoutNode::new(&node) });
|
||||
process_node_scroll_area_request(node, self.fragment_tree.borrow().clone())
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_text_indext(
|
||||
&self,
|
||||
node: OpaqueNode,
|
||||
|
@ -612,10 +576,7 @@ impl LayoutThread {
|
|||
}
|
||||
|
||||
/// The high-level routine that performs layout.
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn handle_reflow(&mut self, mut reflow_request: ReflowRequest) -> Option<ReflowResult> {
|
||||
let document = unsafe { ServoLayoutNode::new(&reflow_request.document) };
|
||||
let document = document.as_document().unwrap();
|
||||
|
@ -779,10 +740,7 @@ impl LayoutThread {
|
|||
.flush(guards, Some(root_element), Some(snapshot_map));
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||
)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn restyle_and_build_trees(
|
||||
&self,
|
||||
reflow_request: &ReflowRequest,
|
||||
|
|
|
@ -1510,15 +1510,7 @@ 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`].
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(
|
||||
name = "Table::layout",
|
||||
skip_all,
|
||||
fields(servo_profiling = true),
|
||||
level = "trace",
|
||||
)
|
||||
)]
|
||||
#[servo_tracing::instrument(name = "Table::layout", skip_all)]
|
||||
fn layout(
|
||||
mut self,
|
||||
layout_context: &LayoutContext,
|
||||
|
@ -2695,15 +2687,7 @@ impl Table {
|
|||
}
|
||||
|
||||
impl ComputeInlineContentSizes for Table {
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(
|
||||
name = "Table::compute_inline_content_sizes",
|
||||
skip_all,
|
||||
fields(servo_profiling = true),
|
||||
level = "trace",
|
||||
)
|
||||
)]
|
||||
#[servo_tracing::instrument(name = "Table::compute_inline_content_sizes", skip_all)]
|
||||
fn compute_inline_content_sizes(
|
||||
&self,
|
||||
layout_context: &LayoutContext,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue