/
githubmirror
/
servo
Обзор
Документация
Войти
/
githubmirror
/
servo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
components/constellation/tracing.rs
206 строк
11 KB
Taym Haddadi
script: Deliver animation frames to dedicated workers (#46232)
06 авг 2026, 12:28
Не верифицирован
06 авг 2026, 12:28
12c1908
Код
Авторство
О чём код?
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ /// Log an event from embedder at trace level. /// - To disable tracing: RUST_LOG='constellation<embedder@=off' /// - To enable tracing: RUST_LOG='constellation<embedder@' /// - Recommended filters when tracing is enabled: /// - constellation<embedder@ForwardEvent(MouseMoveEvent)=off /// - constellation<embedder@LogEntry=off /// - constellation<embedder@ReadyToPresent=off macro_rules! trace_msg_from_embedder { // This macro only exists to put the docs in the same file as the target prefix, // so the macro definition is always the same. ($event:expr, $($rest:tt)+) => { ::log::trace!(target: $crate::tracing::LogTarget::log_target(&$event), $($rest)+) }; } /// Log an event from script at trace level. /// - To disable tracing: RUST_LOG='constellation<script@=off' /// - To enable tracing: RUST_LOG='constellation<script@' /// - Recommended filters when tracing is enabled: /// - constellation<script@LogEntry=off macro_rules! trace_script_msg { // This macro only exists to put the docs in the same file as the target prefix, // so the macro definition is always the same. ($event:expr, $($rest:tt)+) => { ::log::trace!(target: $crate::tracing::LogTarget::log_target(&$event), $($rest)+) }; } /// Get the log target for an event, as a static string. pub(crate) trait LogTarget { fn log_target(&self) -> &'static str; } mod from_embedder { use embedder_traits::{InputEvent, InputEventAndId}; use super::LogTarget; macro_rules! target { ($($name:literal)+) => { concat!("constellation<embedder@", $($name),+) }; } impl LogTarget for servo_constellation_traits::EmbedderToConstellationMessage { fn log_target(&self) -> &'static str { match self { Self::Exit => target!("Exit"), Self::AllowNavigationResponse(..) => target!("AllowNavigationResponse"), Self::LoadUrl(..) => target!("LoadUrl"), Self::TraverseHistory(..) => target!("TraverseHistory"), Self::ChangeViewportDetails(..) => target!("ChangeViewportDetails"), Self::ThemeChange(..) => target!("ThemeChange"), Self::TickAnimation(..) => target!("TickAnimation"), Self::WebDriverCommand(..) => target!("WebDriverCommand"), Self::Reload(..) => target!("Reload"), Self::LogEntry(..) => target!("LogEntry"), Self::NewWebView(..) => target!("NewWebView"), Self::CloseWebView(..) => target!("CloseWebView"), Self::FocusWebView(..) => target!("FocusWebView"), Self::BlurWebView => target!("BlurWebView"), Self::ForwardInputEvent(_webview_id, event, ..) => event.log_target(), Self::RefreshCursor(..) => target!("RefreshCursor"), Self::ExitFullScreen(_) => target!("ExitFullScreen"), Self::MediaSessionAction(_) => target!("MediaSessionAction"), Self::SetWebViewThrottled(_, _) => target!("SetWebViewThrottled"), Self::SetScrollStates(..) => target!("SetScrollStates"), Self::PaintMetric(..) => target!("PaintMetric"), Self::EvaluateJavaScript(..) => target!("EvaluateJavaScript"), Self::CreateMemoryReport(..) => target!("CreateMemoryReport"), Self::SendImageKeysForPipeline(..) => target!("SendImageKeysForPipeline"), Self::PreferencesUpdated(..) => target!("PreferencesUpdated"), Self::NoLongerWaitingOnAsynchronousImageUpdates(..) => { target!("NoLongerWaitingOnCanvas") }, Self::RequestScreenshotReadiness(..) => target!("RequestScreenshotReadiness"), Self::EmbedderControlResponse(..) => target!("EmbedderControlResponse"), Self::UserContentManagerAction(..) => target!("UserContentManagerAction"), Self::UpdatePinchZoomInfos(..) => target!("UpdatePinchZoomInfos"), Self::SetAccessibilityActive(..) => target!("SetAccessibilityActive"), } } } impl LogTarget for InputEventAndId { fn log_target(&self) -> &'static str { macro_rules! target_variant { ($name:literal) => { target!("ForwardInputEvent(" $name ")") }; } match self.event { InputEvent::EditingAction(..) => target_variant!("EditingAction"), #[cfg(feature = "gamepad")] InputEvent::Gamepad(..) => target_variant!("Gamepad"), InputEvent::Ime(..) => target_variant!("Ime"), InputEvent::Keyboard(..) => target_variant!("Keyboard"), InputEvent::MouseButton(..) => target_variant!("MouseButton"), InputEvent::MouseMove(..) => target_variant!("MouseMove"), InputEvent::MouseLeftViewport(..) => target_variant!("MouseLeftViewport"), InputEvent::Touch(..) => target_variant!("Touch"), InputEvent::Wheel(..) => target_variant!("Wheel"), } } } } mod from_script { use super::LogTarget; macro_rules! target { ($($name:literal)+) => { concat!("constellation<script@", $($name),+) }; } impl LogTarget for servo_constellation_traits::ScriptToConstellationMessage { fn log_target(&self) -> &'static str { match self { Self::ServiceWorkerAlgorithm(..) => target!("ServiceWorkerAlgorithm"), Self::CompleteMessagePortTransfer(..) => target!("CompleteMessagePortTransfer"), Self::MessagePortTransferResult(..) => target!("MessagePortTransferResult"), Self::NewMessagePort(..) => target!("NewMessagePort"), Self::NewMessagePortRouter(..) => target!("NewMessagePortRouter"), Self::RemoveMessagePortRouter(..) => target!("RemoveMessagePortRouter"), Self::RerouteMessagePort(..) => target!("RerouteMessagePort"), Self::MessagePortShipped(..) => target!("MessagePortShipped"), Self::EntanglePorts(..) => target!("EntanglePorts"), Self::DisentanglePorts(..) => target!("DisentanglePorts"), Self::NewBroadcastChannelRouter(..) => target!("NewBroadcastChannelRouter"), Self::RemoveBroadcastChannelRouter(..) => target!("RemoveBroadcastChannelRouter"), Self::NewBroadcastChannelNameInRouter(..) => { target!("NewBroadcastChannelNameInRouter") }, Self::RemoveBroadcastChannelNameInRouter(..) => { target!("RemoveBroadcastChannelNameInRouter") }, Self::ScheduleBroadcast(..) => target!("ScheduleBroadcast"), Self::RegisterInterest(..) => target!("RegisterInterest"), Self::UnregisterInterest(..) => target!("UnregisterInterest"), Self::BroadcastStorageEvent(..) => target!("BroadcastStorageEvent"), Self::ChangeRunningAnimationsState(..) => target!("ChangeRunningAnimationsState"), Self::RegisterWorkerAnimationFrameProvider(..) => { target!("RegisterWorkerAnimationFrameProvider") }, Self::UnregisterWorkerAnimationFrameProvider(..) => { target!("UnregisterWorkerAnimationFrameProvider") }, Self::ChangeWorkerAnimationFrameProviderState(..) => { target!("ChangeWorkerAnimationFrameProviderState") }, Self::CreateCanvasPaintThread(..) => target!("CreateCanvasPaintThread"), Self::FocusAncestorBrowsingContextsForFocusingSteps(..) => { target!("FocusAncestorBrowsingContextsForFocusingSteps") }, Self::FocusRemoteBrowsingContext(..) => target!("FocusRemoteBrowsingContext"), Self::GetTopForBrowsingContext(..) => target!("GetTopForBrowsingContext"), Self::GetBrowsingContextInfo(..) => target!("GetBrowsingContextInfo"), Self::GetDocumentOrigin(..) => target!("GetDocumentOrigin"), Self::GetChildBrowsingContextId(..) => target!("GetChildBrowsingContextId"), Self::LoadComplete => target!("LoadComplete"), Self::LoadUrl(..) => target!("LoadUrl"), Self::AbortLoadUrl => target!("AbortLoadUrl"), Self::PostMessage { .. } => target!("PostMessage"), Self::NavigatedToFragment(..) => target!("NavigatedToFragment"), Self::TraverseHistory(..) => target!("TraverseHistory"), Self::PushHistoryState(..) => target!("PushHistoryState"), Self::ReplaceHistoryState(..) => target!("ReplaceHistoryState"), Self::JointSessionHistoryLength(..) => target!("JointSessionHistoryLength"), Self::RemoveIFrame(..) => target!("RemoveIFrame"), Self::SetThrottledComplete(..) => target!("SetThrottledComplete"), Self::ScriptLoadedURLInIFrame(..) => target!("ScriptLoadedURLInIFrame"), Self::ScriptNewIFrame(..) => target!("ScriptNewIFrame"), Self::CreateAuxiliaryWebView(..) => target!("ScriptNewAuxiliary"), Self::ActivateDocument => target!("ActivateDocument"), Self::SetDocumentState(..) => target!("SetDocumentState"), Self::SetFinalUrl(..) => target!("SetFinalUrl"), Self::LogEntry(..) => target!("LogEntry"), Self::DiscardDocument => target!("DiscardDocument"), Self::DiscardTopLevelBrowsingContext => target!("DiscardTopLevelBrowsingContext"), Self::PipelineExited => target!("PipelineExited"), Self::ForwardDOMMessage(..) => target!("ForwardDOMMessage"), Self::MediaSessionEvent(..) => target!("MediaSessionEvent"), #[cfg(feature = "webgpu")] Self::RequestAdapter(..) => target!("RequestAdapter"), #[cfg(feature = "webgpu")] Self::GetWebGPUChan(..) => target!("GetWebGPUChan"), Self::TitleChanged(..) => target!("TitleChanged"), Self::IFrameSizes(..) => target!("IFrameSizes"), Self::ReportMemory(..) => target!("ReportMemory"), Self::FinishJavaScriptEvaluation(..) => target!("FinishJavaScriptEvaluation"), Self::ForwardKeyboardScroll(..) => target!("ForwardKeyboardScroll"), Self::RespondToScreenshotReadinessRequest(..) => { target!("RespondToScreenshotReadinessRequest") }, Self::TriggerGarbageCollection => target!("TriggerGarbageCollection"), Self::AcquireWakeLock(..) => target!("AcquireWakeLock"), Self::ReleaseWakeLock(..) => target!("ReleaseWakeLock"), } } } }