Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure FrameState consistency #15091

Merged
merged 1 commit into from Jan 18, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

add methods to ensure frame state stays consistent

  • Loading branch information
cbrewster committed Jan 18, 2017
commit eedff27ea9277a411637decbb66685e3905a45c8
@@ -2033,9 +2033,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>

debug_assert_eq!(entry.instant, curr_entry.instant);

frame.pipeline_id = pipeline_id;
frame.instant = entry.instant;
frame.url = entry.url.clone();
frame.update_current(pipeline_id, &entry);

old_pipeline_id
},
@@ -2130,7 +2128,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let (evicted_id, new_frame, clear_future, location_changed) = if let Some(mut entry) = frame_change.replace {
debug!("Replacing pipeline in existing frame.");
let evicted_id = entry.pipeline_id;
entry.pipeline_id = Some(frame_change.new_pipeline_id);
entry.replace_pipeline(frame_change.new_pipeline_id, frame_change.url.clone());
self.traverse_to_entry(entry);
(evicted_id, false, false, false)
} else if let Some(frame) = self.frames.get_mut(&frame_change.frame_id) {
@@ -76,6 +76,13 @@ impl Frame {
pub fn remove_forward_entries(&mut self) -> Vec<FrameState> {
replace(&mut self.next, vec!())
}

/// Update the current entry of the Frame from an entry that has been traversed to.
pub fn update_current(&mut self, pipeline_id: PipelineId, entry: &FrameState) {
self.pipeline_id = pipeline_id;
self.instant = entry.instant;
self.url = entry.url.clone();
}
}

/// An entry in a frame's session history.
@@ -99,6 +106,15 @@ pub struct FrameState {
pub frame_id: FrameId,
}

impl FrameState {
/// Updates the entry's pipeline and url. This is used when navigating with replacement
/// enabled.
pub fn replace_pipeline(&mut self, pipeline_id: PipelineId, url: ServoUrl) {
self.pipeline_id = Some(pipeline_id);
self.url = url;
}
}

/// Represents a pending change in the frame tree, that will be applied
/// once the new pipeline has loaded and completed initial layout / paint.
pub struct FrameChange {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.