The constellation notifies the script thread about documents becoming inactive, active and fully active.

This commit is contained in:
Alan Jeffrey 2017-01-10 14:35:25 -06:00
parent 556a46f537
commit a43c842099
14 changed files with 162 additions and 98 deletions

View file

@ -19,7 +19,8 @@ use net_traits::{IpcSend, ResourceThreads};
use net_traits::image_cache_thread::ImageCacheThread;
use profile_traits::mem as profile_mem;
use profile_traits::time;
use script_traits::{ConstellationControlMsg, DevicePixel, DiscardBrowsingContext, InitialScriptState};
use script_traits::{ConstellationControlMsg, DevicePixel, DiscardBrowsingContext};
use script_traits::{DocumentActivity, InitialScriptState};
use script_traits::{LayoutControlMsg, LayoutMsg, LoadData, MozBrowserEvent};
use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders, ScriptMsg};
use script_traits::{ScriptThreadFactory, TimerEventRequest, WindowSizeData};
@ -366,17 +367,11 @@ impl Pipeline {
}
}
/// Notify this pipeline that it is no longer fully active.
pub fn freeze(&self) {
if let Err(e) = self.event_loop.send(ConstellationControlMsg::Freeze(self.id)) {
warn!("Sending freeze message failed ({}).", e);
}
}
/// Notify this pipeline that it is fully active.
pub fn thaw(&self) {
if let Err(e) = self.event_loop.send(ConstellationControlMsg::Thaw(self.id)) {
warn!("Sending freeze message failed ({}).", e);
/// Notify this pipeline of its activity.
pub fn set_activity(&self, activity: DocumentActivity) {
let msg = ConstellationControlMsg::SetDocumentActivity(self.id, activity);
if let Err(e) = self.event_loop.send(msg) {
warn!("Sending activity message failed ({}).", e);
}
}