mirror of
https://github.com/servo/servo.git
synced 2025-07-16 03:43:38 +01:00
This creates a new method in shared/compositing/lib to generate image keys that are send over the webview. This does not immediately return the keys but goes over the constellation to receive the keys from the IOCompositor. To make this more efficient, we now cache the keys in image_cache in a simple FIFO order. The old blocking method stays intact for now but got renamed to make the blocking clear. The blocking calls that are left are in: - `components/canvas/canvas_data.rs` - `components/script/dom/htmlmediaelement.rs` Testing: WPT tests should cover this as this doesn't change any functionality. Fixes: Was mentioned in https://github.com/servo/servo/issues/37161#issuecomment-2915750051 and part of https://github.com/servo/servo/issues/37086 --------- Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> Co-authored-by: gterzian <2792687+gterzian@users.noreply.github.com>
66 lines
3.4 KiB
Rust
66 lines
3.4 KiB
Rust
/* 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 constellation at trace level.
|
|
/// - To disable tracing: RUST_LOG='compositor<constellation@=off'
|
|
/// - To enable tracing: RUST_LOG='compositor<constellation@'
|
|
macro_rules! trace_msg_from_constellation {
|
|
// 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_constellation {
|
|
use super::LogTarget;
|
|
|
|
macro_rules! target {
|
|
($($name:literal)+) => {
|
|
concat!("compositor<constellation@", $($name),+)
|
|
};
|
|
}
|
|
|
|
impl LogTarget for compositing_traits::CompositorMsg {
|
|
fn log_target(&self) -> &'static str {
|
|
match self {
|
|
Self::ChangeRunningAnimationsState(..) => target!("ChangeRunningAnimationsState"),
|
|
Self::CreateOrUpdateWebView(..) => target!("CreateOrUpdateWebView"),
|
|
Self::RemoveWebView(..) => target!("RemoveWebView"),
|
|
Self::TouchEventProcessed(..) => target!("TouchEventProcessed"),
|
|
Self::CreatePng(..) => target!("CreatePng"),
|
|
Self::IsReadyToSaveImageReply(..) => target!("IsReadyToSaveImageReply"),
|
|
Self::SetThrottled(..) => target!("SetThrottled"),
|
|
Self::NewWebRenderFrameReady(..) => target!("NewWebRenderFrameReady"),
|
|
Self::PipelineExited(..) => target!("PipelineExited"),
|
|
Self::LoadComplete(..) => target!("LoadComplete"),
|
|
Self::WebDriverMouseButtonEvent(..) => target!("WebDriverMouseButtonEvent"),
|
|
Self::WebDriverMouseMoveEvent(..) => target!("WebDriverMouseMoveEvent"),
|
|
Self::WebDriverWheelScrollEvent(..) => target!("WebDriverWheelScrollEvent"),
|
|
Self::SendInitialTransaction(..) => target!("SendInitialTransaction"),
|
|
Self::SendScrollNode(..) => target!("SendScrollNode"),
|
|
Self::SendDisplayList { .. } => target!("SendDisplayList"),
|
|
Self::HitTest(..) => target!("HitTest"),
|
|
Self::GenerateImageKey(..) => target!("GenerateImageKey"),
|
|
Self::UpdateImages(..) => target!("UpdateImages"),
|
|
Self::GenerateFontKeys(..) => target!("GenerateFontKeys"),
|
|
Self::AddFont(..) => target!("AddFont"),
|
|
Self::AddSystemFont(..) => target!("AddSystemFont"),
|
|
Self::AddFontInstance(..) => target!("AddFontInstance"),
|
|
Self::RemoveFonts(..) => target!("RemoveFonts"),
|
|
Self::GetClientWindowRect(..) => target!("GetClientWindowRect"),
|
|
Self::GetScreenSize(..) => target!("GetScreenSize"),
|
|
Self::GetAvailableScreenSize(..) => target!("GetAvailableScreenSize"),
|
|
Self::CollectMemoryReport(..) => target!("CollectMemoryReport"),
|
|
Self::Viewport(..) => target!("Viewport"),
|
|
Self::GenerateImageKeysForPipeline(..) => target!("GenerateImageKeysForPipeline"),
|
|
}
|
|
}
|
|
}
|
|
}
|