mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Only send unused buffers messages if there are actually any buffers
Some debugging reveals that the send_back_unused_buffers() quite often sends empty vectors back to the paint task. This still incurs an communication overhead though. Instead check that the there actually are buffers to send back.
This commit is contained in:
parent
1fd609d198
commit
0c1eeb2fc7
3 changed files with 11 additions and 13 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue