mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Move timers to GlobalScope
This commit is contained in:
parent
5d8979237b
commit
991801488c
8 changed files with 144 additions and 145 deletions
|
@ -1077,15 +1077,14 @@ impl XMLHttpRequest {
|
|||
xhr: Trusted::new(self),
|
||||
generation_id: self.generation_id.get(),
|
||||
});
|
||||
let global = self.global();
|
||||
let duration = Length::new(duration_ms as u64);
|
||||
*self.timeout_cancel.borrow_mut() = Some(global.r().schedule_callback(callback, duration));
|
||||
*self.timeout_cancel.borrow_mut() =
|
||||
Some(self.global_scope().schedule_callback(callback, duration));
|
||||
}
|
||||
|
||||
fn cancel_timeout(&self) {
|
||||
if let Some(handle) = self.timeout_cancel.borrow_mut().take() {
|
||||
let global = self.global();
|
||||
global.r().unschedule_callback(handle);
|
||||
self.global_scope().unschedule_callback(handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue