mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Added warnings for idempotent freeze/thaw.
This commit is contained in:
parent
78c87ea8d7
commit
67bf23016e
1 changed files with 4 additions and 2 deletions
|
@ -229,7 +229,9 @@ impl OneshotTimers {
|
|||
|
||||
pub fn suspend(&self) {
|
||||
// Suspend is idempotent: do nothing if the timers are already suspended.
|
||||
if self.suspended_since.get().is_some() { return; }
|
||||
if self.suspended_since.get().is_some() {
|
||||
return warn!("Suspending an already suspended timer.");
|
||||
}
|
||||
|
||||
self.suspended_since.set(Some(precise_time_ms()));
|
||||
self.invalidate_expected_event_id();
|
||||
|
@ -239,7 +241,7 @@ impl OneshotTimers {
|
|||
// Suspend is idempotent: do nothing if the timers are already suspended.
|
||||
let additional_offset = match self.suspended_since.get() {
|
||||
Some(suspended_since) => precise_time_ms() - suspended_since,
|
||||
None => return,
|
||||
None => return warn!("Resuming an already resumed timer."),
|
||||
};
|
||||
|
||||
self.suspension_offset.set(self.suspension_offset.get() + additional_offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue