mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Gate all use of tracing
behind Cargo feature (#33845)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
103d3aa7bb
commit
fa1f7e5839
15 changed files with 534 additions and 156 deletions
|
@ -151,7 +151,6 @@ use servo_config::{opts, pref};
|
|||
use servo_rand::{random, Rng, ServoRng, SliceRandom};
|
||||
use servo_url::{Host, ImmutableOrigin, ServoUrl};
|
||||
use style_traits::CSSPixel;
|
||||
use tracing::{instrument, span, Level};
|
||||
use webgpu::swapchain::WGPUImageMap;
|
||||
use webgpu::{self, WebGPU, WebGPURequest, WebGPUResponse};
|
||||
use webrender::{RenderApi, RenderApiSender};
|
||||
|
@ -609,7 +608,10 @@ where
|
|||
{
|
||||
/// Create a new constellation thread.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[tracing::instrument(skip(state, layout_factory), fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip(state, layout_factory), fields(servo_profiling = true))
|
||||
)]
|
||||
pub fn start(
|
||||
state: InitialConstellationState,
|
||||
layout_factory: Arc<dyn LayoutFactory>,
|
||||
|
@ -1153,7 +1155,10 @@ where
|
|||
}
|
||||
|
||||
/// Handles loading pages, navigation, and granting access to the compositor
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_request(&mut self) {
|
||||
#[derive(Debug)]
|
||||
enum Request {
|
||||
|
@ -1250,13 +1255,19 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_request_for_pipeline_namespace(&mut self, request: PipelineNamespaceRequest) {
|
||||
let PipelineNamespaceRequest(sender) = request;
|
||||
let _ = sender.send(self.next_pipeline_namespace_id());
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_request_from_background_hang_monitor(&self, message: HangMonitorAlert) {
|
||||
match message {
|
||||
HangMonitorAlert::Profile(bytes) => self
|
||||
|
@ -1270,7 +1281,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_request_from_network_listener(&mut self, message: (PipelineId, FetchResponseMsg)) {
|
||||
let (id, message_) = message;
|
||||
let result = match self.pipelines.get(&id) {
|
||||
|
@ -1296,7 +1310,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_request_from_compositor(&mut self, message: FromCompositorMsg) {
|
||||
trace_msg_from_compositor!(message, "{message:?}");
|
||||
match message {
|
||||
|
@ -1509,11 +1526,13 @@ where
|
|||
self.set_webview_throttled(webview_id, throttled);
|
||||
},
|
||||
FromCompositorMsg::ReadyToPresent(webview_ids) => {
|
||||
let span = span!(
|
||||
Level::TRACE,
|
||||
#[cfg(feature = "tracing")]
|
||||
let span = tracing::span!(
|
||||
tracing::Level::TRACE,
|
||||
"FromCompositorMsg::ReadyToPresent",
|
||||
servo_profiling = true
|
||||
);
|
||||
#[cfg(feature = "tracing")]
|
||||
let _enter = span.enter();
|
||||
self.embedder_proxy
|
||||
.send((None, EmbedderMsg::ReadyToPresent(webview_ids)));
|
||||
|
@ -1524,7 +1543,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_request_from_script(&mut self, message: (PipelineId, FromScriptMsg)) {
|
||||
let (source_pipeline_id, content) = message;
|
||||
trace_script_msg!(content, "{source_pipeline_id}: {content:?}");
|
||||
|
@ -1842,7 +1864,10 @@ where
|
|||
}
|
||||
|
||||
/// Broadcast a message via routers in various event-loops.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_schedule_broadcast(
|
||||
&self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -1886,7 +1911,10 @@ where
|
|||
}
|
||||
|
||||
/// Remove a channel-name for a given broadcast router.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_remove_broadcast_channel_name_in_router(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -1922,7 +1950,10 @@ where
|
|||
}
|
||||
|
||||
/// Note a new channel-name relevant to a given broadcast router.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_new_broadcast_channel_name_in_router(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -1944,7 +1975,10 @@ where
|
|||
}
|
||||
|
||||
/// Remove a broadcast router.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_remove_broadcast_channel_router(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -1963,7 +1997,10 @@ where
|
|||
}
|
||||
|
||||
/// Add a new broadcast router.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_new_broadcast_channel_router(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -1986,7 +2023,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_wgpu_request(
|
||||
&mut self,
|
||||
source_pipeline_id: PipelineId,
|
||||
|
@ -2064,7 +2104,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_request_from_layout(&mut self, message: FromLayoutMsg) {
|
||||
trace_layout_msg!(message, "{message:?}");
|
||||
match message {
|
||||
|
@ -2079,7 +2122,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_message_port_transfer_completed(
|
||||
&mut self,
|
||||
router_id: Option<MessagePortRouterId>,
|
||||
|
@ -2218,7 +2264,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_complete_message_port_transfer(
|
||||
&mut self,
|
||||
router_id: MessagePortRouterId,
|
||||
|
@ -2299,7 +2348,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_reroute_messageport(&mut self, port_id: MessagePortId, task: PortMessageTask) {
|
||||
let info = match self.message_ports.get_mut(&port_id) {
|
||||
Some(info) => info,
|
||||
|
@ -2331,7 +2383,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_messageport_shipped(&mut self, port_id: MessagePortId) {
|
||||
if let Some(info) = self.message_ports.get_mut(&port_id) {
|
||||
match info.state {
|
||||
|
@ -2386,7 +2441,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_remove_messageport(&mut self, port_id: MessagePortId) {
|
||||
let entangled = match self.message_ports.remove(&port_id) {
|
||||
Some(info) => info.entangled_with,
|
||||
|
@ -2434,7 +2492,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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);
|
||||
|
@ -2460,7 +2521,10 @@ where
|
|||
///
|
||||
/// The Job Queue is essentially the channel to a SW manager,
|
||||
/// which are scoped per origin.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_schedule_serviceworker_job(&mut self, pipeline_id: PipelineId, job: Job) {
|
||||
let origin = job.scope_url.origin();
|
||||
|
||||
|
@ -2500,7 +2564,10 @@ where
|
|||
let _ = sw_manager.send(ServiceWorkerMsg::ScheduleJob(job));
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_broadcast_storage_event(
|
||||
&self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -2531,7 +2598,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_exit(&mut self) {
|
||||
debug!("Handling exit.");
|
||||
|
||||
|
@ -2612,7 +2682,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_shutdown(&mut self) {
|
||||
debug!("Handling shutdown.");
|
||||
|
||||
|
@ -2737,7 +2810,10 @@ where
|
|||
self.pipelines.remove(&pipeline_id);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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);
|
||||
|
@ -2749,7 +2825,10 @@ where
|
|||
self.handle_panic(top_level_browsing_context_id, reason, None);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_panic(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: Option<TopLevelBrowsingContextId>,
|
||||
|
@ -2847,7 +2926,10 @@ where
|
|||
});
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_log_entry(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: Option<TopLevelBrowsingContextId>,
|
||||
|
@ -2927,7 +3009,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_new_top_level_browsing_context(
|
||||
&mut self,
|
||||
url: ServoUrl,
|
||||
|
@ -2994,7 +3079,10 @@ where
|
|||
});
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_close_top_level_browsing_context(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -3041,7 +3129,10 @@ where
|
|||
debug!("{top_level_browsing_context_id}: Closed");
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_iframe_size_msg(&mut self, iframe_sizes: Vec<IFrameSizeMsg>) {
|
||||
for IFrameSizeMsg {
|
||||
browsing_context_id,
|
||||
|
@ -3058,7 +3149,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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,
|
||||
|
@ -3099,7 +3193,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_navigate_request(
|
||||
&self,
|
||||
id: PipelineId,
|
||||
|
@ -3120,7 +3217,10 @@ 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.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfoWithData) {
|
||||
let IFrameLoadInfo {
|
||||
parent_pipeline_id,
|
||||
|
@ -3227,7 +3327,10 @@ where
|
|||
});
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_script_new_iframe(&mut self, load_info: IFrameLoadInfoWithData) {
|
||||
let IFrameLoadInfo {
|
||||
parent_pipeline_id,
|
||||
|
@ -3288,7 +3391,10 @@ where
|
|||
});
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_script_new_auxiliary(&mut self, load_info: AuxiliaryBrowsingContextLoadInfo) {
|
||||
let AuxiliaryBrowsingContextLoadInfo {
|
||||
load_data,
|
||||
|
@ -3374,19 +3480,28 @@ where
|
|||
});
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_pending_paint_metric(&self, pipeline_id: PipelineId, epoch: Epoch) {
|
||||
self.compositor_proxy
|
||||
.send(CompositorMsg::PendingPaintMetric(pipeline_id, epoch))
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_set_cursor_msg(&mut self, cursor: Cursor) {
|
||||
self.embedder_proxy
|
||||
.send((None, EmbedderMsg::SetCursor(cursor)))
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_change_running_animations_state(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -3404,7 +3519,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_tick_animation(&mut self, pipeline_id: PipelineId, tick_type: AnimationTickType) {
|
||||
let pipeline = match self.pipelines.get(&pipeline_id) {
|
||||
Some(pipeline) => pipeline,
|
||||
|
@ -3420,7 +3538,10 @@ 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.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn schedule_navigation(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -3447,7 +3568,10 @@ where
|
|||
self.embedder_proxy.send(msg);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn load_url(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -3576,7 +3700,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_abort_load_url_msg(&mut self, new_pipeline_id: PipelineId) {
|
||||
let pending_index = self
|
||||
.pending_changes
|
||||
|
@ -3594,7 +3721,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_load_complete_msg(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -3643,7 +3773,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_navigated_to_fragment(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -3675,7 +3808,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_traverse_history_msg(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -3817,7 +3953,10 @@ where
|
|||
self.update_webview_in_compositor(top_level_browsing_context_id);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn update_browsing_context(
|
||||
&mut self,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
|
@ -3942,7 +4081,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn update_pipeline(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -3969,7 +4111,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_joint_session_history_length(
|
||||
&self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -3983,7 +4128,10 @@ where
|
|||
let _ = response_sender.send(length as u32);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_push_history_state_msg(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -4023,7 +4171,10 @@ where
|
|||
self.notify_history_changed(top_level_browsing_context_id);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_replace_history_state_msg(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -4048,7 +4199,10 @@ where
|
|||
session_history.replace_history_state(pipeline_id, history_state_id, url);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_ime_dismissed(&mut self) {
|
||||
// Send to the focused browsing contexts' current pipeline.
|
||||
let focused_browsing_context_id = self
|
||||
|
@ -4079,7 +4233,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_key_msg(&mut self, event: KeyboardEvent) {
|
||||
// Send to the focused browsing contexts' current pipeline. If it
|
||||
// doesn't exist, fall back to sending to the compositor.
|
||||
|
@ -4118,7 +4275,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_reload_msg(&mut self, top_level_browsing_context_id: TopLevelBrowsingContextId) {
|
||||
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
|
||||
let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) {
|
||||
|
@ -4137,7 +4297,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_post_message_msg(
|
||||
&mut self,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
|
@ -4176,7 +4339,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_get_pipeline(
|
||||
&mut self,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
|
@ -4198,7 +4364,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_get_browsing_context(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -4213,7 +4382,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_focus_msg(&mut self, pipeline_id: PipelineId) {
|
||||
let (browsing_context_id, top_level_browsing_context_id) =
|
||||
match self.pipelines.get(&pipeline_id) {
|
||||
|
@ -4248,7 +4420,10 @@ where
|
|||
self.focus_parent_pipeline(browsing_context_id);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn focus_parent_pipeline(&mut self, browsing_context_id: BrowsingContextId) {
|
||||
let parent_pipeline_id = match self.browsing_contexts.get(&browsing_context_id) {
|
||||
Some(ctx) => ctx.parent_pipeline_id,
|
||||
|
@ -4279,7 +4454,10 @@ where
|
|||
self.focus_parent_pipeline(parent_browsing_context_id);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_remove_iframe_msg(
|
||||
&mut self,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
|
@ -4292,7 +4470,10 @@ where
|
|||
result
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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,
|
||||
|
@ -4327,7 +4508,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_create_canvas_paint_thread_msg(
|
||||
&mut self,
|
||||
size: UntypedSize2D<u64>,
|
||||
|
@ -4351,7 +4535,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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.
|
||||
|
@ -4482,7 +4669,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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) {
|
||||
|
@ -4497,7 +4687,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn notify_history_changed(&self, top_level_browsing_context_id: TopLevelBrowsingContextId) {
|
||||
// Send a flat projection of the history to embedder.
|
||||
// The final vector is a concatenation of the LoadData of the past
|
||||
|
@ -4614,7 +4807,10 @@ where
|
|||
self.embedder_proxy.send(msg);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn load_url_for_webdriver(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -4642,7 +4838,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn change_session_history(&mut self, change: SessionHistoryChange) {
|
||||
debug!(
|
||||
"{}: Setting to {}",
|
||||
|
@ -4797,7 +4996,10 @@ where
|
|||
self.update_webview_in_compositor(change.top_level_browsing_context_id);
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn focused_browsing_context_is_descendant_of(
|
||||
&self,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
|
@ -4813,7 +5015,10 @@ where
|
|||
})
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn trim_history(&mut self, top_level_browsing_context_id: TopLevelBrowsingContextId) {
|
||||
let pipelines_to_evict = {
|
||||
let session_history = self.get_joint_session_history(top_level_browsing_context_id);
|
||||
|
@ -4873,7 +5078,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_activate_document_msg(&mut self, pipeline_id: PipelineId) {
|
||||
debug!("{}: Document ready to activate", pipeline_id);
|
||||
|
||||
|
@ -4919,7 +5127,10 @@ where
|
|||
}
|
||||
|
||||
/// Called when the window is resized.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_window_size_msg(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -4942,7 +5153,10 @@ where
|
|||
}
|
||||
|
||||
/// Called when the window exits from fullscreen mode
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_exit_fullscreen_msg(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -4956,7 +5170,10 @@ 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.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_is_ready_to_save_image(
|
||||
&mut self,
|
||||
pipeline_states: HashMap<PipelineId, Epoch>,
|
||||
|
@ -5040,7 +5257,10 @@ where
|
|||
}
|
||||
|
||||
/// Get the current activity of a pipeline.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn get_activity(&self, pipeline_id: PipelineId) -> DocumentActivity {
|
||||
let mut ancestor_id = pipeline_id;
|
||||
loop {
|
||||
|
@ -5067,7 +5287,10 @@ where
|
|||
}
|
||||
|
||||
/// Set the current activity of a pipeline.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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) {
|
||||
|
@ -5086,14 +5309,20 @@ where
|
|||
}
|
||||
|
||||
/// Update the current activity of a pipeline.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn resize_browsing_context(
|
||||
&mut self,
|
||||
new_size: WindowSizeData,
|
||||
|
@ -5150,7 +5379,10 @@ where
|
|||
}
|
||||
|
||||
// Handle switching from fullscreen mode
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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;
|
||||
|
@ -5170,7 +5402,10 @@ where
|
|||
}
|
||||
|
||||
// Close and return the browsing context with the given id (and its children), if it exists.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn close_browsing_context(
|
||||
&mut self,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
|
@ -5210,7 +5445,10 @@ where
|
|||
}
|
||||
|
||||
// Close the children of a browsing context
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn close_browsing_context_children(
|
||||
&mut self,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
|
@ -5241,7 +5479,10 @@ where
|
|||
}
|
||||
|
||||
// Discard the pipeline for a given document, udpdate the joint session history.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_discard_document(
|
||||
&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
|
@ -5273,7 +5514,10 @@ where
|
|||
}
|
||||
|
||||
// Send a message to script requesting the document associated with this pipeline runs the 'unload' algorithm.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn unload_document(&self, pipeline_id: PipelineId) {
|
||||
if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
|
||||
let msg = ConstellationControlMsg::UnloadDocument(pipeline_id);
|
||||
|
@ -5282,7 +5526,10 @@ where
|
|||
}
|
||||
|
||||
// Close all pipelines at and beneath a given browsing context
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn close_pipeline(
|
||||
&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -5346,7 +5593,10 @@ where
|
|||
}
|
||||
|
||||
// Randomly close a pipeline -if --random-pipeline-closure-probability is set
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn maybe_close_random_pipeline(&mut self) {
|
||||
match self.random_pipeline_closure {
|
||||
Some((ref mut rng, probability)) => {
|
||||
|
@ -5384,7 +5634,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn get_joint_session_history(
|
||||
&mut self,
|
||||
top_level_id: TopLevelBrowsingContextId,
|
||||
|
@ -5396,7 +5649,10 @@ where
|
|||
}
|
||||
|
||||
// Convert a browsing context to a sendable form to pass to the compositor
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn browsing_context_to_sendable(
|
||||
&self,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
|
@ -5426,7 +5682,10 @@ where
|
|||
}
|
||||
|
||||
/// Send the frame tree for the given webview to the compositor.
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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
|
||||
|
@ -5439,7 +5698,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
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) {
|
||||
|
@ -5466,7 +5728,10 @@ where
|
|||
}
|
||||
|
||||
/// Handle GamepadEvents from the embedder and forward them to the script thread
|
||||
#[instrument(skip_all, fields(servo_profiling = true))]
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
tracing::instrument(skip_all, fields(servo_profiling = true))
|
||||
)]
|
||||
fn handle_gamepad_msg(&mut self, event: GamepadEvent) {
|
||||
// Send to the focused browsing contexts' current pipeline.
|
||||
let focused_browsing_context_id = self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue