Skip to content

Commit

Permalink
Inline push_pending_frame into its callers.
Browse files Browse the repository at this point in the history
The recently added replace argument makes it less readable, especially with
the second boolean argument I am adding in #11893.
  • Loading branch information
Ms2ger committed Sep 20, 2016
1 parent 53938c4 commit 61402b8
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions components/constellation/constellation.rs
Expand Up @@ -612,18 +612,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.pipelines.insert(pipeline_id, pipeline);
}

// Push a new (loading) pipeline to the list of pending frame changes
fn push_pending_frame(&mut self, new_pipeline_id: PipelineId,
old_pipeline_id: Option<PipelineId>,
replace: bool) {
self.pending_frames.push(FrameChange {
old_pipeline_id: old_pipeline_id,
new_pipeline_id: new_pipeline_id,
document_ready: false,
replace: replace,
});
}

// Get an iterator for the current frame tree. Specify self.root_frame_id to
// iterate the entire tree, or a specific frame id to iterate only that sub-tree.
fn current_frame_tree_iter(&self, frame_id_root: Option<FrameId>) -> FrameTreeIterator {
Expand Down Expand Up @@ -1158,7 +1146,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let load_data = LoadData::new(failure_url, None, None);
self.new_pipeline(new_pipeline_id, parent_info, Some(pipeline_id), window_size, None, load_data, false);

self.push_pending_frame(new_pipeline_id, Some(pipeline_id), false);
self.pending_frames.push(FrameChange {
old_pipeline_id: Some(pipeline_id),
new_pipeline_id: new_pipeline_id,
document_ready: false,
replace: false,
});
}
}

Expand All @@ -1183,7 +1176,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.new_pipeline(root_pipeline_id, None, None, Some(window_size), None,
LoadData::new(url.clone(), None, None), false);
self.handle_load_start_msg(root_pipeline_id);
self.push_pending_frame(root_pipeline_id, None, false);
self.pending_frames.push(FrameChange {
old_pipeline_id: None,
new_pipeline_id: root_pipeline_id,
document_ready: false,
replace: false,
});
self.compositor_proxy.send(ToCompositorMsg::ChangePageUrl(root_pipeline_id, url));
}

Expand Down Expand Up @@ -1305,7 +1303,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
load_data,
is_private);

self.push_pending_frame(load_info.new_pipeline_id, load_info.old_pipeline_id, load_info.replace);
self.pending_frames.push(FrameChange {
old_pipeline_id: load_info.old_pipeline_id,
new_pipeline_id: load_info.new_pipeline_id,
document_ready: false,
replace: load_info.replace,
});
}

fn handle_set_cursor_msg(&mut self, cursor: Cursor) {
Expand Down Expand Up @@ -1437,7 +1440,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let window_size = self.pipelines.get(&source_id).and_then(|source| source.size);
let new_pipeline_id = PipelineId::new();
self.new_pipeline(new_pipeline_id, None, None, window_size, None, load_data, false);
self.push_pending_frame(new_pipeline_id, Some(source_id), replace);
self.pending_frames.push(FrameChange {
old_pipeline_id: Some(source_id),
new_pipeline_id: new_pipeline_id,
document_ready: false,
replace: replace,
});

// Send message to ScriptThread that will suspend all timers
match self.pipelines.get(&source_id) {
Expand Down

0 comments on commit 61402b8

Please sign in to comment.