diff options
author | Delan Azabani <dazabani@igalia.com> | 2024-03-22 14:06:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 06:06:28 +0000 |
commit | 8882507ad06b598fb43d8542c67ad76daeda739c (patch) | |
tree | 5d78c92d40aab37a71f87c6f5a1df0c5218e81c5 /components/compositing | |
parent | 9b26dca141159ddc75266de9ef5a54f537450921 (diff) | |
download | servo-8882507ad06b598fb43d8542c67ad76daeda739c.tar.gz servo-8882507ad06b598fb43d8542c67ad76daeda739c.zip |
Rework “visible” to “throttled” in constellation + script + compositor (#31816)
Diffstat (limited to 'components/compositing')
-rw-r--r-- | components/compositing/compositor.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 3e08d33f695..ccb70d7b64e 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -302,8 +302,8 @@ struct PipelineDetails { /// Whether there are animation callbacks animation_callbacks_running: bool, - /// Whether this pipeline is visible - visible: bool, + /// Whether to use less resources by stopping animations. + throttled: bool, /// Hit test items for this pipeline. This is used to map WebRender hit test /// information to the full information necessary for Servo. @@ -321,7 +321,7 @@ impl PipelineDetails { most_recent_display_list_epoch: None, animations_running: false, animation_callbacks_running: false, - visible: true, + throttled: false, hit_test_items: Vec::new(), scroll_tree: ScrollTree::default(), } @@ -579,8 +579,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { self.composite_if_necessary(CompositingReason::Headless); }, - CompositorMsg::PipelineVisibilityChanged(pipeline_id, visible) => { - self.pipeline_details(pipeline_id).visible = visible; + CompositorMsg::SetThrottled(pipeline_id, throttled) => { + self.pipeline_details(pipeline_id).throttled = throttled; self.process_animations(true); }, @@ -982,17 +982,17 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { ) { match animation_state { AnimationState::AnimationsPresent => { - let visible = self.pipeline_details(pipeline_id).visible; + let throttled = self.pipeline_details(pipeline_id).throttled; self.pipeline_details(pipeline_id).animations_running = true; - if visible { + if !throttled { self.composite_if_necessary(CompositingReason::Animation); } }, AnimationState::AnimationCallbacksPresent => { - let visible = self.pipeline_details(pipeline_id).visible; + let throttled = self.pipeline_details(pipeline_id).throttled; self.pipeline_details(pipeline_id) .animation_callbacks_running = true; - if visible { + if !throttled { self.tick_animations_for_pipeline(pipeline_id); } }, @@ -1583,7 +1583,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { let mut pipeline_ids = vec![]; for (pipeline_id, pipeline_details) in &self.pipeline_details { if (pipeline_details.animations_running || pipeline_details.animation_callbacks_running) && - pipeline_details.visible + !pipeline_details.throttled { pipeline_ids.push(*pipeline_id); } |