mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -229,14 +229,13 @@ impl BaseAudioContext {
|
|||
}
|
||||
|
||||
pub fn resume(&self) {
|
||||
let task_source = self.global().task_manager().dom_manipulation_task_source();
|
||||
let this = Trusted::new(self);
|
||||
// Set the rendering thread state to 'running' and start
|
||||
// rendering the audio graph.
|
||||
match self.audio_context_impl.lock().unwrap().resume() {
|
||||
Ok(()) => {
|
||||
self.take_pending_resume_promises(Ok(()));
|
||||
let _ = task_source.queue(
|
||||
self.global().task_manager().dom_manipulation_task_source().queue(
|
||||
task!(resume_success: move || {
|
||||
let this = this.root();
|
||||
this.fulfill_in_flight_resume_promises(|| {
|
||||
|
@ -255,9 +254,12 @@ impl BaseAudioContext {
|
|||
self.take_pending_resume_promises(Err(Error::Type(
|
||||
"Something went wrong".to_owned(),
|
||||
)));
|
||||
let _ = task_source.queue(task!(resume_error: move || {
|
||||
this.root().fulfill_in_flight_resume_promises(|| {})
|
||||
}));
|
||||
self.global()
|
||||
.task_manager()
|
||||
.dom_manipulation_task_source()
|
||||
.queue(task!(resume_error: move || {
|
||||
this.root().fulfill_in_flight_resume_promises(|| {})
|
||||
}));
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -501,7 +503,11 @@ impl BaseAudioContextMethods<crate::DomTypeHolder> for BaseAudioContext {
|
|||
let channels = Arc::new(Mutex::new(HashMap::new()));
|
||||
let this = Trusted::new(self);
|
||||
let this_ = this.clone();
|
||||
let task_source = self.global().task_manager().dom_manipulation_task_source();
|
||||
let task_source = self
|
||||
.global()
|
||||
.task_manager()
|
||||
.dom_manipulation_task_source()
|
||||
.to_sendable();
|
||||
let task_source_clone = task_source.clone();
|
||||
let callbacks = AudioDecoderCallbacks::new()
|
||||
.ready(move |channel_count| {
|
||||
|
@ -523,7 +529,7 @@ impl BaseAudioContextMethods<crate::DomTypeHolder> for BaseAudioContext {
|
|||
decoded_audio[channel].extend_from_slice((*buffer).as_ref());
|
||||
})
|
||||
.eos(move || {
|
||||
let _ = task_source.queue(task!(audio_decode_eos: move || {
|
||||
task_source.queue(task!(audio_decode_eos: move || {
|
||||
let this = this.root();
|
||||
let decoded_audio = decoded_audio__.lock().unwrap();
|
||||
let length = if decoded_audio.len() >= 1 {
|
||||
|
@ -548,7 +554,7 @@ impl BaseAudioContextMethods<crate::DomTypeHolder> for BaseAudioContext {
|
|||
}));
|
||||
})
|
||||
.error(move |error| {
|
||||
let _ = task_source_clone.queue(task!(audio_decode_eos: move || {
|
||||
task_source_clone.queue(task!(audio_decode_eos: move || {
|
||||
let this = this_.root();
|
||||
let mut resolvers = this.decode_resolvers.borrow_mut();
|
||||
assert!(resolvers.contains_key(&uuid));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue