mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use while let{} instead of loop{match{}} in ScrollingTimer::run()
This commit is contained in:
parent
3985e33b43
commit
39aa3cfc2a
1 changed files with 5 additions and 10 deletions
|
@ -54,17 +54,12 @@ impl ScrollingTimerProxy {
|
||||||
|
|
||||||
impl ScrollingTimer {
|
impl ScrollingTimer {
|
||||||
pub fn run(&mut self) {
|
pub fn run(&mut self) {
|
||||||
loop {
|
while let Ok(ToScrollingTimerMsg::ScrollEventProcessedMsg(timestamp)) = self.receiver.recv() {
|
||||||
match self.receiver.recv() {
|
|
||||||
Ok(ToScrollingTimerMsg::ScrollEventProcessedMsg(timestamp)) => {
|
|
||||||
let target = timestamp as i64 + TIMEOUT;
|
let target = timestamp as i64 + TIMEOUT;
|
||||||
let delta_ns = target - (time::precise_time_ns() as i64);
|
let delta_ns = target - (time::precise_time_ns() as i64);
|
||||||
sleep_ms((delta_ns / 1000000) as u32);
|
sleep_ms((delta_ns / 1000000) as u32);
|
||||||
self.compositor_proxy.send(Msg::ScrollTimeout(timestamp));
|
self.compositor_proxy.send(Msg::ScrollTimeout(timestamp));
|
||||||
}
|
}
|
||||||
Ok(ToScrollingTimerMsg::ExitMsg) | Err(_) => break,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue