mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #15179 - servo:alter_resource_utilization, r=nox
Refactor away ScriptThread::alter_resource_utilization(). It's used in two places, one of which already has access to the Window. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15179) <!-- Reviewable:end -->
This commit is contained in:
commit
88cd8a3cf0
2 changed files with 21 additions and 24 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue