constellation blocks on compositor before sending permission to paint to renderers

This commit is contained in:
Tim Kuehn 2013-07-29 22:40:43 -07:00
parent d9e71edb10
commit 80675351b3
2 changed files with 9 additions and 4 deletions

View file

@ -141,7 +141,7 @@ pub enum Msg {
/// Alerts the compositor to the current status of rendering.
ChangeRenderState(RenderState),
/// Sets the channel to the current layout and render tasks, along with their id
SetIds(SendableFrameTree),
SetIds(SendableFrameTree, Chan<()>),
}
/// Azure surface wrapping to work with the layers infrastructure.
@ -345,8 +345,9 @@ impl CompositorTask {
ChangeReadyState(ready_state) => window.set_ready_state(ready_state),
ChangeRenderState(render_state) => window.set_render_state(render_state),
SetIds(frame_tree) => {
SetIds(frame_tree, response_chan) => {
pipeline = Some(frame_tree.pipeline);
response_chan.send(());
}
GetSize(chan) => {

View file

@ -514,10 +514,12 @@ impl Constellation {
// 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.compositor_chan.send(SetIds(current_frame.to_sendable()));
return true;
}
}
@ -606,7 +608,9 @@ 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
self.compositor_chan.send(SetIds(frame_tree.to_sendable()));
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();
}