Simplify add_or_replace_pipeline_in_frame_tree.

This commit is contained in:
Ms2ger 2016-08-02 17:27:55 +02:00
parent 2aa257f603
commit d4e75e6165

View file

@ -1886,18 +1886,16 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// Remove paint permissions for the pipeline being replaced.
self.revoke_paint_permission(old_pipeline_id);
// Add new pipeline to navigation frame, and return frames evicted from history.
self.pipelines
.get(&old_pipeline_id)
.and_then(|pipeline| pipeline.frame)
.map(|frame_id| {
self.pipelines.get_mut(&frame_change.new_pipeline_id)
.map(|pipeline| pipeline.frame = Some(frame_id));
self.frames.get_mut(&frame_id).map(|frame| frame.load(frame_change.new_pipeline_id));
frame_id
})
self.pipelines.get(&old_pipeline_id).and_then(|pipeline| pipeline.frame)
});
if let Some(frame_id) = frame_id {
// Add new pipeline to navigation frame, and return frames evicted from history.
self.pipelines.get_mut(&frame_change.new_pipeline_id)
.map(|pipeline| pipeline.frame = Some(frame_id));
self.frames.get_mut(&frame_id).map(|frame| frame.load(frame_change.new_pipeline_id));
}
if let None = frame_id {
// The new pipeline is in a new frame with no history
let frame_id = self.new_frame(frame_change.new_pipeline_id);