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

This pull request refactors existing tracing annotations to leverage the
new `servo_tracing::instrument` macro introduced in #36573.

Specifically, the following transformations were applied:
- Removed `#[cfg_attr(feature = "tracing", ...)]` wrappers.
- Replaced `tracing::instrument` with `servo_tracing::instrument`.
- Removed `level = "trace"`
- Removed `fields(servo_profiling = true)` from tracing attributes
however retained others like `name`. `skip type`

Closes: #36661

---------

Signed-off-by: Bhuwan Pandit <bhuwanpandit109@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
This commit is contained in:
Bhuwan Pandit 2025-06-18 17:18:04 +01:00 committed by GitHub
parent bdf8c0ebc8
commit 04bcafa140
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 137 additions and 527 deletions

View file

@ -53,6 +53,7 @@ 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"

View file

@ -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<dyn LayoutFactory>,
@ -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<MessagePortRouterId>,
@ -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)]
/// <https://html.spec.whatwg.org/multipage/#disentangle>
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<WebViewId>,
@ -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<WebViewId>,
@ -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<IFrameSizeMsg>) {
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<WebViewId>) {
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<PipelineId>,
@ -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<u64>,
@ -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<PipelineId, Epoch>,
@ -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");