mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue