mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Fix set_ids naming in Constellation
The set_ids name is a holdover from a previous design and no longer reflects what this method does. Instead move the content into grant_paint_permission and rename it to send_frame_tree_and_grant_paint_permission. Also move out the handling of evicted iframes into its own method.
This commit is contained in:
parent
d747a33df9
commit
0d297aea9b
1 changed files with 27 additions and 27 deletions
|
@ -872,7 +872,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
for frame in destination_frame.iter() {
|
for frame in destination_frame.iter() {
|
||||||
frame.pipeline.borrow().load();
|
frame.pipeline.borrow().load();
|
||||||
}
|
}
|
||||||
self.grant_paint_permission(destination_frame, NavigationType::Navigate);
|
self.send_frame_tree_and_grant_paint_permission(destination_frame);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -978,7 +978,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.grant_paint_permission(next_frame_tree, frame_change.navigation_type);
|
self.send_frame_tree_and_grant_paint_permission(next_frame_tree.clone());
|
||||||
|
self.handle_evicted_frames_for_load_navigation(next_frame_tree,
|
||||||
|
frame_change.navigation_type);
|
||||||
},
|
},
|
||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
|
@ -1032,8 +1034,8 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_evicted_frames(&mut self, evicted: Vec<Rc<FrameTree>>) {
|
fn handle_evicted_frames(&mut self, evicted_frames: Vec<Rc<FrameTree>>) {
|
||||||
for frame_tree in evicted.into_iter() {
|
for frame_tree in evicted_frames.into_iter() {
|
||||||
if !self.navigation_context.contains(frame_tree.pipeline.borrow().id) {
|
if !self.navigation_context.contains(frame_tree.pipeline.borrow().id) {
|
||||||
self.close_pipelines(frame_tree);
|
self.close_pipelines(frame_tree);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1044,41 +1046,39 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grants a frame tree permission to paint; optionally updates navigation to reflect a new page
|
|
||||||
fn grant_paint_permission(&mut self, frame_tree: Rc<FrameTree>, navigation_type: NavigationType) {
|
|
||||||
// Give permission to paint to the new frame and all child frames
|
|
||||||
self.set_ids(&frame_tree);
|
|
||||||
|
|
||||||
|
fn handle_evicted_frames_for_load_navigation(&mut self,
|
||||||
|
frame_tree: Rc<FrameTree>,
|
||||||
|
navigation_type: NavigationType) {
|
||||||
// Don't call navigation_context.load() on a Navigate type (or None, as in the case of
|
// Don't call navigation_context.load() on a Navigate type (or None, as in the case of
|
||||||
// parsed iframes that finish loading)
|
// parsed iframes that finish loading).
|
||||||
match navigation_type {
|
match navigation_type {
|
||||||
NavigationType::Load => {
|
NavigationType::Load => {
|
||||||
debug!("evicting old frames due to load");
|
debug!("Evicting frames for NavigationType::Load");
|
||||||
let evicted = self.navigation_context.load(frame_tree,
|
let evicted_frames = self.navigation_context.load(frame_tree,
|
||||||
&mut *self.compositor_proxy);
|
&mut *self.compositor_proxy);
|
||||||
self.handle_evicted_frames(evicted);
|
self.handle_evicted_frames(evicted_frames);
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
debug!("ignoring non-load navigation type");
|
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_ids(&mut self, frame_tree: &Rc<FrameTree>) {
|
// Grants a frame tree permission to paint; optionally updates navigation to reflect a new page
|
||||||
let (chan, port) = channel();
|
fn send_frame_tree_and_grant_paint_permission(&mut self, frame_tree: Rc<FrameTree>) {
|
||||||
debug!("Constellation sending SetFrameTree");
|
debug!("Constellation sending SetFrameTree");
|
||||||
|
let (chan, port) = channel();
|
||||||
self.compositor_proxy.send(CompositorMsg::SetFrameTree(frame_tree.to_sendable(),
|
self.compositor_proxy.send(CompositorMsg::SetFrameTree(frame_tree.to_sendable(),
|
||||||
chan,
|
chan,
|
||||||
self.chan.clone()));
|
self.chan.clone()));
|
||||||
match port.recv_opt() {
|
if port.recv_opt().is_err() {
|
||||||
Ok(()) => {
|
debug!("Compositor has discarded SetFrameTree");
|
||||||
let mut iter = frame_tree.iter();
|
return; // Our message has been discarded, probably shutting down.
|
||||||
for frame in iter {
|
}
|
||||||
frame.has_compositor_layer.set(true);
|
|
||||||
frame.pipeline.borrow().grant_paint_permission();
|
let mut iter = frame_tree.iter();
|
||||||
}
|
for frame in iter {
|
||||||
}
|
frame.has_compositor_layer.set(true);
|
||||||
Err(()) => {} // message has been discarded, probably shutting down
|
frame.pipeline.borrow().grant_paint_permission();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue