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

View file

@ -227,7 +227,7 @@ impl CompositorLayer for Layer<CompositorData> {
let _ = pipeline.paint_chan.send(PaintMsg::UnusedBuffer(unused_buffers)); let _ = pipeline.paint_chan.send(PaintMsg::UnusedBuffer(unused_buffers));
} }
return true; true
} }
fn clear<Window>(&self, compositor: &IOCompositor<Window>) where Window: WindowMethods { 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); let mut rw_data = self.lock_rw_data(possibly_locked_rw_data);
match (&mut *rw_data).parallel_traversal { if let Some(ref mut traversal) = (&mut *rw_data).parallel_traversal {
None => {} traversal.shutdown()
Some(ref mut traversal) => traversal.shutdown(),
} }
LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data); LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data);
} }