aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/timers.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-01-07 04:36:39 +0100
committerGitHub <noreply@github.com>2025-01-07 03:36:39 +0000
commitfe8a22b72c42296ccbbd5c4f459936ea28c5dee2 (patch)
tree9749d88dc818a054c204ebbc5dc82878ced68c8d /components/script/timers.rs
parentd252a631d292afc492b337c8b32a34b86139f99d (diff)
downloadservo-fe8a22b72c42296ccbbd5c4f459936ea28c5dee2.tar.gz
servo-fe8a22b72c42296ccbbd5c4f459936ea28c5dee2.zip
script: Unsilence all main thread `TaskQueue` errors (#34849)
No longer hide errors while queueing tasks on the main thread. This requires creating two types of `TaskSource`s: one for the main thread and one that can be sent to other threads. This makes queueing a bit more efficient on the main thread and more importantly, no longer hides task queue errors. Fixes #25688. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'components/script/timers.rs')
-rw-r--r--components/script/timers.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/components/script/timers.rs b/components/script/timers.rs
index 8eaf37b8c70..495ecff5a44 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -34,7 +34,7 @@ use crate::dom::xmlhttprequest::XHRTimeoutCallback;
use crate::script_module::ScriptFetchOptions;
use crate::script_runtime::CanGc;
use crate::script_thread::ScriptThread;
-use crate::task_source::TaskSource;
+use crate::task_source::SendableTaskSource;
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, MallocSizeOf, Ord, PartialEq, PartialOrd)]
pub struct OneshotTimerHandle(i32);
@@ -285,7 +285,11 @@ impl OneshotTimers {
let callback = TimerListener {
context: Trusted::new(&*self.global_scope),
- task_source: self.global_scope.task_manager().timer_task_source(),
+ task_source: self
+ .global_scope
+ .task_manager()
+ .timer_task_source()
+ .to_sendable(),
}
.into_callback();
@@ -584,7 +588,7 @@ impl JsTimerTask {
/// A wrapper between timer events coming in over IPC, and the event-loop.
#[derive(Clone)]
struct TimerListener {
- task_source: TaskSource,
+ task_source: SendableTaskSource,
context: Trusted<GlobalScope>,
}
@@ -595,7 +599,7 @@ impl TimerListener {
let context = self.context.clone();
// Step 18, queue a task,
// https://html.spec.whatwg.org/multipage/#timer-initialisation-steps
- let _ = self.task_source.queue(task!(timer_event: move || {
+ self.task_source.queue(task!(timer_event: move || {
let global = context.root();
let TimerEvent(source, id) = event;
match source {