From 79ef2067cdd6c9b5476dc37fa786ef2ea9b7f45b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 23 Jan 2017 17:07:02 +0100 Subject: [PATCH] constellation: Cleanup the frame size handler. This is a followup to #15129, addressing my last review comment. --- components/constellation/constellation.rs | 33 ++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 2cb9082e31a..132bf40e1ac 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -1329,23 +1329,26 @@ impl Constellation fn handle_frame_size_msg(&mut self, iframe_sizes: Vec<(PipelineId, TypedSize2D)>) { for (pipeline_id, size) in iframe_sizes { - let result = match self.pipelines.get_mut(&pipeline_id) { - Some(pipeline) => { - if pipeline.size != Some(size) { - pipeline.size = Some(size); - let msg = ConstellationControlMsg::Resize(pipeline_id, WindowSizeData { - visible_viewport: size, - initial_viewport: size * ScaleFactor::new(1.0), - device_pixel_ratio: self.window_size.device_pixel_ratio, - }, WindowSizeType::Initial); - Some(pipeline.event_loop.send(msg)) - } else { - None - } + let result = { + let pipeline = match self.pipelines.get_mut(&pipeline_id) { + Some(pipeline) => pipeline, + None => continue, + }; + + if pipeline.size == Some(size) { + continue; } - None => None + + pipeline.size = Some(size); + let msg = ConstellationControlMsg::Resize(pipeline_id, WindowSizeData { + visible_viewport: size, + initial_viewport: size * ScaleFactor::new(1.0), + device_pixel_ratio: self.window_size.device_pixel_ratio, + }, WindowSizeType::Initial); + + pipeline.event_loop.send(msg) }; - if let Some(Err(e)) = result { + if let Err(e) = result { self.handle_send_error(pipeline_id, e); } }