Use std::io::timer instead of servo_util::time::Timer.

This commit is contained in:
Tetsuharu OHZEKI 2014-04-04 23:41:08 +09:00
parent e3cc46a782
commit 7019ba1bc8
2 changed files with 5 additions and 19 deletions

View file

@ -32,9 +32,10 @@ use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, LoadUrlMsg, Navig
use servo_msg::constellation_msg::{PipelineId, ResizedWindowMsg};
use servo_msg::constellation_msg;
use servo_util::opts::Opts;
use servo_util::time::{profile, ProfilerChan, Timer};
use servo_util::time::{profile, ProfilerChan};
use servo_util::{time, url};
use std::comm::{Empty, Disconnected, Data, Sender, Receiver};
use std::io::timer::sleep;
use std::path::Path;
use std::rc::Rc;
use time::precise_time_s;
@ -195,7 +196,7 @@ impl IOCompositor {
self.composite();
}
Timer::sleep(10);
sleep(10);
// If a pinch-zoom happened recently, ask for tiles at the new resolution
if self.zoom_action && precise_time_s() - self.zoom_time > 0.3 {

View file

@ -9,24 +9,9 @@ use collections::treemap::TreeMap;
use std::comm::{Sender, channel, Receiver};
use std::f64;
use std::iter::AdditiveIterator;
use std::io::timer::sleep;
use task::{spawn_named};
// TODO: This code should be changed to use the commented code that uses timers
// directly, once native timers land in Rust.
extern {
pub fn usleep(secs: u64) -> u32;
}
pub struct Timer;
impl Timer {
pub fn sleep(ms: u64) {
//
// let mut timer = Timer::new().unwrap();
// timer.sleep(period);
unsafe { usleep((ms * 1000)); }
}
}
// front-end representation of the profiler used to communicate with the profiler
#[deriving(Clone)]
pub struct ProfilerChan(Sender<ProfilerMsg>);
@ -133,7 +118,7 @@ impl Profiler {
let chan = chan.clone();
spawn_named("Profiler timer", proc() {
loop {
Timer::sleep(period);
sleep(period);
if !chan.try_send(PrintMsg) {
break;
}