Repository navigation
Replace side-effecting unwrap_or_else by if let in constellation. - #10345
Conversation
|
-S-awaiting-review +S-needs-code-changes Reviewed 1 of 1 files at r1. components/compositing/constellation.rs, line 717 [r1] (raw file): In that case, I would do: if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
if let Err(e) = pipeline.script_chan.send(msg) {
self.handle_send_error(pipeline_id, e);
}
} else {
debug!(...);
return true;
}components/compositing/constellation.rs, line 729 [r1] (raw file): components/compositing/constellation.rs, line 908 [r1] (raw file): if let Some(pipeline) = self.pipelines.get_mut(&pipeline_id) {
pipeline.size = Some(*size);
if let Err(e) = pipeline.script_chan.send(msg) {
self.handle_send_error(pipeline_id, e);
}
}components/compositing/constellation.rs, line 930 [r1] (raw file): components/compositing/constellation.rs, line 1030 [r1] (raw file): let pipeline = match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline,
None => {
debug!(...);
return;
}
};
let result = match tick_type {
AnimationTickType::Script => {
pipeline.script_chan.0.send(ConstellationControlMsg::TickAllAnimations(pipeline_id))
},
AnimationTickType::Layout => {
pipeline.layout_chan.0.send(LayoutControlMsg::TickAnimations)
}
};
if let Err(e) = result {
self.handle_send_error(pipeline_id, e);
}I really think we should have a specific function on pipelines, which would take a channel and a message and would call components/compositing/constellation.rs, line 1042 [r1] (raw file): let (parent_info, window_size) =
self.pipelines.get(&source_id)
.map(|source| (source.parent_info, source.size))
.unwrap_or((None, None));components/compositing/constellation.rs, line 1058 [r1] (raw file): components/compositing/constellation.rs, line 1083 [r1] (raw file): components/compositing/constellation.rs, line 1235 [r1] (raw file): components/compositing/constellation.rs, line 1253 [r1] (raw file): components/compositing/constellation.rs, line 1262 [r1] (raw file): components/compositing/constellation.rs, line 1338 [r1] (raw file): components/compositing/constellation.rs, line 1411 [r1] (raw file): components/compositing/constellation.rs, line 1431 [r1] (raw file): Comments from Reviewable |
|
@nox: I reverted some of your suggested changes, since I couldn't get them to pass borrowchk. Serves me right for checking in changes without compiling them! |
|
Review status: 0 of 1 files reviewed at latest revision, 14 unresolved discussions. components/compositing/constellation.rs, line 717 [r1] (raw file): components/compositing/constellation.rs, line 729 [r1] (raw file): components/compositing/constellation.rs, line 908 [r1] (raw file): Comments from Reviewable |
|
Review status: 0 of 1 files reviewed at latest revision, 14 unresolved discussions. components/compositing/constellation.rs, line 717 [r1] (raw file): components/compositing/constellation.rs, line 729 [r1] (raw file): components/compositing/constellation.rs, line 908 [r1] (raw file): Comments from Reviewable |
c7f898f to
ef84e1f
Compare
|
Rebased and squashed. |
|
☔ The latest upstream changes (presumably #10224) made this pull request unmergeable. Please resolve the merge conflicts. |
ef84e1f to
0afb803
Compare
|
Rebased. |
|
☔ The latest upstream changes (presumably #10489) made this pull request unmergeable. Please resolve the merge conflicts. |
0afb803 to
05f1655
Compare
|
Rebased. @nox: this is bitrotting. |
|
☔ The latest upstream changes (presumably #10587) made this pull request unmergeable. Please resolve the merge conflicts. |
This addresses nox's comments in servo#10295.
05f1655 to
0cca4a9
Compare
|
Another rebase. Serious bitrotting here :( |
|
Sorry about this @asajeffrey. Looks good to me with your last remarks and changes. @bors-servo r+ |
|
📌 Commit 0cca4a9 has been approved by |
Replace side-effecting unwrap_or_else by if let in constellation. This addresses @nox's comments in #10295. <!-- 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/10345) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt |
|
Thanks! |
This addresses @nox's comments in #10295.
This change is