aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-04-02 23:08:45 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2016-04-02 23:08:45 +0530
commit85f9f9626eaff12b66299eb6190955f2726b432c (patch)
tree52f0ac74111b291b850008fc9196dc157ad496d0 /components
parent7f4929d52dd33bcb3e231e776179314304fe1889 (diff)
parent6dab59f8cec5587248241b035bee60a75b5a07ba (diff)
downloadservo-85f9f9626eaff12b66299eb6190955f2726b432c.tar.gz
servo-85f9f9626eaff12b66299eb6190955f2726b432c.zip
Auto merge of #10343 - asajeffrey:document-constellation-recv-panic, r=jdm
Comment explaining constellation panic for recv A retry of #10294, which was closed due to homu issues. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10343) <!-- Reviewable:end -->
Diffstat (limited to 'components')
-rw-r--r--components/compositing/constellation.rs20
1 files changed, 16 insertions, 4 deletions
diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs
index dbb22b84fc6..b41f75c7b6e 100644
--- a/components/compositing/constellation.rs
+++ b/components/compositing/constellation.rs
@@ -536,6 +536,17 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
Paint(FromPaintMsg)
}
+ // Get one incoming request.
+ // This is one of the few places where the compositor is
+ // allowed to panic. If one of the receiver.recv() calls
+ // fails, it is because the matching sender has been
+ // reclaimed, but this can't happen in normal execution
+ // because the constellation keeps a pointer to the sender,
+ // so it should never be reclaimed. A possible scenario in
+ // which receiver.recv() fails is if some unsafe code
+ // produces undefined behaviour, resulting in the destructor
+ // being called. If this happens, there's not much we can do
+ // other than panic.
let request = {
let receiver_from_script = &self.script_receiver;
let receiver_from_compositor = &self.compositor_receiver;
@@ -543,16 +554,17 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
let receiver_from_paint = &self.painter_receiver;
select! {
msg = receiver_from_script.recv() =>
- Request::Script(msg.unwrap()),
+ Request::Script(msg.expect("Unexpected script failure in constellation")),
msg = receiver_from_compositor.recv() =>
- Request::Compositor(msg.unwrap()),
+ Request::Compositor(msg.expect("Unexpected compositor failure in constellation")),
msg = receiver_from_layout.recv() =>
- Request::Layout(msg.unwrap()),
+ Request::Layout(msg.expect("Unexpected layout failure in constellation")),
msg = receiver_from_paint.recv() =>
- Request::Paint(msg.unwrap())
+ Request::Paint(msg.expect("Unexpected paint failure in constellation"))
}
};
+ // Process the request.
match request {
// Messages from compositor