Only clone the RenderChan once per Pipeline

This commit is contained in:
Cameron Zwarich 2014-07-10 01:31:48 -07:00
parent a378f3e680
commit 0f21d6be12
2 changed files with 8 additions and 7 deletions

View file

@ -752,8 +752,8 @@ impl IOCompositor {
&self.graphics_context, &self.graphics_context,
rect, rect,
scale.get()); scale.get());
for (_pipeline_id, requests) in request_map.move_iter() { for (_pipeline_id, (chan, requests)) in request_map.move_iter() {
for (chan, request) in requests.move_iter() { for request in requests.move_iter() {
let _ = chan.send_opt(ReRenderMsg(request)); let _ = chan.send_opt(ReRenderMsg(request));
} }
} }

View file

@ -122,8 +122,8 @@ impl CompositorData {
// Given the current window size, determine which tiles need to be (re-)rendered and sends them // Given the current window size, determine which tiles need to be (re-)rendered and sends them
// off the the appropriate renderer. Returns true if and only if the scene should be repainted. // off the the appropriate renderer. Returns true if and only if the scene should be repainted.
pub fn get_buffer_requests_recursively(requests: &mut HashMap<PipelineId, pub fn get_buffer_requests_recursively(requests: &mut HashMap<PipelineId,
Vec<(RenderChan, (RenderChan,
ReRenderRequest)>>, Vec<ReRenderRequest>)>,
layer: Rc<Layer<CompositorData>>, layer: Rc<Layer<CompositorData>>,
graphics_context: &NativeCompositingGraphicsContext, graphics_context: &NativeCompositingGraphicsContext,
window_rect: Rect<f32>, window_rect: Rect<f32>,
@ -142,15 +142,16 @@ impl CompositorData {
// FIXME(#2003, pcwalton): We may want to batch these up in the case in which // FIXME(#2003, pcwalton): We may want to batch these up in the case in which
// one page has multiple layers, to avoid the user seeing inconsistent states. // one page has multiple layers, to avoid the user seeing inconsistent states.
let pipeline_id = layer.extra_data.borrow().pipeline.id; let pipeline_id = layer.extra_data.borrow().pipeline.id;
let chan = layer.extra_data.borrow().pipeline.render_chan.clone();
let msg = ReRenderRequest { let msg = ReRenderRequest {
buffer_requests: request, buffer_requests: request,
scale: scale, scale: scale,
layer_id: layer.extra_data.borrow().id, layer_id: layer.extra_data.borrow().id,
epoch: layer.extra_data.borrow().epoch, epoch: layer.extra_data.borrow().epoch,
}; };
let vec = requests.find_or_insert(pipeline_id, Vec::new()); let &(_, ref mut vec) = requests.find_or_insert_with(pipeline_id, |_| {
vec.push((chan, msg)); (layer.extra_data.borrow().pipeline.render_chan.clone(), Vec::new())
});
vec.push(msg);
} }
if redisplay { if redisplay {