mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
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>
This commit is contained in:
parent
d252a631d2
commit
fe8a22b72c
48 changed files with 628 additions and 571 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue