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

4
Cargo.lock generated
View file

@ -1104,6 +1104,7 @@ dependencies = [
"net", "net",
"pixels", "pixels",
"profile_traits", "profile_traits",
"servo-tracing",
"servo_allocator", "servo_allocator",
"servo_config", "servo_config",
"servo_geometry", "servo_geometry",
@ -1186,6 +1187,7 @@ dependencies = [
"script_layout_interface", "script_layout_interface",
"script_traits", "script_traits",
"serde", "serde",
"servo-tracing",
"servo_config", "servo_config",
"servo_rand", "servo_rand",
"servo_url", "servo_url",
@ -2240,6 +2242,7 @@ dependencies = [
"range", "range",
"read-fonts", "read-fonts",
"serde", "serde",
"servo-tracing",
"servo_allocator", "servo_allocator",
"servo_arc", "servo_arc",
"servo_config", "servo_config",
@ -4251,6 +4254,7 @@ dependencies = [
"script_layout_interface", "script_layout_interface",
"script_traits", "script_traits",
"selectors", "selectors",
"servo-tracing",
"servo_arc", "servo_arc",
"servo_config", "servo_config",
"servo_geometry", "servo_geometry",

View file

@ -44,6 +44,7 @@ webrender = { workspace = true }
webrender_api = { workspace = true } webrender_api = { workspace = true }
webxr = { path = "../webxr", optional = true } webxr = { path = "../webxr", optional = true }
wr_malloc_size_of = { workspace = true } wr_malloc_size_of = { workspace = true }
servo-tracing = { workspace = true }
[dev-dependencies] [dev-dependencies]
surfman = { workspace = true } surfman = { workspace = true }

View file

@ -1503,10 +1503,7 @@ impl IOCompositor {
})) }))
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn render_inner(&mut self) -> Result<(), UnableToComposite> { fn render_inner(&mut self) -> Result<(), UnableToComposite> {
if let Err(err) = self.rendering_context.make_current() { if let Err(err) = self.rendering_context.make_current() {
warn!("Failed to make the rendering context current: {:?}", err); warn!("Failed to make the rendering context current: {:?}", err);
@ -1660,10 +1657,7 @@ impl IOCompositor {
Ref::map(self.global.borrow(), |global| &global.compositor_receiver) Ref::map(self.global.borrow(), |global| &global.compositor_receiver)
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
pub fn handle_messages(&mut self, mut messages: Vec<CompositorMsg>) { pub fn handle_messages(&mut self, mut messages: Vec<CompositorMsg>) {
// Check for new messages coming from the other threads in the system. // Check for new messages coming from the other threads in the system.
let mut found_recomposite_msg = false; let mut found_recomposite_msg = false;
@ -1700,10 +1694,7 @@ impl IOCompositor {
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
pub fn perform_updates(&mut self) -> bool { pub fn perform_updates(&mut self) -> bool {
if self.global.borrow().shutdown_state() == ShutdownState::FinishedShuttingDown { if self.global.borrow().shutdown_state() == ShutdownState::FinishedShuttingDown {
return false; return false;

View file

@ -53,6 +53,7 @@ webgpu_traits = { workspace = true }
webrender = { workspace = true } webrender = { workspace = true }
webrender_api = { workspace = true } webrender_api = { workspace = true }
webxr-api = { workspace = true, features = ["ipc"] } webxr-api = { workspace = true, features = ["ipc"] }
servo-tracing = { workspace = true }
[target.'cfg(any(target_os="macos", all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_env="ohos"), not(target_arch="arm"), not(target_arch="aarch64"))))'.dependencies] [target.'cfg(any(target_os="macos", all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_env="ohos"), not(target_arch="arm"), not(target_arch="aarch64"))))'.dependencies]
gaol = "0.2.1" gaol = "0.2.1"

View file

@ -586,14 +586,7 @@ where
{ {
/// Create a new constellation thread. /// Create a new constellation thread.
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[cfg_attr( #[servo_tracing::instrument(skip(state, layout_factory))]
feature = "tracing",
tracing::instrument(
skip(state, layout_factory),
fields(servo_profiling = true),
level = "trace",
)
)]
pub fn start( pub fn start(
state: InitialConstellationState, state: InitialConstellationState,
layout_factory: Arc<dyn LayoutFactory>, layout_factory: Arc<dyn LayoutFactory>,
@ -1157,10 +1150,7 @@ where
} }
/// Handles loading pages, navigation, and granting access to the compositor /// Handles loading pages, navigation, and granting access to the compositor
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_request(&mut self) { fn handle_request(&mut self) {
#[derive(Debug)] #[derive(Debug)]
enum Request { enum Request {
@ -1251,19 +1241,13 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_request_for_pipeline_namespace(&mut self, request: PipelineNamespaceRequest) { fn handle_request_for_pipeline_namespace(&mut self, request: PipelineNamespaceRequest) {
let PipelineNamespaceRequest(sender) = request; let PipelineNamespaceRequest(sender) = request;
let _ = sender.send(self.next_pipeline_namespace_id()); let _ = sender.send(self.next_pipeline_namespace_id());
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_request_from_background_hang_monitor(&self, message: HangMonitorAlert) { fn handle_request_from_background_hang_monitor(&self, message: HangMonitorAlert) {
match message { match message {
HangMonitorAlert::Profile(bytes) => { HangMonitorAlert::Profile(bytes) => {
@ -1286,10 +1270,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_request_from_compositor(&mut self, message: EmbedderToConstellationMessage) { fn handle_request_from_compositor(&mut self, message: EmbedderToConstellationMessage) {
trace_msg_from_compositor!(message, "{message:?}"); trace_msg_from_compositor!(message, "{message:?}");
match message { match message {
@ -1496,10 +1477,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_evaluate_javascript( fn handle_evaluate_javascript(
&mut self, &mut self,
webview_id: WebViewId, webview_id: WebViewId,
@ -1535,10 +1513,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_request_from_script(&mut self, message: (PipelineId, ScriptToConstellationMessage)) { fn handle_request_from_script(&mut self, message: (PipelineId, ScriptToConstellationMessage)) {
let (source_pipeline_id, content) = message; let (source_pipeline_id, content) = message;
trace_script_msg!(content, "{source_pipeline_id}: {content:?}"); trace_script_msg!(content, "{source_pipeline_id}: {content:?}");
@ -1912,10 +1887,7 @@ where
} }
/// Broadcast a message via routers in various event-loops. /// Broadcast a message via routers in various event-loops.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_schedule_broadcast( fn handle_schedule_broadcast(
&self, &self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -1959,10 +1931,7 @@ where
} }
/// Remove a channel-name for a given broadcast router. /// Remove a channel-name for a given broadcast router.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_remove_broadcast_channel_name_in_router( fn handle_remove_broadcast_channel_name_in_router(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -1998,10 +1967,7 @@ where
} }
/// Note a new channel-name relevant to a given broadcast router. /// Note a new channel-name relevant to a given broadcast router.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_new_broadcast_channel_name_in_router( fn handle_new_broadcast_channel_name_in_router(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -2023,10 +1989,7 @@ where
} }
/// Remove a broadcast router. /// Remove a broadcast router.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_remove_broadcast_channel_router( fn handle_remove_broadcast_channel_router(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -2045,10 +2008,7 @@ where
} }
/// Add a new broadcast router. /// Add a new broadcast router.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_new_broadcast_channel_router( fn handle_new_broadcast_channel_router(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -2071,10 +2031,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[cfg(feature = "webgpu")] #[cfg(feature = "webgpu")]
fn handle_wgpu_request( fn handle_wgpu_request(
&mut self, &mut self,
@ -2155,10 +2112,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_message_port_transfer_completed( fn handle_message_port_transfer_completed(
&mut self, &mut self,
router_id: Option<MessagePortRouterId>, router_id: Option<MessagePortRouterId>,
@ -2286,10 +2240,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_complete_message_port_transfer( fn handle_complete_message_port_transfer(
&mut self, &mut self,
router_id: MessagePortRouterId, router_id: MessagePortRouterId,
@ -2366,10 +2317,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_reroute_messageport(&mut self, port_id: MessagePortId, task: PortMessageTask) { fn handle_reroute_messageport(&mut self, port_id: MessagePortId, task: PortMessageTask) {
let info = match self.message_ports.get_mut(&port_id) { let info = match self.message_ports.get_mut(&port_id) {
Some(info) => info, Some(info) => info,
@ -2397,10 +2345,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_messageport_shipped(&mut self, port_id: MessagePortId) { fn handle_messageport_shipped(&mut self, port_id: MessagePortId) {
if let Some(info) = self.message_ports.get_mut(&port_id) { if let Some(info) = self.message_ports.get_mut(&port_id) {
match info.state { match info.state {
@ -2455,10 +2400,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_entangle_messageports(&mut self, port1: MessagePortId, port2: MessagePortId) { fn handle_entangle_messageports(&mut self, port1: MessagePortId, port2: MessagePortId) {
if let Some(info) = self.message_ports.get_mut(&port1) { if let Some(info) = self.message_ports.get_mut(&port1) {
info.entangled_with = Some(port2); info.entangled_with = Some(port2);
@ -2478,10 +2420,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
/// <https://html.spec.whatwg.org/multipage/#disentangle> /// <https://html.spec.whatwg.org/multipage/#disentangle>
fn handle_disentangle_messageports( fn handle_disentangle_messageports(
&mut self, &mut self,
@ -2535,10 +2474,7 @@ where
/// ///
/// The Job Queue is essentially the channel to a SW manager, /// The Job Queue is essentially the channel to a SW manager,
/// which are scoped per origin. /// which are scoped per origin.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_schedule_serviceworker_job(&mut self, pipeline_id: PipelineId, job: Job) { fn handle_schedule_serviceworker_job(&mut self, pipeline_id: PipelineId, job: Job) {
let origin = job.scope_url.origin(); let origin = job.scope_url.origin();
@ -2589,10 +2525,7 @@ where
let _ = sw_manager.send(ServiceWorkerMsg::ScheduleJob(job)); let _ = sw_manager.send(ServiceWorkerMsg::ScheduleJob(job));
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_broadcast_storage_event( fn handle_broadcast_storage_event(
&self, &self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -2623,10 +2556,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_exit(&mut self) { fn handle_exit(&mut self) {
debug!("Handling exit."); debug!("Handling exit.");
@ -2707,10 +2637,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_shutdown(&mut self) { fn handle_shutdown(&mut self) {
debug!("Handling shutdown."); debug!("Handling shutdown.");
@ -2855,10 +2782,7 @@ where
)); ));
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_send_error(&mut self, pipeline_id: PipelineId, err: IpcError) { fn handle_send_error(&mut self, pipeline_id: PipelineId, err: IpcError) {
// Treat send error the same as receiving a panic message // Treat send error the same as receiving a panic message
error!("{}: Send error ({})", pipeline_id, err); error!("{}: Send error ({})", pipeline_id, err);
@ -2870,10 +2794,7 @@ where
self.handle_panic(webview_id, reason, None); self.handle_panic(webview_id, reason, None);
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_panic( fn handle_panic(
&mut self, &mut self,
webview_id: Option<WebViewId>, webview_id: Option<WebViewId>,
@ -2972,10 +2893,7 @@ where
}); });
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_focus_web_view(&mut self, webview_id: WebViewId) { fn handle_focus_web_view(&mut self, webview_id: WebViewId) {
if self.webviews.get(webview_id).is_none() { if self.webviews.get(webview_id).is_none() {
return warn!("{webview_id}: FocusWebView on unknown top-level browsing context"); return warn!("{webview_id}: FocusWebView on unknown top-level browsing context");
@ -2985,10 +2903,7 @@ where
.send(EmbedderMsg::WebViewFocused(webview_id)); .send(EmbedderMsg::WebViewFocused(webview_id));
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true))
)]
fn handle_log_entry( fn handle_log_entry(
&mut self, &mut self,
webview_id: Option<WebViewId>, webview_id: Option<WebViewId>,
@ -3137,10 +3052,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_new_top_level_browsing_context( fn handle_new_top_level_browsing_context(
&mut self, &mut self,
url: ServoUrl, url: ServoUrl,
@ -3209,10 +3121,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_close_top_level_browsing_context(&mut self, webview_id: WebViewId) { fn handle_close_top_level_browsing_context(&mut self, webview_id: WebViewId) {
debug!("{webview_id}: Closing"); debug!("{webview_id}: Closing");
let browsing_context_id = BrowsingContextId::from(webview_id); let browsing_context_id = BrowsingContextId::from(webview_id);
@ -3247,10 +3156,7 @@ where
debug!("{webview_id}: Closed"); debug!("{webview_id}: Closed");
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_iframe_size_msg(&mut self, iframe_sizes: Vec<IFrameSizeMsg>) { fn handle_iframe_size_msg(&mut self, iframe_sizes: Vec<IFrameSizeMsg>) {
for IFrameSizeMsg { for IFrameSizeMsg {
browsing_context_id, browsing_context_id,
@ -3262,10 +3168,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_finish_javascript_evaluation( fn handle_finish_javascript_evaluation(
&mut self, &mut self,
evaluation_id: JavaScriptEvaluationId, evaluation_id: JavaScriptEvaluationId,
@ -3278,10 +3181,7 @@ where
)); ));
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_subframe_loaded(&mut self, pipeline_id: PipelineId) { fn handle_subframe_loaded(&mut self, pipeline_id: PipelineId) {
let browsing_context_id = match self.pipelines.get(&pipeline_id) { let browsing_context_id = match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline.browsing_context_id, Some(pipeline) => pipeline.browsing_context_id,
@ -3326,10 +3226,7 @@ where
// iframe via script. This will result in a new pipeline being spawned and // iframe via script. This will result in a new pipeline being spawned and
// a child being added to the parent browsing context. This message is never // a child being added to the parent browsing context. This message is never
// the result of a page navigation. // the result of a page navigation.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfoWithData) { fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfoWithData) {
let IFrameLoadInfo { let IFrameLoadInfo {
parent_pipeline_id, parent_pipeline_id,
@ -3436,10 +3333,7 @@ where
}); });
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_script_new_iframe(&mut self, load_info: IFrameLoadInfoWithData) { fn handle_script_new_iframe(&mut self, load_info: IFrameLoadInfoWithData) {
let IFrameLoadInfo { let IFrameLoadInfo {
parent_pipeline_id, parent_pipeline_id,
@ -3500,10 +3394,7 @@ where
}); });
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_script_new_auxiliary(&mut self, load_info: AuxiliaryWebViewCreationRequest) { fn handle_script_new_auxiliary(&mut self, load_info: AuxiliaryWebViewCreationRequest) {
let AuxiliaryWebViewCreationRequest { let AuxiliaryWebViewCreationRequest {
load_data, load_data,
@ -3611,19 +3502,13 @@ where
}); });
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_set_cursor_msg(&mut self, webview_id: WebViewId, cursor: Cursor) { fn handle_set_cursor_msg(&mut self, webview_id: WebViewId, cursor: Cursor) {
self.embedder_proxy self.embedder_proxy
.send(EmbedderMsg::SetCursor(webview_id, cursor)); .send(EmbedderMsg::SetCursor(webview_id, cursor));
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_change_running_animations_state( fn handle_change_running_animations_state(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -3642,10 +3527,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_tick_animation(&mut self, webview_ids: Vec<WebViewId>) { fn handle_tick_animation(&mut self, webview_ids: Vec<WebViewId>) {
let mut animating_event_loops = HashSet::new(); let mut animating_event_loops = HashSet::new();
@ -3670,10 +3552,7 @@ where
/// Schedule a navigation(via load_url). /// Schedule a navigation(via load_url).
/// 1: Ask the embedder for permission. /// 1: Ask the embedder for permission.
/// 2: Store the details of the navigation, pending approval from the embedder. /// 2: Store the details of the navigation, pending approval from the embedder.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn schedule_navigation( fn schedule_navigation(
&mut self, &mut self,
webview_id: WebViewId, webview_id: WebViewId,
@ -3701,10 +3580,7 @@ where
)); ));
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn load_url( fn load_url(
&mut self, &mut self,
webview_id: WebViewId, webview_id: WebViewId,
@ -3835,10 +3711,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_abort_load_url_msg(&mut self, new_pipeline_id: PipelineId) { fn handle_abort_load_url_msg(&mut self, new_pipeline_id: PipelineId) {
let pending_index = self let pending_index = self
.pending_changes .pending_changes
@ -3856,10 +3729,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_load_complete_msg(&mut self, webview_id: WebViewId, pipeline_id: PipelineId) { fn handle_load_complete_msg(&mut self, webview_id: WebViewId, pipeline_id: PipelineId) {
let mut webdriver_reset = false; let mut webdriver_reset = false;
if let Some((expected_pipeline_id, ref reply_chan)) = self.webdriver.load_channel { if let Some((expected_pipeline_id, ref reply_chan)) = self.webdriver.load_channel {
@ -3904,10 +3774,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_navigated_to_fragment( fn handle_navigated_to_fragment(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -3940,10 +3807,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_traverse_history_msg( fn handle_traverse_history_msg(
&mut self, &mut self,
webview_id: WebViewId, webview_id: WebViewId,
@ -4085,10 +3949,7 @@ where
self.update_webview_in_compositor(webview_id); self.update_webview_in_compositor(webview_id);
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn update_browsing_context( fn update_browsing_context(
&mut self, &mut self,
browsing_context_id: BrowsingContextId, browsing_context_id: BrowsingContextId,
@ -4215,10 +4076,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn update_pipeline( fn update_pipeline(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -4245,10 +4103,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_joint_session_history_length( fn handle_joint_session_history_length(
&self, &self,
webview_id: WebViewId, webview_id: WebViewId,
@ -4262,10 +4117,7 @@ where
let _ = response_sender.send(length as u32); let _ = response_sender.send(length as u32);
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_push_history_state_msg( fn handle_push_history_state_msg(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -4299,10 +4151,7 @@ where
self.notify_history_changed(webview_id); self.notify_history_changed(webview_id);
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_replace_history_state_msg( fn handle_replace_history_state_msg(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -4327,10 +4176,7 @@ where
session_history.replace_history_state(pipeline_id, history_state_id, url); session_history.replace_history_state(pipeline_id, history_state_id, url);
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_reload_msg(&mut self, webview_id: WebViewId) { fn handle_reload_msg(&mut self, webview_id: WebViewId) {
let browsing_context_id = BrowsingContextId::from(webview_id); let browsing_context_id = BrowsingContextId::from(webview_id);
let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) { let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) {
@ -4349,10 +4195,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_post_message_msg( fn handle_post_message_msg(
&mut self, &mut self,
browsing_context_id: BrowsingContextId, browsing_context_id: BrowsingContextId,
@ -4391,10 +4234,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_focus_msg( fn handle_focus_msg(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -4465,10 +4305,7 @@ where
/// belongs to the document. /// belongs to the document.
/// ///
/// [1]: https://html.spec.whatwg.org/multipage/#focusing-steps /// [1]: https://html.spec.whatwg.org/multipage/#focusing-steps
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn focus_browsing_context( fn focus_browsing_context(
&mut self, &mut self,
initiator_pipeline_id: Option<PipelineId>, initiator_pipeline_id: Option<PipelineId>,
@ -4622,10 +4459,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_remove_iframe_msg( fn handle_remove_iframe_msg(
&mut self, &mut self,
browsing_context_id: BrowsingContextId, browsing_context_id: BrowsingContextId,
@ -4638,10 +4472,7 @@ where
result result
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_set_throttled_complete(&mut self, pipeline_id: PipelineId, throttled: bool) { fn handle_set_throttled_complete(&mut self, pipeline_id: PipelineId, throttled: bool) {
let browsing_context_id = match self.pipelines.get(&pipeline_id) { let browsing_context_id = match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline.browsing_context_id, Some(pipeline) => pipeline.browsing_context_id,
@ -4676,10 +4507,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_create_canvas_paint_thread_msg( fn handle_create_canvas_paint_thread_msg(
&mut self, &mut self,
size: UntypedSize2D<u64>, size: UntypedSize2D<u64>,
@ -4703,10 +4531,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_webdriver_msg(&mut self, msg: WebDriverCommandMsg) { fn handle_webdriver_msg(&mut self, msg: WebDriverCommandMsg) {
// Find the script channel for the given parent pipeline, // Find the script channel for the given parent pipeline,
// and pass the event to that script thread. // and pass the event to that script thread.
@ -4943,10 +4768,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn set_webview_throttled(&mut self, webview_id: WebViewId, throttled: bool) { fn set_webview_throttled(&mut self, webview_id: WebViewId, throttled: bool) {
let browsing_context_id = BrowsingContextId::from(webview_id); let browsing_context_id = BrowsingContextId::from(webview_id);
let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) { let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) {
@ -4961,10 +4783,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn notify_history_changed(&self, webview_id: WebViewId) { fn notify_history_changed(&self, webview_id: WebViewId) {
// Send a flat projection of the history to embedder. // Send a flat projection of the history to embedder.
// The final vector is a concatenation of the URLs of the past // The final vector is a concatenation of the URLs of the past
@ -5078,10 +4897,7 @@ where
)); ));
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn load_url_for_webdriver( fn load_url_for_webdriver(
&mut self, &mut self,
webview_id: WebViewId, webview_id: WebViewId,
@ -5113,10 +4929,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn change_session_history(&mut self, change: SessionHistoryChange) { fn change_session_history(&mut self, change: SessionHistoryChange) {
debug!( debug!(
"{}: Setting to {}", "{}: Setting to {}",
@ -5303,10 +5116,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn focused_browsing_context_is_descendant_of( fn focused_browsing_context_is_descendant_of(
&self, &self,
browsing_context_id: BrowsingContextId, browsing_context_id: BrowsingContextId,
@ -5322,10 +5132,7 @@ where
}) })
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn trim_history(&mut self, webview_id: WebViewId) { fn trim_history(&mut self, webview_id: WebViewId) {
let pipelines_to_evict = { let pipelines_to_evict = {
let session_history = self.get_joint_session_history(webview_id); let session_history = self.get_joint_session_history(webview_id);
@ -5385,10 +5192,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_activate_document_msg(&mut self, pipeline_id: PipelineId) { fn handle_activate_document_msg(&mut self, pipeline_id: PipelineId) {
debug!("{}: Document ready to activate", pipeline_id); debug!("{}: Document ready to activate", pipeline_id);
@ -5434,10 +5238,7 @@ where
} }
/// Called when the window is resized. /// Called when the window is resized.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_change_viewport_details_msg( fn handle_change_viewport_details_msg(
&mut self, &mut self,
webview_id: WebViewId, webview_id: WebViewId,
@ -5458,10 +5259,7 @@ where
} }
/// Called when the window exits from fullscreen mode /// Called when the window exits from fullscreen mode
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_exit_fullscreen_msg(&mut self, webview_id: WebViewId) { fn handle_exit_fullscreen_msg(&mut self, webview_id: WebViewId) {
let browsing_context_id = BrowsingContextId::from(webview_id); let browsing_context_id = BrowsingContextId::from(webview_id);
self.switch_fullscreen_mode(browsing_context_id); self.switch_fullscreen_mode(browsing_context_id);
@ -5472,10 +5270,7 @@ where
/// to check if the output image is "stable" and can be written as a screenshot /// to check if the output image is "stable" and can be written as a screenshot
/// for reftests. /// for reftests.
/// Since this function is only used in reftests, we do not harden it against panic. /// Since this function is only used in reftests, we do not harden it against panic.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_is_ready_to_save_image( fn handle_is_ready_to_save_image(
&mut self, &mut self,
pipeline_states: HashMap<PipelineId, Epoch>, pipeline_states: HashMap<PipelineId, Epoch>,
@ -5555,10 +5350,7 @@ where
} }
/// Get the current activity of a pipeline. /// Get the current activity of a pipeline.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn get_activity(&self, pipeline_id: PipelineId) -> DocumentActivity { fn get_activity(&self, pipeline_id: PipelineId) -> DocumentActivity {
let mut ancestor_id = pipeline_id; let mut ancestor_id = pipeline_id;
loop { loop {
@ -5585,10 +5377,7 @@ where
} }
/// Set the current activity of a pipeline. /// Set the current activity of a pipeline.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn set_activity(&self, pipeline_id: PipelineId, activity: DocumentActivity) { fn set_activity(&self, pipeline_id: PipelineId, activity: DocumentActivity) {
debug!("{}: Setting activity to {:?}", pipeline_id, activity); debug!("{}: Setting activity to {:?}", pipeline_id, activity);
if let Some(pipeline) = self.pipelines.get(&pipeline_id) { if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
@ -5607,20 +5396,14 @@ where
} }
/// Update the current activity of a pipeline. /// Update the current activity of a pipeline.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn update_activity(&self, pipeline_id: PipelineId) { fn update_activity(&self, pipeline_id: PipelineId) {
self.set_activity(pipeline_id, self.get_activity(pipeline_id)); self.set_activity(pipeline_id, self.get_activity(pipeline_id));
} }
/// Handle updating the size of a browsing context. /// Handle updating the size of a browsing context.
/// This notifies every pipeline in the context of the new size. /// This notifies every pipeline in the context of the new size.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn resize_browsing_context( fn resize_browsing_context(
&mut self, &mut self,
new_viewport_details: ViewportDetails, new_viewport_details: ViewportDetails,
@ -5677,10 +5460,7 @@ where
} }
/// Handle theme change events from the embedder and forward them to all appropriate `ScriptThread`s. /// Handle theme change events from the embedder and forward them to all appropriate `ScriptThread`s.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_theme_change(&mut self, webview_id: WebViewId, theme: Theme) { fn handle_theme_change(&mut self, webview_id: WebViewId, theme: Theme) {
let Some(webview) = self.webviews.get_mut(webview_id) else { let Some(webview) = self.webviews.get_mut(webview_id) else {
warn!("Received theme change request for uknown WebViewId: {webview_id:?}"); warn!("Received theme change request for uknown WebViewId: {webview_id:?}");
@ -5707,10 +5487,7 @@ where
} }
// Handle switching from fullscreen mode // Handle switching from fullscreen mode
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn switch_fullscreen_mode(&mut self, browsing_context_id: BrowsingContextId) { fn switch_fullscreen_mode(&mut self, browsing_context_id: BrowsingContextId) {
if let Some(browsing_context) = self.browsing_contexts.get(&browsing_context_id) { if let Some(browsing_context) = self.browsing_contexts.get(&browsing_context_id) {
let pipeline_id = browsing_context.pipeline_id; let pipeline_id = browsing_context.pipeline_id;
@ -5730,10 +5507,7 @@ where
} }
// Close and return the browsing context with the given id (and its children), if it exists. // Close and return the browsing context with the given id (and its children), if it exists.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn close_browsing_context( fn close_browsing_context(
&mut self, &mut self,
browsing_context_id: BrowsingContextId, browsing_context_id: BrowsingContextId,
@ -5795,10 +5569,7 @@ where
} }
// Close the children of a browsing context // Close the children of a browsing context
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn close_browsing_context_children( fn close_browsing_context_children(
&mut self, &mut self,
browsing_context_id: BrowsingContextId, browsing_context_id: BrowsingContextId,
@ -5829,10 +5600,7 @@ where
} }
// Discard the pipeline for a given document, udpdate the joint session history. // Discard the pipeline for a given document, udpdate the joint session history.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_discard_document(&mut self, webview_id: WebViewId, pipeline_id: PipelineId) { fn handle_discard_document(&mut self, webview_id: WebViewId, pipeline_id: PipelineId) {
match self.webviews.get_mut(webview_id) { match self.webviews.get_mut(webview_id) {
Some(webview) => { Some(webview) => {
@ -5860,10 +5628,7 @@ where
} }
// Send a message to script requesting the document associated with this pipeline runs the 'unload' algorithm. // Send a message to script requesting the document associated with this pipeline runs the 'unload' algorithm.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn unload_document(&self, pipeline_id: PipelineId) { fn unload_document(&self, pipeline_id: PipelineId) {
if let Some(pipeline) = self.pipelines.get(&pipeline_id) { if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
let msg = ScriptThreadMessage::UnloadDocument(pipeline_id); let msg = ScriptThreadMessage::UnloadDocument(pipeline_id);
@ -5872,10 +5637,7 @@ where
} }
// Close all pipelines at and beneath a given browsing context // Close all pipelines at and beneath a given browsing context
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn close_pipeline( fn close_pipeline(
&mut self, &mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -5937,10 +5699,7 @@ where
} }
// Randomly close a pipeline -if --random-pipeline-closure-probability is set // Randomly close a pipeline -if --random-pipeline-closure-probability is set
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn maybe_close_random_pipeline(&mut self) { fn maybe_close_random_pipeline(&mut self) {
match self.random_pipeline_closure { match self.random_pipeline_closure {
Some((ref mut rng, probability)) => { Some((ref mut rng, probability)) => {
@ -5978,10 +5737,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn get_joint_session_history(&mut self, top_level_id: WebViewId) -> &mut JointSessionHistory { fn get_joint_session_history(&mut self, top_level_id: WebViewId) -> &mut JointSessionHistory {
self.webviews self.webviews
.get_mut(top_level_id) .get_mut(top_level_id)
@ -5990,10 +5746,7 @@ where
} }
// Convert a browsing context to a sendable form to pass to the compositor // Convert a browsing context to a sendable form to pass to the compositor
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn browsing_context_to_sendable( fn browsing_context_to_sendable(
&self, &self,
browsing_context_id: BrowsingContextId, browsing_context_id: BrowsingContextId,
@ -6023,10 +5776,7 @@ where
} }
/// Send the frame tree for the given webview to the compositor. /// Send the frame tree for the given webview to the compositor.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn update_webview_in_compositor(&mut self, webview_id: WebViewId) { fn update_webview_in_compositor(&mut self, webview_id: WebViewId) {
// Note that this function can panic, due to ipc-channel creation failure. // Note that this function can panic, due to ipc-channel creation failure.
// avoiding this panic would require a mechanism for dealing // avoiding this panic would require a mechanism for dealing
@ -6039,10 +5789,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_media_session_action_msg(&mut self, action: MediaSessionActionType) { fn handle_media_session_action_msg(&mut self, action: MediaSessionActionType) {
if let Some(media_session_pipeline_id) = self.active_media_session { if let Some(media_session_pipeline_id) = self.active_media_session {
let result = match self.pipelines.get(&media_session_pipeline_id) { let result = match self.pipelines.get(&media_session_pipeline_id) {
@ -6066,10 +5813,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_set_scroll_states( fn handle_set_scroll_states(
&self, &self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -6090,10 +5834,7 @@ where
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_paint_metric(&mut self, pipeline_id: PipelineId, event: PaintMetricEvent) { fn handle_paint_metric(&mut self, pipeline_id: PipelineId, event: PaintMetricEvent) {
let Some(pipeline) = self.pipelines.get(&pipeline_id) else { let Some(pipeline) = self.pipelines.get(&pipeline_id) else {
warn!("Discarding paint metric event for unknown pipeline"); warn!("Discarding paint metric event for unknown pipeline");

View file

@ -53,6 +53,7 @@ unicode-properties = { workspace = true }
unicode-script = { workspace = true } unicode-script = { workspace = true }
url = { workspace = true } url = { workspace = true }
webrender_api = { workspace = true } webrender_api = { workspace = true }
servo-tracing = { workspace = true }
[target.'cfg(target_os = "macos")'.dependencies] [target.'cfg(target_os = "macos")'.dependencies]
byteorder = { workspace = true } 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. // resources needed by the graphics layer to draw glyphs.
pub trait PlatformFontMethods: Sized { pub trait PlatformFontMethods: Sized {
#[cfg_attr( #[servo_tracing::instrument(name = "PlatformFontMethods::new_from_template", skip_all)]
feature = "tracing",
tracing::instrument(
name = "PlatformFontMethods::new_from_template",
skip_all,
fields(servo_profiling = true),
level = "trace",
)
)]
fn new_from_template( fn new_from_template(
template: FontTemplateRef, template: FontTemplateRef,
pt_size: Option<Au>, 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 /// Create a `Font` for use in layout calculations, from a `FontTemplateData` returned by the
/// cache thread and a `FontDescriptor` which contains the styling parameters. /// cache thread and a `FontDescriptor` which contains the styling parameters.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn create_font( fn create_font(
&self, &self,
font_template: FontTemplateRef, font_template: FontTemplateRef,

View file

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

View file

@ -62,6 +62,7 @@ unicode-script = { workspace = true }
url = { workspace = true } url = { workspace = true }
webrender_api = { workspace = true } webrender_api = { workspace = true }
xi-unicode = { workspace = true } xi-unicode = { workspace = true }
servo-tracing = { workspace = true }
[dev-dependencies] [dev-dependencies]
num-traits = { workspace = true } num-traits = { workspace = true }

View file

@ -109,15 +109,7 @@ impl StackingContextTreeClipStore {
} }
} }
#[cfg_attr( #[servo_tracing::instrument(name = "StackingContextClipStore::add_for_basic_shape", skip_all)]
feature = "tracing",
tracing::instrument(
name = "StackingContextClipStore::add_for_basic_shape",
skip_all,
fields(servo_profiling = true),
level = "trace",
)
)]
fn add_for_basic_shape( fn add_for_basic_shape(
&mut self, &mut self,
shape: BasicShape, shape: BasicShape,

View file

@ -426,15 +426,7 @@ struct FlexItemBoxInlineContentSizesInfo {
} }
impl ComputeInlineContentSizes for FlexContainer { impl ComputeInlineContentSizes for FlexContainer {
#[cfg_attr( #[servo_tracing::instrument(name = "FlexContainer::compute_inline_content_sizes", skip_all)]
feature = "tracing",
tracing::instrument(
name = "FlexContainer::compute_inline_content_sizes",
skip_all,
fields(servo_profiling = true),
level = "trace",
)
)]
fn compute_inline_content_sizes( fn compute_inline_content_sizes(
&self, &self,
layout_context: &LayoutContext, layout_context: &LayoutContext,
@ -635,14 +627,10 @@ impl FlexContainer {
} }
/// <https://drafts.csswg.org/css-flexbox/#layout-algorithm> /// <https://drafts.csswg.org/css-flexbox/#layout-algorithm>
#[cfg_attr( #[servo_tracing::instrument(
feature = "tracing", name = "FlexContainer::layout",
tracing::instrument( skip_all,
name = "FlexContainer::layout", fields(self_address = self as *const _ as usize)
skip_all,
fields(servo_profiling = true, self_address = self as *const _ as usize),
level = "trace",
)
)] )]
pub(crate) fn layout( pub(crate) fn layout(
&self, &self,
@ -1743,18 +1731,13 @@ impl FlexItem<'_> {
/// From <https://drafts.csswg.org/css-flexbox/#algo-cross-item>: /// 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 /// > 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`. /// > size and the given available space, treating `auto` as `fit-content`.
#[cfg_attr( #[servo_tracing::instrument(
feature = "tracing", name = "FlexItem::layout",
tracing::instrument( skip_all,
name = "FlexItem::layout", fields(
skip_all, self_address = self as *const _ as usize,
fields( box_address = self.box_ as *const _ as usize,
servo_profiling = true, for_stretch = non_stretch_layout_result.is_some()
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",
) )
)] )]
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -2595,15 +2578,7 @@ impl FlexItemBox {
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[cfg_attr( #[servo_tracing::instrument(name = "FlexContainer::layout_for_block_content_size", skip_all)]
feature = "tracing",
tracing::instrument(
name = "FlexContainer::layout_for_block_content_size",
skip_all,
fields(servo_profiling = true),
level = "trace",
)
)]
fn layout_for_block_content_size( fn layout_for_block_content_size(
&self, &self,
flex_context: &FlexContext, flex_context: &FlexContext,

View file

@ -1634,15 +1634,7 @@ impl From<&InheritedText> for SegmentContentFlags {
} }
impl InlineFormattingContext { impl InlineFormattingContext {
#[cfg_attr( #[servo_tracing::instrument(name = "InlineFormattingContext::new_with_builder", skip_all)]
feature = "tracing",
tracing::instrument(
name = "InlineFormattingContext::new_with_builder",
skip_all,
fields(servo_profiling = true),
level = "trace",
)
)]
pub(super) fn new_with_builder( pub(super) fn new_with_builder(
builder: InlineFormattingContextBuilder, builder: InlineFormattingContextBuilder,
layout_context: &LayoutContext, layout_context: &LayoutContext,

View file

@ -276,14 +276,9 @@ impl IndependentNonReplacedContents {
} }
} }
#[cfg_attr( #[servo_tracing::instrument(
feature = "tracing", name = "IndependentNonReplacedContents::layout_with_caching",
tracing::instrument( skip_all
name = "IndependentNonReplacedContents::layout_with_caching",
skip_all,
fields(servo_profiling = true),
level = "trace",
)
)] )]
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn layout( pub fn layout(

View file

@ -223,10 +223,7 @@ impl Layout for LayoutThread {
); );
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn add_stylesheet( fn add_stylesheet(
&mut self, &mut self,
stylesheet: ServoArc<Stylesheet>, stylesheet: ServoArc<Stylesheet>,
@ -246,10 +243,7 @@ impl Layout for LayoutThread {
} }
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn remove_stylesheet(&mut self, stylesheet: ServoArc<Stylesheet>) { fn remove_stylesheet(&mut self, stylesheet: ServoArc<Stylesheet>) {
let guard = stylesheet.shared_lock.read(); let guard = stylesheet.shared_lock.read();
let stylesheet = DocumentStyleSheet(stylesheet.clone()); let stylesheet = DocumentStyleSheet(stylesheet.clone());
@ -258,37 +252,25 @@ impl Layout for LayoutThread {
.remove_all_web_fonts_from_stylesheet(&stylesheet); .remove_all_web_fonts_from_stylesheet(&stylesheet);
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_content_box(&self, node: TrustedNodeAddress) -> Option<UntypedRect<Au>> { fn query_content_box(&self, node: TrustedNodeAddress) -> Option<UntypedRect<Au>> {
let node = unsafe { ServoLayoutNode::new(&node) }; let node = unsafe { ServoLayoutNode::new(&node) };
process_content_box_request(node) process_content_box_request(node)
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_content_boxes(&self, node: TrustedNodeAddress) -> Vec<UntypedRect<Au>> { fn query_content_boxes(&self, node: TrustedNodeAddress) -> Vec<UntypedRect<Au>> {
let node = unsafe { ServoLayoutNode::new(&node) }; let node = unsafe { ServoLayoutNode::new(&node) };
process_content_boxes_request(node) process_content_boxes_request(node)
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_client_rect(&self, node: TrustedNodeAddress) -> UntypedRect<i32> { fn query_client_rect(&self, node: TrustedNodeAddress) -> UntypedRect<i32> {
let node = unsafe { ServoLayoutNode::new(&node) }; let node = unsafe { ServoLayoutNode::new(&node) };
process_client_rect_request(node) process_client_rect_request(node)
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_element_inner_outer_text( fn query_element_inner_outer_text(
&self, &self,
node: script_layout_interface::TrustedNodeAddress, node: script_layout_interface::TrustedNodeAddress,
@ -297,10 +279,7 @@ impl Layout for LayoutThread {
get_the_text_steps(node) get_the_text_steps(node)
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_nodes_from_point( fn query_nodes_from_point(
&self, &self,
point: UntypedPoint2D<f32>, point: UntypedPoint2D<f32>,
@ -323,19 +302,13 @@ impl Layout for LayoutThread {
results.iter().map(|result| result.node).collect() results.iter().map(|result| result.node).collect()
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_offset_parent(&self, node: TrustedNodeAddress) -> OffsetParentResponse { fn query_offset_parent(&self, node: TrustedNodeAddress) -> OffsetParentResponse {
let node = unsafe { ServoLayoutNode::new(&node) }; let node = unsafe { ServoLayoutNode::new(&node) };
process_offset_parent_query(node).unwrap_or_default() process_offset_parent_query(node).unwrap_or_default()
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_resolved_style( fn query_resolved_style(
&self, &self,
node: TrustedNodeAddress, node: TrustedNodeAddress,
@ -364,10 +337,7 @@ impl Layout for LayoutThread {
process_resolved_style_request(&shared_style_context, node, &pseudo, &property_id) process_resolved_style_request(&shared_style_context, node, &pseudo, &property_id)
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_resolved_font_style( fn query_resolved_font_style(
&self, &self,
node: TrustedNodeAddress, node: TrustedNodeAddress,
@ -400,19 +370,13 @@ impl Layout for LayoutThread {
) )
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_scrolling_area(&self, node: Option<TrustedNodeAddress>) -> UntypedRect<i32> { fn query_scrolling_area(&self, node: Option<TrustedNodeAddress>) -> UntypedRect<i32> {
let node = node.map(|node| unsafe { ServoLayoutNode::new(&node) }); let node = node.map(|node| unsafe { ServoLayoutNode::new(&node) });
process_node_scroll_area_request(node, self.fragment_tree.borrow().clone()) process_node_scroll_area_request(node, self.fragment_tree.borrow().clone())
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn query_text_indext( fn query_text_indext(
&self, &self,
node: OpaqueNode, node: OpaqueNode,
@ -612,10 +576,7 @@ impl LayoutThread {
} }
/// The high-level routine that performs layout. /// The high-level routine that performs layout.
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn handle_reflow(&mut self, mut reflow_request: ReflowRequest) -> Option<ReflowResult> { fn handle_reflow(&mut self, mut reflow_request: ReflowRequest) -> Option<ReflowResult> {
let document = unsafe { ServoLayoutNode::new(&reflow_request.document) }; let document = unsafe { ServoLayoutNode::new(&reflow_request.document) };
let document = document.as_document().unwrap(); let document = document.as_document().unwrap();
@ -779,10 +740,7 @@ impl LayoutThread {
.flush(guards, Some(root_element), Some(snapshot_map)); .flush(guards, Some(root_element), Some(snapshot_map));
} }
#[cfg_attr( #[servo_tracing::instrument(skip_all)]
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
fn restyle_and_build_trees( fn restyle_and_build_trees(
&self, &self,
reflow_request: &ReflowRequest, reflow_request: &ReflowRequest,

View file

@ -1510,15 +1510,7 @@ impl<'a> TableLayout<'a> {
/// Lay out the table (grid and captions) of this [`TableLayout`] into fragments. This should /// Lay out the table (grid and captions) of this [`TableLayout`] into fragments. This should
/// only be be called after calling [`TableLayout.compute_measures`]. /// only be be called after calling [`TableLayout.compute_measures`].
#[cfg_attr( #[servo_tracing::instrument(name = "Table::layout", skip_all)]
feature = "tracing",
tracing::instrument(
name = "Table::layout",
skip_all,
fields(servo_profiling = true),
level = "trace",
)
)]
fn layout( fn layout(
mut self, mut self,
layout_context: &LayoutContext, layout_context: &LayoutContext,
@ -2695,15 +2687,7 @@ impl Table {
} }
impl ComputeInlineContentSizes for Table { impl ComputeInlineContentSizes for Table {
#[cfg_attr( #[servo_tracing::instrument(name = "Table::compute_inline_content_sizes", skip_all)]
feature = "tracing",
tracing::instrument(
name = "Table::compute_inline_content_sizes",
skip_all,
fields(servo_profiling = true),
level = "trace",
)
)]
fn compute_inline_content_sizes( fn compute_inline_content_sizes(
&self, &self,
layout_context: &LayoutContext, layout_context: &LayoutContext,