refactored for more code reuse in constellation

This commit is contained in:
Tim Kuehn 2013-07-29 22:48:19 -07:00
parent 80675351b3
commit 1d4b0844b4

View file

@ -509,17 +509,12 @@ impl Constellation {
// from a pending frame. The only time that we will grant paint permission is
// when the message originates from a pending frame or the current frame.
for self.current_frame().iter().advance |current_frame| {
for self.current_frame().iter().advance |&current_frame| {
// Messages originating in the current frame are not navigations;
// TODO(tkuehn): In fact, this kind of message might be provably
// impossible to occur.
if current_frame.contains(pipeline_id) {
let (port, chan) = comm::stream();
self.compositor_chan.send(SetIds(current_frame.to_sendable(), chan));
port.recv();
for current_frame.iter().advance |frame| {
frame.pipeline.grant_paint_permission();
}
self.set_ids(current_frame);
return true;
}
}
@ -608,12 +603,7 @@ impl Constellation {
// Grants a frame tree permission to paint; optionally updates navigation to reflect a new page
fn grant_paint_permission(&mut self, frame_tree: @mut FrameTree) {
// Give permission to paint to the new frame and all child frames
let (port, chan) = comm::stream();
self.compositor_chan.send(SetIds(frame_tree.to_sendable(), chan));
port.recv();
for frame_tree.iter().advance |frame| {
frame.pipeline.grant_paint_permission();
}
self.set_ids(frame_tree);
// Don't call navigation_context.load() on a Navigate type (or None, as in the case of
// parsed iframes that finish loading)
@ -633,5 +623,14 @@ impl Constellation {
_ => {}
}
}
fn set_ids(&self, frame_tree: @mut FrameTree) {
let (port, chan) = comm::stream();
self.compositor_chan.send(SetIds(frame_tree.to_sendable(), chan));
port.recv();
for frame_tree.iter().advance |frame| {
frame.pipeline.grant_paint_permission();
}
}
}