servo: Merge #13334 - Inline push_pending_frame into its callers (from servo:push_pending_frame); r=nox
authorMs2ger <Ms2ger@gmail.com>
Tue, 20 Sep 2016 07:04:38 -0500
changeset 339713 7e7ce6109e760d9c7a1fff7117748c8eb2a4e6f3
parent 339712 43d98697e837c3d2855bd0194027486d52ee623c
child 339714 07656d9478d88ab82b55ce39ccd07aa2c000b8ad
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnox
servo: Merge #13334 - Inline push_pending_frame into its callers (from servo:push_pending_frame); r=nox The recently added replace argument makes it less readable, especially with the second boolean argument I am adding in #11893. Source-Repo: https://github.com/servo/servo Source-Revision: 0d7e747acb7815dfc0cabeed8bd1df7d057f289e
servo/components/constellation/constellation.rs
--- a/servo/components/constellation/constellation.rs
+++ b/servo/components/constellation/constellation.rs
@@ -607,28 +607,16 @@ impl<Message, LTF, STF> Constellation<Me
         if let Some(child_process) = child_process {
             self.child_processes.push(child_process);
         }
 
         assert!(!self.pipelines.contains_key(&pipeline_id));
         self.pipelines.insert(pipeline_id, pipeline);
     }
 
-    // Push a new (loading) pipeline to the list of pending frame changes
-    fn push_pending_frame(&mut self, new_pipeline_id: PipelineId,
-                          old_pipeline_id: Option<PipelineId>,
-                          replace: bool) {
-        self.pending_frames.push(FrameChange {
-            old_pipeline_id: old_pipeline_id,
-            new_pipeline_id: new_pipeline_id,
-            document_ready: false,
-            replace: replace,
-        });
-    }
-
     // Get an iterator for the current frame tree. Specify self.root_frame_id to
     // iterate the entire tree, or a specific frame id to iterate only that sub-tree.
     fn current_frame_tree_iter(&self, frame_id_root: Option<FrameId>) -> FrameTreeIterator {
         FrameTreeIterator {
             stack: frame_id_root.into_iter().collect(),
             pipelines: &self.pipelines,
             frames: &self.frames,
         }
@@ -1153,17 +1141,22 @@ impl<Message, LTF, STF> Constellation<Me
             }
 
             warn!("creating replacement pipeline for about:failure");
 
             let new_pipeline_id = PipelineId::new();
             let load_data = LoadData::new(failure_url, None, None);
             self.new_pipeline(new_pipeline_id, parent_info, Some(pipeline_id), window_size, None, load_data, false);
 
-            self.push_pending_frame(new_pipeline_id, Some(pipeline_id), false);
+            self.pending_frames.push(FrameChange {
+                old_pipeline_id: Some(pipeline_id),
+                new_pipeline_id: new_pipeline_id,
+                document_ready: false,
+                replace: false,
+            });
         }
     }
 
     fn handle_log_entry(&mut self, pipeline_id: Option<PipelineId>, thread_name: Option<String>, entry: LogEntry) {
         debug!("Received log entry {:?}.", entry);
         match entry {
             LogEntry::Panic(reason, backtrace) => self.handle_panic(pipeline_id, reason, Some(backtrace)),
             LogEntry::Error(reason) | LogEntry::Warn(reason) => {
@@ -1178,17 +1171,22 @@ impl<Message, LTF, STF> Constellation<Me
 
     fn handle_init_load(&mut self, url: Url) {
         let window_size = self.window_size.visible_viewport;
         let root_pipeline_id = PipelineId::new();
         debug_assert!(PipelineId::fake_root_pipeline_id() == root_pipeline_id);
         self.new_pipeline(root_pipeline_id, None, None, Some(window_size), None,
                           LoadData::new(url.clone(), None, None), false);
         self.handle_load_start_msg(root_pipeline_id);
-        self.push_pending_frame(root_pipeline_id, None, false);
+        self.pending_frames.push(FrameChange {
+            old_pipeline_id: None,
+            new_pipeline_id: root_pipeline_id,
+            document_ready: false,
+            replace: false,
+        });
         self.compositor_proxy.send(ToCompositorMsg::ChangePageUrl(root_pipeline_id, url));
     }
 
     fn handle_frame_size_msg(&mut self,
                              pipeline_id: PipelineId,
                              size: &TypedSize2D<f32, PagePx>) {
         let msg = ConstellationControlMsg::Resize(pipeline_id, WindowSizeData {
             visible_viewport: *size,
@@ -1300,17 +1298,22 @@ impl<Message, LTF, STF> Constellation<Me
         self.new_pipeline(load_info.new_pipeline_id,
                           Some((load_info.parent_pipeline_id, load_info.frame_type)),
                           load_info.old_pipeline_id,
                           window_size,
                           script_chan,
                           load_data,
                           is_private);
 
-        self.push_pending_frame(load_info.new_pipeline_id, load_info.old_pipeline_id, load_info.replace);
+        self.pending_frames.push(FrameChange {
+            old_pipeline_id: load_info.old_pipeline_id,
+            new_pipeline_id: load_info.new_pipeline_id,
+            document_ready: false,
+            replace: load_info.replace,
+        });
     }
 
     fn handle_set_cursor_msg(&mut self, cursor: Cursor) {
         self.compositor_proxy.send(ToCompositorMsg::SetCursor(cursor))
     }
 
     fn handle_change_running_animations_state(&mut self,
                                               pipeline_id: PipelineId,
@@ -1432,17 +1435,22 @@ impl<Message, LTF, STF> Constellation<Me
                 self.handle_load_start_msg(source_id);
                 // Being here means either there are no pending frames, or none of the pending
                 // changes would be overridden by changing the subframe associated with source_id.
 
                 // Create the new pipeline
                 let window_size = self.pipelines.get(&source_id).and_then(|source| source.size);
                 let new_pipeline_id = PipelineId::new();
                 self.new_pipeline(new_pipeline_id, None, None, window_size, None, load_data, false);
-                self.push_pending_frame(new_pipeline_id, Some(source_id), replace);
+                self.pending_frames.push(FrameChange {
+                    old_pipeline_id: Some(source_id),
+                    new_pipeline_id: new_pipeline_id,
+                    document_ready: false,
+                    replace: replace,
+                });
 
                 // Send message to ScriptThread that will suspend all timers
                 match self.pipelines.get(&source_id) {
                     Some(source) => source.freeze(),
                     None => warn!("Pipeline {:?} loaded after closure", source_id),
                 };
                 Some(new_pipeline_id)
             }