diff options
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index dd522b9cb2a..7af80f5f7fc 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -148,8 +148,6 @@ struct InProgressLoad { window_size: Option<WindowSizeData>, /// Channel to the layout thread associated with this pipeline. layout_chan: Sender<message::Msg>, - /// The current viewport clipping rectangle applying to this pipeline, if any. - clip_rect: Option<Rect<f32>>, /// Window is frozen (navigated away while loading for example). is_frozen: bool, /// Window is visible. @@ -174,7 +172,6 @@ impl InProgressLoad { parent_info: parent_info, layout_chan: layout_chan, window_size: window_size, - clip_rect: None, is_frozen: false, is_visible: true, url: url, @@ -1167,9 +1164,8 @@ impl ScriptThread { } return; } - let mut loads = self.incomplete_loads.borrow_mut(); - if let Some(ref mut load) = loads.iter_mut().find(|load| load.pipeline_id == id) { - load.clip_rect = Some(rect); + let loads = self.incomplete_loads.borrow(); + if loads.iter().any(|load| load.pipeline_id == id) { return; } warn!("Page rect message sent to nonexistent pipeline"); @@ -1275,21 +1271,6 @@ impl ScriptThread { reports_chan.send(reports); } - /// To slow/speed up timers and manage any other script thread resource based on visibility. - /// Returns true if successful. - fn alter_resource_utilization(&self, id: PipelineId, visible: bool) -> bool { - let window = self.documents.borrow().find_window(id); - if let Some(window) = window { - if visible { - window.upcast::<GlobalScope>().speed_up_timers(); - } else { - window.upcast::<GlobalScope>().slow_down_timers(); - } - return true; - } - false - } - /// Updates iframe element after a change in visibility fn handle_visibility_change_complete_msg(&self, parent_pipeline_id: PipelineId, id: FrameId, visible: bool) { let iframe = self.documents.borrow().find_iframe(parent_pipeline_id, id); @@ -1300,20 +1281,23 @@ impl ScriptThread { /// Handle visibility change message fn handle_visibility_change_msg(&self, id: PipelineId, visible: bool) { - let resources_altered = self.alter_resource_utilization(id, visible); - // Separate message sent since parent script thread could be different (Iframe of different // domain) self.constellation_chan.send(ConstellationMsg::VisibilityChangeComplete(id, visible)).unwrap(); - if !resources_altered { - let mut loads = self.incomplete_loads.borrow_mut(); - if let Some(ref mut load) = loads.iter_mut().find(|load| load.pipeline_id == id) { - load.is_visible = visible; + let window = self.documents.borrow().find_window(id); + match window { + Some(window) => { + window.alter_resource_utilization(visible); return; } - } else { - return; + None => { + let mut loads = self.incomplete_loads.borrow_mut(); + if let Some(ref mut load) = loads.iter_mut().find(|load| load.pipeline_id == id) { + load.is_visible = visible; + return; + } + } } warn!("change visibility message sent to nonexistent pipeline"); @@ -1851,7 +1835,7 @@ impl ScriptThread { } if !incomplete.is_visible { - self.alter_resource_utilization(incomplete.pipeline_id, false); + window.alter_resource_utilization(false); } document.get_current_parser().unwrap() |