aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-02-23 21:45:46 -0700
committerbors-servo <metajack+bors@gmail.com>2015-02-23 21:45:46 -0700
commita3ea3eed47713a4a6faa86c575bc2ac95c5fe135 (patch)
tree6a7537355c9bf6bb02f303d6bd2488df52488f19 /components/script/script_task.rs
parent6264e4dcdc75b83c8d08eb6bbbc9ed8412a2115c (diff)
parentc2961c94b49a401d647e3f10cf04cd74aa7287c8 (diff)
downloadservo-a3ea3eed47713a4a6faa86c575bc2ac95c5fe135.tar.gz
servo-a3ea3eed47713a4a6faa86c575bc2ac95c5fe135.zip
auto merge of #4960 : pkondzior/servo/add-script-timers-suspend-resume-functionality, r=jdm
Adds free/thaw methods to script_task that let you send suspend/resume messages to web content timers. Fixes #4907
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 78e50516420..b59bef57468 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -580,6 +580,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)
}
}
@@ -663,6 +667,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);