Refactor away ScriptThread::alter_resource_utilization().

It's used in two places, one of which already has access to the Window.
This commit is contained in:
Ms2ger 2017-01-24 17:55:00 +01:00
parent c3f0c9054f
commit a689cf1d34
2 changed files with 21 additions and 24 deletions

View file

@ -1583,6 +1583,15 @@ impl Window {
pub fn evaluate_media_queries_and_report_changes(&self) {
self.media_query_lists.evaluate_and_report_changes();
}
/// Slow down/speed up timers based on visibility.
pub fn alter_resource_utilization(&self, visible: bool) {
if visible {
self.upcast::<GlobalScope>().speed_up_timers();
} else {
self.upcast::<GlobalScope>().slow_down_timers();
}
}
}
impl Window {