aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2014-04-05 06:46:27 -0400
committerbors-servo <release+servo@mozilla.com>2014-04-05 06:46:27 -0400
commit4386bae5763802346012c308646d7c39606f68ea (patch)
treebbfe7671ab3e6023e3e8238052b9e69d5bf14dfb /src
parent44e7e365c9a7a7c3acb70010e140f3f11b4f9def (diff)
parent7019ba1bc8dd9985102eed2a64d5e7eeb4748596 (diff)
downloadservo-4386bae5763802346012c308646d7c39606f68ea.tar.gz
servo-4386bae5763802346012c308646d7c39606f68ea.zip
auto merge of #2034 : saneyuki/servo/timer, r=jdm
Now, our rust compiler has `std::io::timer`!
Diffstat (limited to 'src')
-rw-r--r--src/components/main/compositing/compositor.rs5
-rw-r--r--src/components/util/time.rs19
2 files changed, 5 insertions, 19 deletions
diff --git a/src/components/main/compositing/compositor.rs b/src/components/main/compositing/compositor.rs
index 1901a9e93f3..486c2256f6a 100644
--- a/src/components/main/compositing/compositor.rs
+++ b/src/components/main/compositing/compositor.rs
@@ -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 {
diff --git a/src/components/util/time.rs b/src/components/util/time.rs
index 1be10d960e1..721befef754 100644
--- a/src/components/util/time.rs
+++ b/src/components/util/time.rs
@@ -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;
}