Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use while let{} instead of loop{match{}} in ScrollingTimer::run()
  • Loading branch information
rnestler committed Nov 7, 2015
1 parent 3985e33 commit 39aa3cf
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions components/compositing/scrolling.rs
Expand Up @@ -54,16 +54,11 @@ impl ScrollingTimerProxy {

impl ScrollingTimer {
pub fn run(&mut self) {
loop {
match self.receiver.recv() {
Ok(ToScrollingTimerMsg::ScrollEventProcessedMsg(timestamp)) => {
let target = timestamp as i64 + TIMEOUT;
let delta_ns = target - (time::precise_time_ns() as i64);
sleep_ms((delta_ns / 1000000) as u32);
self.compositor_proxy.send(Msg::ScrollTimeout(timestamp));
}
Ok(ToScrollingTimerMsg::ExitMsg) | Err(_) => break,
}
while let Ok(ToScrollingTimerMsg::ScrollEventProcessedMsg(timestamp)) = self.receiver.recv() {
let target = timestamp as i64 + TIMEOUT;
let delta_ns = target - (time::precise_time_ns() as i64);
sleep_ms((delta_ns / 1000000) as u32);
self.compositor_proxy.send(Msg::ScrollTimeout(timestamp));
}
}
}
Expand Down

0 comments on commit 39aa3cf

Please sign in to comment.