aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread_2020/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout_thread_2020/lib.rs')
-rw-r--r--components/layout_thread_2020/lib.rs25
1 files changed, 10 insertions, 15 deletions
diff --git a/components/layout_thread_2020/lib.rs b/components/layout_thread_2020/lib.rs
index 4e04f6f0c4b..ce23c087056 100644
--- a/components/layout_thread_2020/lib.rs
+++ b/components/layout_thread_2020/lib.rs
@@ -134,7 +134,7 @@ pub struct LayoutThread {
font_cache_sender: IpcSender<()>,
/// A means of communication with the background hang monitor.
- background_hang_monitor: Option<Box<dyn BackgroundHangMonitor>>,
+ background_hang_monitor: Box<dyn BackgroundHangMonitor>,
/// The channel on which messages can be sent to the script thread.
script_chan: IpcSender<ConstellationControlMsg>,
@@ -234,7 +234,7 @@ impl LayoutThreadFactory for LayoutThread {
is_iframe: bool,
chan: (Sender<Msg>, Receiver<Msg>),
pipeline_port: IpcReceiver<LayoutControlMsg>,
- background_hang_monitor_register: Option<Box<dyn BackgroundHangMonitorRegister>>,
+ background_hang_monitor_register: Box<dyn BackgroundHangMonitorRegister>,
constellation_chan: IpcSender<ConstellationMsg>,
script_chan: IpcSender<ConstellationControlMsg>,
image_cache: Arc<dyn ImageCache>,
@@ -267,13 +267,13 @@ impl LayoutThreadFactory for LayoutThread {
// Ensures layout thread is destroyed before we send shutdown message
let sender = chan.0;
- let background_hang_monitor = background_hang_monitor_register.map(|bhm| {
- bhm.register_component(
+ let background_hang_monitor = background_hang_monitor_register
+ .register_component(
MonitoredComponentId(id, MonitoredComponentType::Layout),
Duration::from_millis(1000),
Duration::from_millis(5000),
- )
- });
+ None,
+ );
let layout = LayoutThread::new(
id,
@@ -450,7 +450,7 @@ impl LayoutThread {
is_iframe: bool,
port: Receiver<Msg>,
pipeline_port: IpcReceiver<LayoutControlMsg>,
- background_hang_monitor: Option<Box<dyn BackgroundHangMonitor>>,
+ background_hang_monitor: Box<dyn BackgroundHangMonitor>,
constellation_chan: IpcSender<ConstellationMsg>,
script_chan: IpcSender<ConstellationControlMsg>,
image_cache: Arc<dyn ImageCache>,
@@ -619,8 +619,7 @@ impl LayoutThread {
Msg::SetNavigationStart(..) => LayoutHangAnnotation::SetNavigationStart,
};
self.background_hang_monitor
- .as_ref()
- .map(|bhm| bhm.notify_activity(HangAnnotation::Layout(hang_annotation)));
+ .notify_activity(HangAnnotation::Layout(hang_annotation));
}
/// Receives and dispatches messages from the script and constellation threads
@@ -632,9 +631,7 @@ impl LayoutThread {
}
// Notify the background-hang-monitor we are waiting for an event.
- self.background_hang_monitor
- .as_ref()
- .map(|bhm| bhm.notify_wait());
+ self.background_hang_monitor.notify_wait();
let request = select! {
recv(self.pipeline_port) -> msg => Request::FromPipeline(msg.unwrap()),
@@ -851,9 +848,7 @@ impl LayoutThread {
}
fn exit_now(&mut self) {
- self.background_hang_monitor
- .as_ref()
- .map(|bhm| bhm.unregister());
+ self.background_hang_monitor.unregister();
}
fn handle_add_stylesheet(&self, stylesheet: &Stylesheet, guard: &SharedRwLockReadGuard) {