From 04bcafa140dfee4ccc00e50423706287451e4d5d Mon Sep 17 00:00:00 2001 From: Bhuwan Pandit Date: Wed, 18 Jun 2025 17:18:04 +0100 Subject: [PATCH] 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 Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> --- Cargo.lock | 4 + components/compositing/Cargo.toml | 1 + components/compositing/compositor.rs | 15 +- components/constellation/Cargo.toml | 1 + components/constellation/constellation.rs | 429 +++++----------------- components/fonts/Cargo.toml | 1 + components/fonts/font.rs | 10 +- components/fonts/font_context.rs | 5 +- components/fonts/system_font_service.rs | 25 +- components/layout/Cargo.toml | 1 + components/layout/display_list/clip.rs | 10 +- components/layout/flexbox/layout.rs | 51 +-- components/layout/flow/inline/mod.rs | 10 +- components/layout/formatting_contexts.rs | 11 +- components/layout/layout_impl.rs | 70 +--- components/layout/table/layout.rs | 20 +- 16 files changed, 137 insertions(+), 527 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6496d0ef7f1..25bee65f5a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1104,6 +1104,7 @@ dependencies = [ "net", "pixels", "profile_traits", + "servo-tracing", "servo_allocator", "servo_config", "servo_geometry", @@ -1186,6 +1187,7 @@ dependencies = [ "script_layout_interface", "script_traits", "serde", + "servo-tracing", "servo_config", "servo_rand", "servo_url", @@ -2240,6 +2242,7 @@ dependencies = [ "range", "read-fonts", "serde", + "servo-tracing", "servo_allocator", "servo_arc", "servo_config", @@ -4251,6 +4254,7 @@ dependencies = [ "script_layout_interface", "script_traits", "selectors", + "servo-tracing", "servo_arc", "servo_config", "servo_geometry", diff --git a/components/compositing/Cargo.toml b/components/compositing/Cargo.toml index 084bb54a5fc..2b35725c573 100644 --- a/components/compositing/Cargo.toml +++ b/components/compositing/Cargo.toml @@ -44,6 +44,7 @@ webrender = { workspace = true } webrender_api = { workspace = true } webxr = { path = "../webxr", optional = true } wr_malloc_size_of = { workspace = true } +servo-tracing = { workspace = true } [dev-dependencies] surfman = { workspace = true } diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 270f984c8b3..8123c2b86e2 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -1503,10 +1503,7 @@ impl IOCompositor { })) } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn render_inner(&mut self) -> Result<(), UnableToComposite> { if let Err(err) = self.rendering_context.make_current() { warn!("Failed to make the rendering context current: {:?}", err); @@ -1660,10 +1657,7 @@ impl IOCompositor { Ref::map(self.global.borrow(), |global| &global.compositor_receiver) } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] pub fn handle_messages(&mut self, mut messages: Vec) { // Check for new messages coming from the other threads in the system. let mut found_recomposite_msg = false; @@ -1700,10 +1694,7 @@ impl IOCompositor { } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] pub fn perform_updates(&mut self) -> bool { if self.global.borrow().shutdown_state() == ShutdownState::FinishedShuttingDown { return false; diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml index 1053a23948a..dd1e407b3c2 100644 --- a/components/constellation/Cargo.toml +++ b/components/constellation/Cargo.toml @@ -53,6 +53,7 @@ webgpu_traits = { workspace = true } webrender = { workspace = true } webrender_api = { workspace = true } 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] gaol = "0.2.1" diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 0b03afc6e08..d320e5c958d 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -586,14 +586,7 @@ where { /// Create a new constellation thread. #[allow(clippy::too_many_arguments)] - #[cfg_attr( - feature = "tracing", - tracing::instrument( - skip(state, layout_factory), - fields(servo_profiling = true), - level = "trace", - ) - )] + #[servo_tracing::instrument(skip(state, layout_factory))] pub fn start( state: InitialConstellationState, layout_factory: Arc, @@ -1157,10 +1150,7 @@ where } /// Handles loading pages, navigation, and granting access to the compositor - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_request(&mut self) { #[derive(Debug)] enum Request { @@ -1251,19 +1241,13 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_request_for_pipeline_namespace(&mut self, request: PipelineNamespaceRequest) { let PipelineNamespaceRequest(sender) = request; let _ = sender.send(self.next_pipeline_namespace_id()); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_request_from_background_hang_monitor(&self, message: HangMonitorAlert) { match message { HangMonitorAlert::Profile(bytes) => { @@ -1286,10 +1270,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_request_from_compositor(&mut self, message: EmbedderToConstellationMessage) { trace_msg_from_compositor!(message, "{message:?}"); match message { @@ -1496,10 +1477,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_evaluate_javascript( &mut self, webview_id: WebViewId, @@ -1535,10 +1513,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_request_from_script(&mut self, message: (PipelineId, ScriptToConstellationMessage)) { let (source_pipeline_id, content) = message; trace_script_msg!(content, "{source_pipeline_id}: {content:?}"); @@ -1912,10 +1887,7 @@ where } /// Broadcast a message via routers in various event-loops. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_schedule_broadcast( &self, pipeline_id: PipelineId, @@ -1959,10 +1931,7 @@ where } /// Remove a channel-name for a given broadcast router. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_remove_broadcast_channel_name_in_router( &mut self, pipeline_id: PipelineId, @@ -1998,10 +1967,7 @@ where } /// Note a new channel-name relevant to a given broadcast router. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_new_broadcast_channel_name_in_router( &mut self, pipeline_id: PipelineId, @@ -2023,10 +1989,7 @@ where } /// Remove a broadcast router. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_remove_broadcast_channel_router( &mut self, pipeline_id: PipelineId, @@ -2045,10 +2008,7 @@ where } /// Add a new broadcast router. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_new_broadcast_channel_router( &mut self, pipeline_id: PipelineId, @@ -2071,10 +2031,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] #[cfg(feature = "webgpu")] fn handle_wgpu_request( &mut self, @@ -2155,10 +2112,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_message_port_transfer_completed( &mut self, router_id: Option, @@ -2286,10 +2240,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_complete_message_port_transfer( &mut self, router_id: MessagePortRouterId, @@ -2366,10 +2317,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_reroute_messageport(&mut self, port_id: MessagePortId, task: PortMessageTask) { let info = match self.message_ports.get_mut(&port_id) { Some(info) => info, @@ -2397,10 +2345,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_messageport_shipped(&mut self, port_id: MessagePortId) { if let Some(info) = self.message_ports.get_mut(&port_id) { match info.state { @@ -2455,10 +2400,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_entangle_messageports(&mut self, port1: MessagePortId, port2: MessagePortId) { if let Some(info) = self.message_ports.get_mut(&port1) { info.entangled_with = Some(port2); @@ -2478,10 +2420,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] /// fn handle_disentangle_messageports( &mut self, @@ -2535,10 +2474,7 @@ where /// /// The Job Queue is essentially the channel to a SW manager, /// which are scoped per origin. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_schedule_serviceworker_job(&mut self, pipeline_id: PipelineId, job: Job) { let origin = job.scope_url.origin(); @@ -2589,10 +2525,7 @@ where let _ = sw_manager.send(ServiceWorkerMsg::ScheduleJob(job)); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_broadcast_storage_event( &self, pipeline_id: PipelineId, @@ -2623,10 +2556,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_exit(&mut self) { debug!("Handling exit."); @@ -2707,10 +2637,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_shutdown(&mut self) { debug!("Handling shutdown."); @@ -2855,10 +2782,7 @@ where )); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_send_error(&mut self, pipeline_id: PipelineId, err: IpcError) { // Treat send error the same as receiving a panic message error!("{}: Send error ({})", pipeline_id, err); @@ -2870,10 +2794,7 @@ where self.handle_panic(webview_id, reason, None); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_panic( &mut self, webview_id: Option, @@ -2972,10 +2893,7 @@ where }); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_focus_web_view(&mut self, webview_id: WebViewId) { if self.webviews.get(webview_id).is_none() { return warn!("{webview_id}: FocusWebView on unknown top-level browsing context"); @@ -2985,10 +2903,7 @@ where .send(EmbedderMsg::WebViewFocused(webview_id)); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true)) - )] + #[servo_tracing::instrument(skip_all)] fn handle_log_entry( &mut self, webview_id: Option, @@ -3137,10 +3052,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_new_top_level_browsing_context( &mut self, url: ServoUrl, @@ -3209,10 +3121,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_close_top_level_browsing_context(&mut self, webview_id: WebViewId) { debug!("{webview_id}: Closing"); let browsing_context_id = BrowsingContextId::from(webview_id); @@ -3247,10 +3156,7 @@ where debug!("{webview_id}: Closed"); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_iframe_size_msg(&mut self, iframe_sizes: Vec) { for IFrameSizeMsg { browsing_context_id, @@ -3262,10 +3168,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_finish_javascript_evaluation( &mut self, evaluation_id: JavaScriptEvaluationId, @@ -3278,10 +3181,7 @@ where )); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_subframe_loaded(&mut self, pipeline_id: PipelineId) { let browsing_context_id = match self.pipelines.get(&pipeline_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 // a child being added to the parent browsing context. This message is never // the result of a page navigation. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfoWithData) { let IFrameLoadInfo { parent_pipeline_id, @@ -3436,10 +3333,7 @@ where }); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_script_new_iframe(&mut self, load_info: IFrameLoadInfoWithData) { let IFrameLoadInfo { parent_pipeline_id, @@ -3500,10 +3394,7 @@ where }); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_script_new_auxiliary(&mut self, load_info: AuxiliaryWebViewCreationRequest) { let AuxiliaryWebViewCreationRequest { load_data, @@ -3611,19 +3502,13 @@ where }); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_set_cursor_msg(&mut self, webview_id: WebViewId, cursor: Cursor) { self.embedder_proxy .send(EmbedderMsg::SetCursor(webview_id, cursor)); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_change_running_animations_state( &mut self, pipeline_id: PipelineId, @@ -3642,10 +3527,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_tick_animation(&mut self, webview_ids: Vec) { let mut animating_event_loops = HashSet::new(); @@ -3670,10 +3552,7 @@ where /// Schedule a navigation(via load_url). /// 1: Ask the embedder for permission. /// 2: Store the details of the navigation, pending approval from the embedder. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn schedule_navigation( &mut self, webview_id: WebViewId, @@ -3701,10 +3580,7 @@ where )); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn load_url( &mut self, webview_id: WebViewId, @@ -3835,10 +3711,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_abort_load_url_msg(&mut self, new_pipeline_id: PipelineId) { let pending_index = self .pending_changes @@ -3856,10 +3729,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_load_complete_msg(&mut self, webview_id: WebViewId, pipeline_id: PipelineId) { let mut webdriver_reset = false; if let Some((expected_pipeline_id, ref reply_chan)) = self.webdriver.load_channel { @@ -3904,10 +3774,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_navigated_to_fragment( &mut self, pipeline_id: PipelineId, @@ -3940,10 +3807,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_traverse_history_msg( &mut self, webview_id: WebViewId, @@ -4085,10 +3949,7 @@ where self.update_webview_in_compositor(webview_id); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn update_browsing_context( &mut self, browsing_context_id: BrowsingContextId, @@ -4215,10 +4076,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn update_pipeline( &mut self, pipeline_id: PipelineId, @@ -4245,10 +4103,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_joint_session_history_length( &self, webview_id: WebViewId, @@ -4262,10 +4117,7 @@ where let _ = response_sender.send(length as u32); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_push_history_state_msg( &mut self, pipeline_id: PipelineId, @@ -4299,10 +4151,7 @@ where self.notify_history_changed(webview_id); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_replace_history_state_msg( &mut self, pipeline_id: PipelineId, @@ -4327,10 +4176,7 @@ where session_history.replace_history_state(pipeline_id, history_state_id, url); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_reload_msg(&mut self, webview_id: WebViewId) { let browsing_context_id = BrowsingContextId::from(webview_id); let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) { @@ -4349,10 +4195,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_post_message_msg( &mut self, browsing_context_id: BrowsingContextId, @@ -4391,10 +4234,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_focus_msg( &mut self, pipeline_id: PipelineId, @@ -4465,10 +4305,7 @@ where /// belongs to the document. /// /// [1]: https://html.spec.whatwg.org/multipage/#focusing-steps - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn focus_browsing_context( &mut self, initiator_pipeline_id: Option, @@ -4622,10 +4459,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_remove_iframe_msg( &mut self, browsing_context_id: BrowsingContextId, @@ -4638,10 +4472,7 @@ where result } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_set_throttled_complete(&mut self, pipeline_id: PipelineId, throttled: bool) { let browsing_context_id = match self.pipelines.get(&pipeline_id) { Some(pipeline) => pipeline.browsing_context_id, @@ -4676,10 +4507,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_create_canvas_paint_thread_msg( &mut self, size: UntypedSize2D, @@ -4703,10 +4531,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_webdriver_msg(&mut self, msg: WebDriverCommandMsg) { // Find the script channel for the given parent pipeline, // and pass the event to that script thread. @@ -4943,10 +4768,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn set_webview_throttled(&mut self, webview_id: WebViewId, throttled: bool) { let browsing_context_id = BrowsingContextId::from(webview_id); let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) { @@ -4961,10 +4783,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn notify_history_changed(&self, webview_id: WebViewId) { // Send a flat projection of the history to embedder. // The final vector is a concatenation of the URLs of the past @@ -5078,10 +4897,7 @@ where )); } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn load_url_for_webdriver( &mut self, webview_id: WebViewId, @@ -5113,10 +4929,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn change_session_history(&mut self, change: SessionHistoryChange) { debug!( "{}: Setting to {}", @@ -5303,10 +5116,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn focused_browsing_context_is_descendant_of( &self, browsing_context_id: BrowsingContextId, @@ -5322,10 +5132,7 @@ where }) } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn trim_history(&mut self, webview_id: WebViewId) { let pipelines_to_evict = { let session_history = self.get_joint_session_history(webview_id); @@ -5385,10 +5192,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_activate_document_msg(&mut self, pipeline_id: PipelineId) { debug!("{}: Document ready to activate", pipeline_id); @@ -5434,10 +5238,7 @@ where } /// Called when the window is resized. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_change_viewport_details_msg( &mut self, webview_id: WebViewId, @@ -5458,10 +5259,7 @@ where } /// Called when the window exits from fullscreen mode - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_exit_fullscreen_msg(&mut self, webview_id: WebViewId) { let browsing_context_id = BrowsingContextId::from(webview_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 /// for reftests. /// Since this function is only used in reftests, we do not harden it against panic. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_is_ready_to_save_image( &mut self, pipeline_states: HashMap, @@ -5555,10 +5350,7 @@ where } /// Get the current activity of a pipeline. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn get_activity(&self, pipeline_id: PipelineId) -> DocumentActivity { let mut ancestor_id = pipeline_id; loop { @@ -5585,10 +5377,7 @@ where } /// Set the current activity of a pipeline. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn set_activity(&self, pipeline_id: PipelineId, activity: DocumentActivity) { debug!("{}: Setting activity to {:?}", pipeline_id, activity); if let Some(pipeline) = self.pipelines.get(&pipeline_id) { @@ -5607,20 +5396,14 @@ where } /// Update the current activity of a pipeline. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn update_activity(&self, pipeline_id: PipelineId) { self.set_activity(pipeline_id, self.get_activity(pipeline_id)); } /// Handle updating the size of a browsing context. /// This notifies every pipeline in the context of the new size. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn resize_browsing_context( &mut self, new_viewport_details: ViewportDetails, @@ -5677,10 +5460,7 @@ where } /// Handle theme change events from the embedder and forward them to all appropriate `ScriptThread`s. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_theme_change(&mut self, webview_id: WebViewId, theme: Theme) { let Some(webview) = self.webviews.get_mut(webview_id) else { warn!("Received theme change request for uknown WebViewId: {webview_id:?}"); @@ -5707,10 +5487,7 @@ where } // Handle switching from fullscreen mode - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn switch_fullscreen_mode(&mut self, browsing_context_id: BrowsingContextId) { if let Some(browsing_context) = self.browsing_contexts.get(&browsing_context_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. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn close_browsing_context( &mut self, browsing_context_id: BrowsingContextId, @@ -5795,10 +5569,7 @@ where } // Close the children of a browsing context - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn close_browsing_context_children( &mut self, browsing_context_id: BrowsingContextId, @@ -5829,10 +5600,7 @@ where } // Discard the pipeline for a given document, udpdate the joint session history. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_discard_document(&mut self, webview_id: WebViewId, pipeline_id: PipelineId) { match self.webviews.get_mut(webview_id) { Some(webview) => { @@ -5860,10 +5628,7 @@ where } // Send a message to script requesting the document associated with this pipeline runs the 'unload' algorithm. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn unload_document(&self, pipeline_id: PipelineId) { if let Some(pipeline) = self.pipelines.get(&pipeline_id) { let msg = ScriptThreadMessage::UnloadDocument(pipeline_id); @@ -5872,10 +5637,7 @@ where } // Close all pipelines at and beneath a given browsing context - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn close_pipeline( &mut self, pipeline_id: PipelineId, @@ -5937,10 +5699,7 @@ where } // Randomly close a pipeline -if --random-pipeline-closure-probability is set - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn maybe_close_random_pipeline(&mut self) { match self.random_pipeline_closure { Some((ref mut rng, probability)) => { @@ -5978,10 +5737,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn get_joint_session_history(&mut self, top_level_id: WebViewId) -> &mut JointSessionHistory { self.webviews .get_mut(top_level_id) @@ -5990,10 +5746,7 @@ where } // Convert a browsing context to a sendable form to pass to the compositor - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn browsing_context_to_sendable( &self, browsing_context_id: BrowsingContextId, @@ -6023,10 +5776,7 @@ where } /// Send the frame tree for the given webview to the compositor. - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn update_webview_in_compositor(&mut self, webview_id: WebViewId) { // Note that this function can panic, due to ipc-channel creation failure. // avoiding this panic would require a mechanism for dealing @@ -6039,10 +5789,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_media_session_action_msg(&mut self, action: MediaSessionActionType) { if let Some(media_session_pipeline_id) = self.active_media_session { let result = match self.pipelines.get(&media_session_pipeline_id) { @@ -6066,10 +5813,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_set_scroll_states( &self, pipeline_id: PipelineId, @@ -6090,10 +5834,7 @@ where } } - #[cfg_attr( - feature = "tracing", - tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace") - )] + #[servo_tracing::instrument(skip_all)] fn handle_paint_metric(&mut self, pipeline_id: PipelineId, event: PaintMetricEvent) { let Some(pipeline) = self.pipelines.get(&pipeline_id) else { warn!("Discarding paint metric event for unknown pipeline"); diff --git a/components/fonts/Cargo.toml b/components/fonts/Cargo.toml index 70d272bf147..876ae1e5e73 100644 --- a/components/fonts/Cargo.toml +++ b/components/fonts/Cargo.toml @@ -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 } diff --git a/components/fonts/font.rs b/components/fonts/font.rs index 13dd579cdc6..27ac77f5eb8 100644 --- a/components/fonts/font.rs +++ b/components/fonts/font.rs @@ -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, diff --git a/components/fonts/font_context.rs b/components/fonts/font_context.rs index 58c08b29d3e..01b7e2a0977 100644 --- a/components/fonts/font_context.rs +++ b/components/fonts/font_context.rs @@ -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, diff --git a/components/fonts/system_font_service.rs b/components/fonts/system_font_service.rs index f799affa7c8..ec5fe0e77f2 100644 --- a/components/fonts/system_font_service.rs +++ b/components/fonts/system_font_service.rs @@ -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, @@ -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, diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index 0e4cd0b79fd..72ed7e4aa25 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -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 } diff --git a/components/layout/display_list/clip.rs b/components/layout/display_list/clip.rs index d5bd0f52b69..11c0a2ce5fe 100644 --- a/components/layout/display_list/clip.rs +++ b/components/layout/display_list/clip.rs @@ -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, diff --git a/components/layout/flexbox/layout.rs b/components/layout/flexbox/layout.rs index 985f5f3cf65..6a4e3f386b1 100644 --- a/components/layout/flexbox/layout.rs +++ b/components/layout/flexbox/layout.rs @@ -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 { } /// - #[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 : /// > 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, diff --git a/components/layout/flow/inline/mod.rs b/components/layout/flow/inline/mod.rs index 6fd4a51a526..8a3df569822 100644 --- a/components/layout/flow/inline/mod.rs +++ b/components/layout/flow/inline/mod.rs @@ -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, diff --git a/components/layout/formatting_contexts.rs b/components/layout/formatting_contexts.rs index 2b242c00361..aef35fb8d12 100644 --- a/components/layout/formatting_contexts.rs +++ b/components/layout/formatting_contexts.rs @@ -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( diff --git a/components/layout/layout_impl.rs b/components/layout/layout_impl.rs index 7507e705d30..fcadda07887 100644 --- a/components/layout/layout_impl.rs +++ b/components/layout/layout_impl.rs @@ -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, @@ -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) { 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> { 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> { 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 { 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, @@ -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) -> UntypedRect { 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 { 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, diff --git a/components/layout/table/layout.rs b/components/layout/table/layout.rs index 5b7e79d7fb0..b9593ba4f7a 100644 --- a/components/layout/table/layout.rs +++ b/components/layout/table/layout.rs @@ -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,