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 // 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. // 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; // Messages originating in the current frame are not navigations;
// TODO(tkuehn): In fact, this kind of message might be provably // TODO(tkuehn): In fact, this kind of message might be provably
// impossible to occur. // impossible to occur.
if current_frame.contains(pipeline_id) { if current_frame.contains(pipeline_id) {
let (port, chan) = comm::stream(); self.set_ids(current_frame);
self.compositor_chan.send(SetIds(current_frame.to_sendable(), chan));
port.recv();
for current_frame.iter().advance |frame| {
frame.pipeline.grant_paint_permission();
}
return true; return true;
} }
} }
@ -608,12 +603,7 @@ impl Constellation {
// Grants a frame tree permission to paint; optionally updates navigation to reflect a new page // 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) { fn grant_paint_permission(&mut self, frame_tree: @mut FrameTree) {
// Give permission to paint to the new frame and all child frames // Give permission to paint to the new frame and all child frames
let (port, chan) = comm::stream(); self.set_ids(frame_tree);
self.compositor_chan.send(SetIds(frame_tree.to_sendable(), chan));
port.recv();
for frame_tree.iter().advance |frame| {
frame.pipeline.grant_paint_permission();
}
// 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)
@ -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();
}
}
} }