aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/task_source/rendering.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-12-12 09:43:58 +0100
committerGitHub <noreply@github.com>2024-12-12 08:43:58 +0000
commit2bcee38e521687c245222e229a05a586696013df (patch)
tree8a59973468824f354729fba1ce2ca808b3e050da /components/script/task_source/rendering.rs
parent7fcde1f7a30138544f8ad1b279c5e4047e643831 (diff)
downloadservo-2bcee38e521687c245222e229a05a586696013df.tar.gz
servo-2bcee38e521687c245222e229a05a586696013df.zip
script: Remove `note_rendering_opportunity` and `rendering_opportunity` (#34575)
A rendering opportunity is now unconditionally triggered by handling IPC messages in the `ScriptThread`, unless animations are running in which case it's driven by the compositor. We can now remove calls to `note_rendering_opportunity` and `rendering_opportunity`. There is one tricky case, which is when a promise completion during a microtask checkpoint dirties the page again. In this case we need to trigger a new rendering opportunity, unless animations are running. In a followup change, when not driven by the compositor, rendering opportunities will be driven by a timed task, meaning we can remove this workaround. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/task_source/rendering.rs')
-rw-r--r--components/script/task_source/rendering.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/components/script/task_source/rendering.rs b/components/script/task_source/rendering.rs
index 43afa4abb68..0c652add2bb 100644
--- a/components/script/task_source/rendering.rs
+++ b/components/script/task_source/rendering.rs
@@ -43,3 +43,19 @@ impl TaskSource for RenderingTaskSource {
self.0.send(msg_task).map_err(|_| ())
}
}
+
+impl RenderingTaskSource {
+ /// This queues a task that will not be cancelled when its associated
+ /// global scope gets destroyed.
+ pub fn queue_unconditionally<T>(&self, task: T) -> Result<(), ()>
+ where
+ T: TaskOnce + 'static,
+ {
+ self.0.send(CommonScriptMsg::Task(
+ ScriptThreadEventCategory::NetworkEvent,
+ Box::new(task),
+ Some(self.1),
+ RenderingTaskSource::NAME,
+ ))
+ }
+}