chore: Simplify tracing with servo_tracing macro (#36661) (#37497)

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:
Bhuwan Pandit 2025-06-18 17:18:04 +01:00 committed by GitHub
parent bdf8c0ebc8
commit 04bcafa140
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 137 additions and 527 deletions

View file

@ -53,6 +53,7 @@ unicode-properties = { workspace = true }
unicode-script = { workspace = true }
url = { workspace = true }
webrender_api = { workspace = true }
servo-tracing = { workspace = true }
[target.'cfg(target_os = "macos")'.dependencies]
byteorder = { workspace = true }

View file

@ -61,15 +61,7 @@ static TEXT_SHAPING_PERFORMANCE_COUNTER: AtomicUsize = AtomicUsize::new(0);
// resources needed by the graphics layer to draw glyphs.
pub trait PlatformFontMethods: Sized {
#[cfg_attr(
feature = "tracing",
tracing::instrument(
name = "PlatformFontMethods::new_from_template",
skip_all,
fields(servo_profiling = true),
level = "trace",
)
)]
#[servo_tracing::instrument(name = "PlatformFontMethods::new_from_template", skip_all)]
fn new_from_template(
template: FontTemplateRef,
pt_size: Option<Au>,

View file

@ -268,10 +268,7 @@ impl FontContext {
/// Create a `Font` for use in layout calculations, from a `FontTemplateData` returned by the
/// cache thread and a `FontDescriptor` which contains the styling parameters.
#[cfg_attr(
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[servo_tracing::instrument(skip_all)]
fn create_font(
&self,
font_template: FontTemplateRef,

View file

@ -210,10 +210,7 @@ impl SystemFontService {
});
}
#[cfg_attr(
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[servo_tracing::instrument(skip_all)]
fn fetch_new_keys(&mut self) {
if !self.free_font_keys.is_empty() && !self.free_font_instance_keys.is_empty() {
return;
@ -230,10 +227,7 @@ impl SystemFontService {
.append(&mut new_font_instance_keys);
}
#[cfg_attr(
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[servo_tracing::instrument(skip_all)]
fn get_font_templates(
&mut self,
font_descriptor: Option<FontDescriptor>,
@ -246,10 +240,7 @@ impl SystemFontService {
.collect()
}
#[cfg_attr(
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[servo_tracing::instrument(skip_all)]
fn refresh_local_families(&mut self) {
self.local_families.clear();
for_each_available_family(|family_name| {
@ -260,10 +251,7 @@ impl SystemFontService {
});
}
#[cfg_attr(
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[servo_tracing::instrument(skip_all)]
fn find_font_templates(
&mut self,
descriptor_to_match: Option<&FontDescriptor>,
@ -287,10 +275,7 @@ impl SystemFontService {
.unwrap_or_default()
}
#[cfg_attr(
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[servo_tracing::instrument(skip_all)]
fn get_font_instance(
&mut self,
identifier: FontIdentifier,