From cbc363bedd5f48e08b4311b00421256d38bf488e Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Thu, 24 Apr 2025 21:03:14 +0200 Subject: compositor: Tick animations for an entire WebView at once (#36662) Previously, when processing animations, the compositor would sent a tick message to each pipeline. This is an issue because now the `ScriptThread` always processes rendering updates for all `Document`s in order to ensure properly ordering. This change makes it so that tick messages are sent for an entire WebView. This means that each `ScriptThread` will always receive a single tick for every time that animations are processed, no matter how many frames are animating. This is the first step toward a refresh driver. In addition, we discard the idea of ticking animation only for animations and or only for request animation frame callbacks. The `ScriptThread` can no longer make this distinction due to the specification and the compositor shouldn't either. This should not really change observable behavior, but should make Servo more efficient when more than a single frame in a `ScriptThread` is animting at once. Testing: This is covered by existing WPT tests as it mainly just improve animation efficiency in a particular case. Signed-off-by: Martin Robinson --- components/shared/script/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/shared/script/lib.rs') diff --git a/components/shared/script/lib.rs b/components/shared/script/lib.rs index a39be739fd5..7323907cba3 100644 --- a/components/shared/script/lib.rs +++ b/components/shared/script/lib.rs @@ -20,7 +20,7 @@ use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLPipeline; use compositing_traits::CrossProcessCompositorApi; use constellation_traits::{ - AnimationTickType, LoadData, NavigationHistoryBehavior, ScriptToConstellationChan, ScrollState, + LoadData, NavigationHistoryBehavior, ScriptToConstellationChan, ScrollState, StructuredSerializedData, WindowSizeType, }; use crossbeam_channel::{RecvTimeoutError, Sender}; @@ -195,7 +195,7 @@ pub enum ScriptThreadMessage { /// Passes a webdriver command to the script thread for execution WebDriverScriptCommand(PipelineId, WebDriverScriptCommand), /// Notifies script thread that all animations are done - TickAllAnimations(PipelineId, AnimationTickType), + TickAllAnimations(Vec), /// Notifies the script thread that a new Web font has been loaded, and thus the page should be /// reflowed. WebFontLoaded(PipelineId, bool /* success */), -- cgit v1.2.3