Add thaw/freeze messages that can suspend/resume webcontent timers #4907

This commit is contained in:
Pawel Kondzior 2015-02-19 11:20:55 +07:00
parent dc31d96f65
commit c2961c94b4
6 changed files with 105 additions and 9 deletions

View file

@ -335,6 +335,8 @@ pub trait WindowHelpers {
fn load_url(self, href: DOMString);
fn handle_fire_timer(self, timer_id: TimerId);
fn IndexedGetter(self, _index: u32, _found: &mut bool) -> Option<Temporary<Window>>;
fn thaw(self);
fn freeze(self);
}
pub trait ScriptHelpers {
@ -404,6 +406,15 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
fn IndexedGetter(self, _index: u32, _found: &mut bool) -> Option<Temporary<Window>> {
None
}
fn thaw(self) {
self.timers.resume();
}
fn freeze(self) {
self.timers.suspend();
}
}
impl Window {