Skip to content

Commit

Permalink
Simplify add_or_replace_pipeline_in_frame_tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Aug 2, 2016
1 parent 2aa257f commit d4e75e6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions components/constellation/constellation.rs
Expand Up @@ -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);
Expand Down

0 comments on commit d4e75e6

Please sign in to comment.