mirror of
https://github.com/servo/servo.git
synced 2025-06-08 00:23:30 +00:00
Add thaw/freeze messages that can suspend/resume webcontent timers #4907
This commit is contained in:
parent
dc31d96f65
commit
c2961c94b4
6 changed files with 105 additions and 9 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue