aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/timers.rs
diff options
context:
space:
mode:
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>2017-03-29 20:34:37 +0200
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2017-03-30 14:27:40 +0200
commitfb878f33d1a15425c59f94ce5202010c5400f9ed (patch)
treefc9c1ac473a2059789fc2158bc972afa14fe6daa /components/script/timers.rs
parent6a795f4795f936789a3f34ad87a367e52cf1bf97 (diff)
downloadservo-fb878f33d1a15425c59f94ce5202010c5400f9ed.tar.gz
servo-fb878f33d1a15425c59f94ce5202010c5400f9ed.zip
Terminate timer scheduler thread during shutdown
Diffstat (limited to 'components/script/timers.rs')
-rw-r--r--components/script/timers.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/components/script/timers.rs b/components/script/timers.rs
index c90a3fa5b1d..cccefd5eb77 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -18,7 +18,8 @@ use ipc_channel::ipc::IpcSender;
use js::jsapi::{HandleValue, Heap};
use js::jsval::{JSVal, UndefinedValue};
use script_traits::{MsDuration, precise_time_ms};
-use script_traits::{TimerEvent, TimerEventId, TimerEventRequest, TimerSource};
+use script_traits::{TimerEvent, TimerEventId, TimerEventRequest};
+use script_traits::{TimerSchedulerMsg, TimerSource};
use servo_config::prefs::PREFS;
use std::cell::Cell;
use std::cmp::{self, Ord, Ordering};
@@ -35,7 +36,7 @@ pub struct OneshotTimers {
#[ignore_heap_size_of = "Defined in std"]
timer_event_chan: IpcSender<TimerEvent>,
#[ignore_heap_size_of = "Defined in std"]
- scheduler_chan: IpcSender<TimerEventRequest>,
+ scheduler_chan: IpcSender<TimerSchedulerMsg>,
next_timer_handle: Cell<OneshotTimerHandle>,
timers: DOMRefCell<Vec<OneshotTimer>>,
suspended_since: Cell<Option<MsDuration>>,
@@ -109,7 +110,7 @@ impl PartialEq for OneshotTimer {
impl OneshotTimers {
pub fn new(timer_event_chan: IpcSender<TimerEvent>,
- scheduler_chan: IpcSender<TimerEventRequest>)
+ scheduler_chan: IpcSender<TimerSchedulerMsg>)
-> OneshotTimers {
OneshotTimers {
js_timers: JsTimers::new(),
@@ -267,7 +268,7 @@ impl OneshotTimers {
let delay = Length::new(timer.scheduled_for.get().saturating_sub(precise_time_ms().get()));
let request = TimerEventRequest(self.timer_event_chan.clone(), timer.source,
expected_event_id, delay);
- self.scheduler_chan.send(request).unwrap();
+ self.scheduler_chan.send(TimerSchedulerMsg::Request(request)).unwrap();
}
}