aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/timers.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2015-04-23 00:14:02 +0200
committerJosh Matthews <josh@joshmatthews.net>2015-05-05 10:07:34 -0400
commitef8edd4e87aeb3cc71dfd9da2f69437080f5410e (patch)
tree9146cdd7126ead59c57cacbaa04eda0f16761f65 /components/script/timers.rs
parent7b87085c1880c60aa3be5b3ec4572a0d93fd5537 (diff)
downloadservo-ef8edd4e87aeb3cc71dfd9da2f69437080f5410e.tar.gz
servo-ef8edd4e87aeb3cc71dfd9da2f69437080f5410e.zip
Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8.
Diffstat (limited to 'components/script/timers.rs')
-rw-r--r--components/script/timers.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/components/script/timers.rs b/components/script/timers.rs
index 01e9920b3b7..806bc57b85a 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -11,6 +11,7 @@ use dom::bindings::utils::Reflectable;
use dom::window::ScriptHelpers;
use script_task::{ScriptChan, ScriptMsg, TimerSource};
+use horribly_inefficient_timers;
use util::task::spawn_named;
use util::str::DOMString;
@@ -24,8 +25,6 @@ use std::collections::HashMap;
use std::sync::mpsc::{channel, Sender};
use std::sync::mpsc::Select;
use std::hash::{Hash, Hasher};
-use std::old_io::timer::Timer;
-use std::time::duration::Duration;
#[derive(PartialEq, Eq)]
#[jstraceable]
@@ -74,7 +73,6 @@ pub struct TimerManager {
}
-#[unsafe_destructor]
impl Drop for TimerManager {
fn drop(&mut self) {
for (_, timer_handle) in self.active_timers.borrow_mut().iter_mut() {
@@ -141,13 +139,12 @@ impl TimerManager {
source: TimerSource,
script_chan: Box<ScriptChan+Send>)
-> i32 {
- let timeout = cmp::max(0, timeout) as u64;
+ let duration_ms = cmp::max(0, timeout) as u32;
let handle = self.next_timer_handle.get();
self.next_timer_handle.set(handle + 1);
// Spawn a new timer task; it will dispatch the `ScriptMsg::FireTimer`
// to the relevant script handler that will deal with it.
- let tm = Timer::new().unwrap();
let (control_chan, control_port) = channel();
let spawn_name = match source {
TimerSource::FromWindow(_) if is_interval == IsInterval::Interval => "Window:SetInterval",
@@ -156,12 +153,10 @@ impl TimerManager {
TimerSource::FromWorker => "Worker:SetTimeout",
}.to_owned();
spawn_named(spawn_name, move || {
- let mut tm = tm;
- let duration = Duration::milliseconds(timeout as i64);
let timeout_port = if is_interval == IsInterval::Interval {
- tm.periodic(duration)
+ horribly_inefficient_timers::periodic(duration_ms)
} else {
- tm.oneshot(duration)
+ horribly_inefficient_timers::oneshot(duration_ms)
};
let control_port = control_port;