aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2017-01-24 17:55:00 +0100
committerMs2ger <Ms2ger@gmail.com>2017-01-26 16:57:00 +0100
commita689cf1d34067bbeb127bf32520ef3b027d01e49 (patch)
tree12e1d01192cb8b54bdb0086002ec17393538fb0a /components/script/dom/window.rs
parentc3f0c9054feb97f4b3c106393930887d9841df1f (diff)
downloadservo-a689cf1d34067bbeb127bf32520ef3b027d01e49.tar.gz
servo-a689cf1d34067bbeb127bf32520ef3b027d01e49.zip
Refactor away ScriptThread::alter_resource_utilization().
It's used in two places, one of which already has access to the Window.
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index c8e4ccc832d..cb9d5abdf07 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -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 {