aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/constellation/constellation.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index 962cc92d169..d3a91e8ae2a 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -1735,6 +1735,9 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
return ReadyToSave::PendingFrames;
}
+ let (state_sender, state_receiver) = ipc::channel().expect("Failed to create IPC channel!");
+ let (epoch_sender, epoch_receiver) = ipc::channel().expect("Failed to create IPC channel!");
+
// Step through the current frame tree, checking that the script
// thread is idle, and that the current epoch of the layout thread
// matches what the compositor has painted. If all these conditions
@@ -1757,12 +1760,11 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
// before we check whether the document is ready; otherwise,
// there's a race condition where a webfont has finished loading,
// but hasn't yet notified the document.
- let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
- let msg = LayoutControlMsg::GetWebFontLoadState(sender);
+ let msg = LayoutControlMsg::GetWebFontLoadState(state_sender.clone());
if let Err(e) = pipeline.layout_chan.0.send(msg) {
warn!("Get web font failed ({})", e);
}
- if receiver.recv().unwrap_or(true) {
+ if state_receiver.recv().unwrap_or(true) {
return ReadyToSave::WebFontNotLoaded;
}
@@ -1794,12 +1796,11 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
// epoch matches what the compositor has drawn. If they match
// (and script is idle) then this pipeline won't change again
// and can be considered stable.
- let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
let LayoutControlChan(ref layout_chan) = pipeline.layout_chan;
- if let Err(e) = layout_chan.send(LayoutControlMsg::GetCurrentEpoch(sender)) {
+ if let Err(e) = layout_chan.send(LayoutControlMsg::GetCurrentEpoch(epoch_sender.clone())) {
warn!("Failed to send GetCurrentEpoch ({}).", e);
}
- match receiver.recv() {
+ match epoch_receiver.recv() {
Err(e) => warn!("Failed to receive current epoch ({}).", e),
Ok(layout_thread_epoch) => if layout_thread_epoch != *compositor_epoch {
return ReadyToSave::EpochMismatch;