diff options
author | Martin Robinson <mrobinson@igalia.com> | 2025-03-21 15:55:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-21 14:55:00 +0000 |
commit | 54244797688fbeec85baac6fcfc9b71d555bf72c (patch) | |
tree | 5e9914cce8a83a8d8b171da0ead4d6f1cf725ca5 /components/constellation/tracing.rs | |
parent | 1f232eb17c031fe18035a17249de99b2af6fa53e (diff) | |
download | servo-54244797688fbeec85baac6fcfc9b71d555bf72c.tar.gz servo-54244797688fbeec85baac6fcfc9b71d555bf72c.zip |
metrics: Simplify `ProgressiveWebMetrics` (#35985)
Simply how `ProgressiveWebMetrics` works:
1. Keep only a single struct instead of one in layout and one script
that both implement the `ProgressiveWebMetrics` trait. Since layout
and script are the same thread these can now just be a single
`ProgressiveWebMetrics` struct stored in script.
2. Have the compositor be responsible for informing the Constellation
(which informs the ScripThread) about paint metrics. This makes
communication flow one way and removes one dependency between the
compositor and script (of two).
3. All units tests are moved into the `metrics` crate itself since there
is only one struct there now.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/constellation/tracing.rs')
-rw-r--r-- | components/constellation/tracing.rs | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/components/constellation/tracing.rs b/components/constellation/tracing.rs index 38dda83538f..efd3c0e9566 100644 --- a/components/constellation/tracing.rs +++ b/components/constellation/tracing.rs @@ -30,17 +30,6 @@ macro_rules! trace_script_msg { }; } -/// Log an event from layout at trace level. -/// - To disable tracing: RUST_LOG='constellation<layout@=off' -/// - To enable tracing: RUST_LOG='constellation<layout@' -macro_rules! trace_layout_msg { - // This macro only exists to put the docs in the same file as the target prefix, - // so the macro definition is always the same. - ($event:expr, $($rest:tt)+) => { - ::log::trace!(target: $crate::tracing::LogTarget::log_target(&$event), $($rest)+) - }; -} - /// Get the log target for an event, as a static string. pub(crate) trait LogTarget { fn log_target(&self) -> &'static str; @@ -87,6 +76,7 @@ mod from_compositor { Self::MediaSessionAction(_) => target!("MediaSessionAction"), Self::SetWebViewThrottled(_, _) => target!("SetWebViewThrottled"), Self::SetScrollStates(..) => target!("SetScrollStates"), + Self::PaintMetric(..) => target!("PaintMetric"), } } } @@ -249,21 +239,3 @@ mod from_script { } } } - -mod from_layout { - use super::LogTarget; - - macro_rules! target { - ($($name:literal)+) => { - concat!("constellation<layout@", $($name),+) - }; - } - - impl LogTarget for script_traits::LayoutMsg { - fn log_target(&self) -> &'static str { - match self { - Self::PendingPaintMetric(..) => target!("PendingPaintMetric"), - } - } - } -} |