diff options
author | Pawel Kondzior <pawel@kondzior.com> | 2015-02-19 11:20:55 +0700 |
---|---|---|
committer | Pawel Kondzior <pawel@kondzior.com> | 2015-02-24 05:33:27 +0100 |
commit | c2961c94b49a401d647e3f10cf04cd74aa7287c8 (patch) | |
tree | 710a28fef8f76006e6978ab37ee7521774fd487d /components/script/script_task.rs | |
parent | dc31d96f65246def19cb7a23f3a62795cd7344a1 (diff) | |
download | servo-c2961c94b49a401d647e3f10cf04cd74aa7287c8.tar.gz servo-c2961c94b49a401d647e3f10cf04cd74aa7287c8.zip |
Add thaw/freeze messages that can suspend/resume webcontent timers #4907
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r-- | components/script/script_task.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 8573efa9d3f..fa397113c9b 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -602,6 +602,10 @@ impl ScriptTask { panic!("should have handled ExitPipeline already"), ConstellationControlMsg::GetTitle(pipeline_id) => self.handle_get_title_msg(pipeline_id), + ConstellationControlMsg::Freeze(pipeline_id) => + self.handle_freeze_msg(pipeline_id), + ConstellationControlMsg::Thaw(pipeline_id) => + self.handle_thaw_msg(pipeline_id) } } @@ -685,6 +689,26 @@ impl ScriptTask { window.r().handle_fire_timer(timer_id); } + /// Handles freeze message + fn handle_freeze_msg(&self, id: PipelineId) { + let page = self.page.borrow_mut(); + let page = page.find(id).expect("ScriptTask: received freeze msg for a + pipeline ID not associated with this script task. This is a bug."); + let frame = page.frame(); + let window = frame.as_ref().unwrap().window.root(); + window.r().freeze(); + } + + /// Handles thaw message + fn handle_thaw_msg(&self, id: PipelineId) { + let page = self.page.borrow_mut(); + let page = page.find(id).expect("ScriptTask: received thaw msg for a + pipeline ID not associated with this script task. This is a bug."); + let frame = page.frame(); + let window = frame.as_ref().unwrap().window.root(); + window.r().thaw(); + } + /// Handles a notification that reflow completed. fn handle_reflow_complete_msg(&self, pipeline_id: PipelineId, reflow_id: uint) { debug!("Script: Reflow {:?} complete for {:?}", reflow_id, pipeline_id); |