Auto merge of #5572 - laumann:remove-unnecessary-buffer-sends, r=glennw

Some debugging reveals that the send_back_unused_buffers() quite often sends empty vectors back to the paint task. This still incurs a communication overhead though. Instead check that the there actually are buffers to send back.
This commit is contained in:
bors-servo 2015-04-09 20:28:31 -05:00
commit 80851f7055
3 changed files with 11 additions and 13 deletions

View file

@ -718,12 +718,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
layer_id: LayerId,
new_layer_buffer_set: Box<LayerBufferSet>,
epoch: Epoch) {
match self.find_layer_with_pipeline_and_layer_id(pipeline_id, layer_id) {
Some(layer) => {
self.assign_painted_buffers_to_layer(layer, new_layer_buffer_set, epoch);
return;
}
None => {}
if let Some(layer) = self.find_layer_with_pipeline_and_layer_id(pipeline_id, layer_id) {
self.assign_painted_buffers_to_layer(layer, new_layer_buffer_set, epoch);
return
}
let pipeline = self.get_pipeline(pipeline_id);
@ -1021,15 +1018,17 @@ impl<Window: WindowMethods> IOCompositor<Window> {
});
}
return results;
results
}
fn send_back_unused_buffers(&mut self,
unused_buffers: Vec<(Rc<Layer<CompositorData>>,
Vec<Box<LayerBuffer>>)>) {
for (layer, buffers) in unused_buffers.into_iter() {
let pipeline = self.get_pipeline(layer.get_pipeline_id());
let _ = pipeline.paint_chan.send_opt(PaintMsg::UnusedBuffer(buffers));
if !buffers.is_empty() {
let pipeline = self.get_pipeline(layer.get_pipeline_id());
let _ = pipeline.paint_chan.send_opt(PaintMsg::UnusedBuffer(buffers));
}
}
}

View file

@ -227,7 +227,7 @@ impl CompositorLayer for Layer<CompositorData> {
let _ = pipeline.paint_chan.send(PaintMsg::UnusedBuffer(unused_buffers));
}
return true;
true
}
fn clear<Window>(&self, compositor: &IOCompositor<Window>) where Window: WindowMethods {

View file

@ -557,9 +557,8 @@ impl LayoutTask {
{
let mut rw_data = self.lock_rw_data(possibly_locked_rw_data);
match (&mut *rw_data).parallel_traversal {
None => {}
Some(ref mut traversal) => traversal.shutdown(),
if let Some(ref mut traversal) = (&mut *rw_data).parallel_traversal {
traversal.shutdown()
}
LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data);
}