servo: Merge #12909 - Add FrameState (from cbrewster:framestate); r=asajeffrey
authorConnor Brewster <connor.brewster@eagles.oc.edu>
Wed, 17 Aug 2016 22:11:59 -0500
changeset 339516 0861ec36640987ad9cc0de27f97dec01b3f3f2d2
parent 339515 3967a95755b1b7917a6cd3d7d61ffb71274e957c
child 339517 1063ce638b16c5a57947aa77815adb0e4618f350
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)
reviewersasajeffrey
servo: Merge #12909 - Add FrameState (from cbrewster:framestate); r=asajeffrey <!-- Please describe your changes on the following line: --> r? @asajeffrey Might as well get this in now, since it may be a while before I can figure out what is causing the panics on the pending pipelines PR. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 4e7c689a815198a51f96fdcac48a15eabf2157c0
servo/components/constellation/constellation.rs
--- a/servo/components/constellation/constellation.rs
+++ b/servo/components/constellation/constellation.rs
@@ -214,40 +214,57 @@ pub struct InitialConstellationState {
     /// A channel to the memory profiler thread.
     pub mem_profiler_chan: mem::ProfilerChan,
     /// Whether the constellation supports the clipboard.
     pub supports_clipboard: bool,
     /// Optional webrender API reference (if enabled).
     pub webrender_api_sender: Option<webrender_traits::RenderApiSender>,
 }
 
+#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
+struct FrameState {
+    instant: Instant,
+    pipeline_id: PipelineId,
+    frame_id: FrameId,
+}
+
+impl FrameState {
+    fn new(pipeline_id: PipelineId, frame_id: FrameId) -> FrameState {
+        FrameState {
+            instant: Instant::now(),
+            pipeline_id: pipeline_id,
+            frame_id: frame_id,
+        }
+    }
+}
+
 /// Stores the navigation context for a single frame in the frame tree.
 struct Frame {
     id: FrameId,
-    prev: Vec<(PipelineId, Instant)>,
-    current: (PipelineId, Instant),
-    next: Vec<(PipelineId, Instant)>,
+    prev: Vec<FrameState>,
+    current: FrameState,
+    next: Vec<FrameState>,
 }
 
 impl Frame {
     fn new(id: FrameId, pipeline_id: PipelineId) -> Frame {
         Frame {
             id: id,
             prev: vec!(),
-            current: (pipeline_id, Instant::now()),
+            current: FrameState::new(pipeline_id, id),
             next: vec!(),
         }
     }
 
     fn load(&mut self, pipeline_id: PipelineId) {
-        self.prev.push(self.current);
-        self.current = (pipeline_id, Instant::now());
+        self.prev.push(self.current.clone());
+        self.current = FrameState::new(pipeline_id, self.id);
     }
 
-    fn remove_forward_entries(&mut self) -> Vec<(PipelineId, Instant)> {
+    fn remove_forward_entries(&mut self) -> Vec<FrameState> {
         replace(&mut self.next, vec!())
     }
 }
 
 /// Represents a pending change in the frame tree, that will be applied
 /// once the new pipeline has loaded and completed initial layout / paint.
 struct FrameChange {
     old_pipeline_id: Option<PipelineId>,
@@ -274,20 +291,20 @@ impl<'a> Iterator for FrameTreeIterator<
             };
             let frame = match self.frames.get(&frame_id) {
                 Some(frame) => frame,
                 None => {
                     warn!("Frame {:?} iterated after closure.", frame_id);
                     continue;
                 },
             };
-            let pipeline = match self.pipelines.get(&frame.current.0) {
+            let pipeline = match self.pipelines.get(&frame.current.pipeline_id) {
                 Some(pipeline) => pipeline,
                 None => {
-                    warn!("Pipeline {:?} iterated after closure.", frame.current.0);
+                    warn!("Pipeline {:?} iterated after closure.", frame.current.pipeline_id);
                     continue;
                 },
             };
             self.stack.extend(pipeline.children.iter().map(|&c| c));
             return Some(frame)
         }
     }
 }
@@ -308,18 +325,18 @@ impl<'a> Iterator for FullFrameTreeItera
             };
             let frame = match self.frames.get(&frame_id) {
                 Some(frame) => frame,
                 None => {
                     warn!("Frame {:?} iterated after closure.", frame_id);
                     continue;
                 },
             };
-            for &(pipeline_id, _) in frame.prev.iter().chain(frame.next.iter()).chain(once(&frame.current)) {
-                if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
+            for entry in frame.prev.iter().chain(frame.next.iter()).chain(once(&frame.current)) {
+                if let Some(pipeline) = self.pipelines.get(&entry.pipeline_id) {
                     self.stack.extend(pipeline.children.iter().map(|&c| c));
                 }
             }
             return Some(frame)
         }
     }
 }
 
@@ -617,31 +634,31 @@ impl<Message, LTF, STF> Constellation<Me
             pipelines: &self.pipelines,
             frames: &self.frames,
         }
     }
 
     fn joint_session_future(&self, frame_id_root: FrameId) -> Vec<(Instant, FrameId, PipelineId)> {
         let mut future = vec!();
         for frame in self.full_frame_tree_iter(frame_id_root) {
-            future.extend(frame.next.iter().map(|&(pipeline_id, instant)| (instant, frame.id, pipeline_id)));
+            future.extend(frame.next.iter().map(|entry| (entry.instant, entry.frame_id, entry.pipeline_id)));
         }
 
         // reverse sorting
         future.sort_by(|a, b| b.cmp(a));
         future
     }
 
     fn joint_session_past(&self, frame_id_root: FrameId) -> Vec<(Instant, FrameId, PipelineId)> {
         let mut past = vec!();
         for frame in self.full_frame_tree_iter(frame_id_root) {
-            let mut prev_instant = frame.current.1;
-            for &(pipeline_id, instant) in frame.prev.iter().rev() {
-                past.push((prev_instant, frame.id, pipeline_id));
-                prev_instant = instant;
+            let mut prev_instant = frame.current.instant;
+            for entry in frame.prev.iter().rev() {
+                past.push((prev_instant, entry.frame_id, entry.pipeline_id));
+                prev_instant = entry.instant;
             }
         }
 
         past.sort();
         past
     }
 
     // Create a new frame and update the internal bookkeeping.
@@ -1322,17 +1339,17 @@ impl<Message, LTF, STF> Constellation<Me
                     pipeline_id: PipelineId,
                     message: String,
                     sender: IpcSender<bool>) {
         let display_alert_dialog = if PREFS.is_mozbrowser_enabled() {
             let parent_pipeline_info = self.pipelines.get(&pipeline_id).and_then(|source| source.parent_info);
             if parent_pipeline_info.is_some() {
                 let root_pipeline_id = self.root_frame_id
                     .and_then(|root_frame_id| self.frames.get(&root_frame_id))
-                    .map(|root_frame| root_frame.current.0);
+                    .map(|root_frame| root_frame.current.pipeline_id);
 
                 let ancestor_info = self.get_mozbrowser_ancestor_info(pipeline_id);
                 if let Some((ancestor_id, subpage_id)) = ancestor_info {
                     if root_pipeline_id == Some(ancestor_id) {
                         match root_pipeline_id.and_then(|pipeline_id| self.pipelines.get(&pipeline_id)) {
                             Some(root_pipeline) => {
                                 // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsershowmodalprompt
                                 let event = MozBrowserEvent::ShowModalPrompt("alert".to_owned(), "Alert".to_owned(),
@@ -1512,17 +1529,17 @@ impl<Message, LTF, STF> Constellation<Me
     }
 
     fn handle_key_msg(&mut self, ch: Option<char>, key: Key, state: KeyState, mods: KeyModifiers) {
         // Send to the explicitly focused pipeline (if it exists), or the root
         // frame's current pipeline. If neither exist, fall back to sending to
         // the compositor below.
         let root_pipeline_id = self.root_frame_id
             .and_then(|root_frame_id| self.frames.get(&root_frame_id))
-            .map(|root_frame| root_frame.current.0);
+            .map(|root_frame| root_frame.current.pipeline_id);
         let pipeline_id = self.focus_pipeline_id.or(root_pipeline_id);
 
         match pipeline_id {
             Some(pipeline_id) => {
                 let event = CompositorEvent::KeyEvent(ch, key, state, mods);
                 let msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
                 let result = match self.pipelines.get(&pipeline_id) {
                     Some(pipeline) => pipeline.script_chan.send(msg),
@@ -1538,17 +1555,17 @@ impl<Message, LTF, STF> Constellation<Me
             }
         }
     }
 
     fn handle_reload_msg(&mut self) {
         // Send Reload constellation msg to root script channel.
         let root_pipeline_id = self.root_frame_id
             .and_then(|root_frame_id| self.frames.get(&root_frame_id))
-            .map(|root_frame| root_frame.current.0);
+            .map(|root_frame| root_frame.current.pipeline_id);
 
         if let Some(pipeline_id) = root_pipeline_id {
             let msg = ConstellationControlMsg::Reload(pipeline_id);
             let result = match self.pipelines.get(&pipeline_id) {
                 Some(pipeline) => pipeline.script_chan.send(msg),
                 None => return debug!("Pipeline {:?} got reload event after closure.", pipeline_id),
             };
             if let Err(e) = result {
@@ -1582,17 +1599,17 @@ impl<Message, LTF, STF> Constellation<Me
             None => warn!("Pipeline {:?} handling mozbrowser event after closure.", containing_pipeline_id),
         }
     }
 
     fn handle_get_pipeline(&mut self, frame_id: Option<FrameId>,
                            resp_chan: IpcSender<Option<(PipelineId, bool)>>) {
         let current_pipeline_id = frame_id.or(self.root_frame_id)
             .and_then(|frame_id| self.frames.get(&frame_id))
-            .map(|frame| frame.current.0);
+            .map(|frame| frame.current.pipeline_id);
         let current_pipeline_id_loaded = current_pipeline_id
             .map(|id| (id, true));
         let pipeline_id_loaded = self.pending_frames.iter().rev()
             .find(|x| x.old_pipeline_id == current_pipeline_id)
             .map(|x| (x.new_pipeline_id, x.document_ready))
             .or(current_pipeline_id_loaded);
         if let Err(e) = resp_chan.send(pipeline_id_loaded) {
             warn!("Failed get_pipeline response ({}).", e);
@@ -1652,17 +1669,17 @@ impl<Message, LTF, STF> Constellation<Me
                 self.close_pipeline(pipeline_id, ExitPipelineMode::Normal);
             }
         }
     }
 
     fn handle_set_visible_msg(&mut self, pipeline_id: PipelineId, visible: bool) {
         let frame_id = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.frame);
         let child_pipeline_ids: Vec<PipelineId> = self.current_frame_tree_iter(frame_id)
-                                                      .map(|frame| frame.current.0)
+                                                      .map(|frame| frame.current.pipeline_id)
                                                       .collect();
         for id in child_pipeline_ids {
             if let Some(pipeline) = self.pipelines.get_mut(&id) {
                 pipeline.change_visibility(visible);
             }
         }
     }
 
@@ -1750,17 +1767,17 @@ impl<Message, LTF, STF> Constellation<Me
                     if let Err(e) = script_channel.send(control_msg) {
                         return self.handle_send_error(pipeline_id, e);
                     }
                 }
             },
             WebDriverCommandMsg::TakeScreenshot(pipeline_id, reply) => {
                 let current_pipeline_id = self.root_frame_id
                     .and_then(|root_frame_id| self.frames.get(&root_frame_id))
-                    .map(|root_frame| root_frame.current.0);
+                    .map(|root_frame| root_frame.current.pipeline_id);
                 if Some(pipeline_id) == current_pipeline_id {
                     self.compositor_proxy.send(ToCompositorMsg::CreatePng(reply));
                 } else {
                     if let Err(e) = reply.send(None) {
                         warn!("Screenshot reply failed ({})", e);
                     }
                 }
             },
@@ -1770,40 +1787,40 @@ impl<Message, LTF, STF> Constellation<Me
     fn traverse_frame_to_pipeline(&mut self, frame_id: FrameId, next_pipeline_id: PipelineId) {
         // Check if the currently focused pipeline is the pipeline being replaced
         // (or a child of it). This has to be done here, before the current
         // frame tree is modified below.
         let update_focus_pipeline = self.focused_pipeline_in_tree(frame_id);
 
         let prev_pipeline_id = match self.frames.get_mut(&frame_id) {
             Some(frame) => {
-                let prev = frame.current.0;
+                let prev = frame.current.pipeline_id;
                 // Check that this frame contains the pipeline passed in, so that this does not
                 // change Frame's state before realizing `next_pipeline_id` is invalid.
                 let mut contains_pipeline = false;
 
-                if frame.next.iter().find(|&&(pipeline_id, _)| next_pipeline_id == pipeline_id).is_some() {
+                if frame.next.iter().find(|entry| next_pipeline_id == entry.pipeline_id).is_some() {
                     contains_pipeline = true;
-                    frame.prev.push(frame.current);
+                    frame.prev.push(frame.current.clone());
                     while let Some(entry) = frame.next.pop() {
-                        if entry.0 == next_pipeline_id {
+                        if entry.pipeline_id == next_pipeline_id {
                             frame.current = entry;
                             break;
                         } else {
                             frame.prev.push(entry);
                         }
                     }
                 }
 
                 if !contains_pipeline &&
-                   frame.prev.iter().find(|&&(pipeline_id, _)| next_pipeline_id == pipeline_id).is_some() {
+                   frame.prev.iter().find(|entry| next_pipeline_id == entry.pipeline_id).is_some() {
                     contains_pipeline = true;
-                    frame.next.push(frame.current);
+                    frame.next.push(frame.current.clone());
                     while let Some(entry) = frame.prev.pop() {
-                        if entry.0 == next_pipeline_id {
+                        if entry.pipeline_id == next_pipeline_id {
                             frame.current = entry;
                             break;
                         } else {
                             frame.next.push(entry);
                         }
                     }
                 }
 
@@ -2006,28 +2023,28 @@ impl<Message, LTF, STF> Constellation<Me
 
         if let Some(root_frame_id) = self.root_frame_id {
             // Send Resize (or ResizeInactive) messages to each
             // pipeline in the frame tree.
             let frame = match self.frames.get(&root_frame_id) {
                 None => return warn!("Frame {:?} resized after closing.", root_frame_id),
                 Some(frame) => frame,
             };
-            let pipeline_id = frame.current.0;
+            let pipeline_id = frame.current.pipeline_id;
             let pipeline = match self.pipelines.get(&pipeline_id) {
                 None => return warn!("Pipeline {:?} resized after closing.", pipeline_id),
                 Some(pipeline) => pipeline,
             };
             let _ = pipeline.script_chan.send(ConstellationControlMsg::Resize(
                 pipeline.id,
                 new_size,
                 size_type
             ));
-            for &(pipeline_id, _) in frame.prev.iter().chain(&frame.next) {
-                let pipeline = match self.pipelines.get(&pipeline_id) {
+            for entry in frame.prev.iter().chain(&frame.next) {
+                let pipeline = match self.pipelines.get(&entry.pipeline_id) {
                     None => {
                         warn!("Inactive pipeline {:?} resized after closing.", pipeline_id);
                         continue;
                     },
                     Some(pipeline) => pipeline,
                 };
                 let _ = pipeline.script_chan.send(ConstellationControlMsg::ResizeInactive(
                     pipeline.id,
@@ -2092,17 +2109,17 @@ impl<Message, LTF, STF> Constellation<Me
         let (epoch_sender, epoch_receiver) = ipc::channel().expect("Failed to create IPC channel!");
 
         // Step through the current frame tree, checking that the script
         // thread is idle, and that the current epoch of the layout thread
         // matches what the compositor has painted. If all these conditions
         // are met, then the output image should not change and a reftest
         // screenshot can safely be written.
         for frame in self.current_frame_tree_iter(self.root_frame_id) {
-            let pipeline_id = frame.current.0;
+            let pipeline_id = frame.current.pipeline_id;
 
             let pipeline = match self.pipelines.get(&pipeline_id) {
                 None => {
                     warn!("Pipeline {:?} screenshot while closing.", pipeline_id);
                     continue;
                 },
                 Some(pipeline) => pipeline,
             };
@@ -2119,17 +2136,17 @@ impl<Message, LTF, STF> Constellation<Me
             if let Err(e) = pipeline.layout_chan.send(msg) {
                 warn!("Get web font failed ({})", e);
             }
             if state_receiver.recv().unwrap_or(true) {
                 return ReadyToSave::WebFontNotLoaded;
             }
 
             // See if this pipeline has reached idle script state yet.
-            match self.document_states.get(&frame.current.0) {
+            match self.document_states.get(&frame.current.pipeline_id) {
                 Some(&DocumentState::Idle) => {}
                 Some(&DocumentState::Pending) | None => {
                     return ReadyToSave::DocumentLoading;
                 }
             }
 
             // Check the visible rectangle for this pipeline. If the constellation has received a
             // size for the pipeline, then its painting should be up to date. If the constellation
@@ -2139,17 +2156,17 @@ impl<Message, LTF, STF> Constellation<Me
                 // If the rectangle for this pipeline is zero sized, it will
                 // never be painted. In this case, don't query the layout
                 // thread as it won't contribute to the final output image.
                 if size == TypedSize2D::zero() {
                     continue;
                 }
 
                 // Get the epoch that the compositor has drawn for this pipeline.
-                let compositor_epoch = pipeline_states.get(&frame.current.0);
+                let compositor_epoch = pipeline_states.get(&frame.current.pipeline_id);
                 match compositor_epoch {
                     Some(compositor_epoch) => {
                         // Synchronously query the layout thread to see if the current
                         // epoch matches what the compositor has drawn. If they match
                         // (and script is idle) then this pipeline won't change again
                         // and can be considered stable.
                         let message = LayoutControlMsg::GetCurrentEpoch(epoch_sender.clone());
                         if let Err(e) = pipeline.layout_chan.send(message) {
@@ -2182,56 +2199,56 @@ impl<Message, LTF, STF> Constellation<Me
             let frame = match self.frames.get_mut(&frame_id) {
                 Some(frame) => frame,
                 None => {
                     warn!("Removed forward history after frame {:?} closure.", frame_id);
                     continue;
                 }
             };
             evicted_pipelines.extend_from_slice(&frame.remove_forward_entries());
-            for &(pipeline_id, _) in frame.next.iter().chain(frame.prev.iter()).chain(once(&frame.current)) {
-                let pipeline = match self.pipelines.get(&pipeline_id) {
+            for entry in frame.next.iter().chain(frame.prev.iter()).chain(once(&frame.current)) {
+                let pipeline = match self.pipelines.get(&entry.pipeline_id) {
                     Some(pipeline) => pipeline,
                     None => {
-                        warn!("Removed forward history after pipeline {:?} closure.", pipeline_id);
+                        warn!("Removed forward history after pipeline {:?} closure.", entry.pipeline_id);
                         continue;
                     }
                 };
                 frames_to_clear.extend_from_slice(&pipeline.children);
             }
         }
-        for (pipeline_id, _) in evicted_pipelines {
-            self.close_pipeline(pipeline_id, ExitPipelineMode::Normal);
+        for entry in evicted_pipelines {
+            self.close_pipeline(entry.pipeline_id, ExitPipelineMode::Normal);
         }
     }
 
     // Close a frame (and all children)
     fn close_frame(&mut self, frame_id: FrameId, exit_mode: ExitPipelineMode) {
         // Store information about the pipelines to be closed. Then close the
         // pipelines, before removing ourself from the frames hash map. This
         // ordering is vital - so that if close_pipeline() ends up closing
         // any child frames, they can be removed from the parent frame correctly.
         let parent_info = self.frames.get(&frame_id)
-            .and_then(|frame| self.pipelines.get(&frame.current.0))
+            .and_then(|frame| self.pipelines.get(&frame.current.pipeline_id))
             .and_then(|pipeline| pipeline.parent_info);
 
         let pipelines_to_close = {
             let mut pipelines_to_close = vec!();
 
             if let Some(frame) = self.frames.get(&frame_id) {
                 pipelines_to_close.extend_from_slice(&frame.next);
-                pipelines_to_close.push(frame.current);
+                pipelines_to_close.push(frame.current.clone());
                 pipelines_to_close.extend_from_slice(&frame.prev);
             }
 
             pipelines_to_close
         };
 
-        for (pipeline_id, _) in pipelines_to_close {
-            self.close_pipeline(pipeline_id, exit_mode);
+        for entry in pipelines_to_close {
+            self.close_pipeline(entry.pipeline_id, exit_mode);
         }
 
         if self.frames.remove(&frame_id).is_none() {
             warn!("Closing frame {:?} twice.", frame_id);
         }
 
         if let Some((parent_pipeline_id, _, _)) = parent_info {
             let parent_pipeline = match self.pipelines.get_mut(&parent_pipeline_id) {
@@ -2315,17 +2332,17 @@ impl<Message, LTF, STF> Constellation<Me
                 }
             }
         }
     }
 
     // Convert a frame to a sendable form to pass to the compositor
     fn frame_to_sendable(&self, frame_id: FrameId) -> Option<SendableFrameTree> {
         self.frames.get(&frame_id).and_then(|frame: &Frame| {
-            self.pipelines.get(&frame.current.0).map(|pipeline: &Pipeline| {
+            self.pipelines.get(&frame.current.pipeline_id).map(|pipeline: &Pipeline| {
                 let mut frame_tree = SendableFrameTree {
                     pipeline: pipeline.to_sendable(),
                     size: pipeline.size,
                     children: vec!(),
                 };
 
                 for child_frame_id in &pipeline.children {
                     if let Some(frame) = self.frame_to_sendable(*child_frame_id) {
@@ -2337,17 +2354,17 @@ impl<Message, LTF, STF> Constellation<Me
             })
         })
     }
 
     // Revoke paint permission from a pipeline, and all children.
     fn revoke_paint_permission(&self, pipeline_id: PipelineId) {
         let frame_id = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.frame);
         for frame in self.current_frame_tree_iter(frame_id) {
-            self.pipelines.get(&frame.current.0).map(|pipeline| pipeline.revoke_paint_permission());
+            self.pipelines.get(&frame.current.pipeline_id).map(|pipeline| pipeline.revoke_paint_permission());
         }
     }
 
     // Send the current frame tree to compositor, and grant paint
     // permission to each pipeline in the current frame tree.
     fn send_frame_tree_and_grant_paint_permission(&mut self) {
         // Note that this function can panic, due to ipc-channel creation failure.
         // avoiding this panic would require a mechanism for dealing
@@ -2360,17 +2377,17 @@ impl<Message, LTF, STF> Constellation<Me
                 if port.recv().is_err() {
                     warn!("Compositor has discarded SetFrameTree");
                     return; // Our message has been discarded, probably shutting down.
                 }
             }
         }
 
         for frame in self.current_frame_tree_iter(self.root_frame_id) {
-            self.pipelines.get(&frame.current.0).map(|pipeline| pipeline.grant_paint_permission());
+            self.pipelines.get(&frame.current.pipeline_id).map(|pipeline| pipeline.grant_paint_permission());
         }
     }
 
     /// For a given pipeline, determine the mozbrowser iframe that transitively contains
     /// it. There could be arbitrary levels of nested iframes in between them.
     fn get_mozbrowser_ancestor_info(&self, mut pipeline_id: PipelineId) -> Option<(PipelineId, SubpageId)> {
         loop {
             match self.pipelines.get(&pipeline_id) {
@@ -2442,17 +2459,17 @@ impl<Message, LTF, STF> Constellation<Me
                 if let Some(ancestor) = self.pipelines.get(&ancestor_id) {
                     return ancestor.trigger_mozbrowser_event(Some(subpage_id), event);
                 }
             }
         }
 
         if let Some(root_frame_id) = self.root_frame_id {
             if let Some(root_frame) = self.frames.get(&root_frame_id) {
-                if let Some(root_pipeline) = self.pipelines.get(&root_frame.current.0) {
+                if let Some(root_pipeline) = self.pipelines.get(&root_frame.current.pipeline_id) {
                     return root_pipeline.trigger_mozbrowser_event(None, event);
                 }
             }
         }
 
         warn!("Mozbrowser error after root pipeline closed.");
     }
 
@@ -2465,12 +2482,12 @@ impl<Message, LTF, STF> Constellation<Me
     fn pipeline_is_in_current_frame(&self, pipeline_id: PipelineId) -> bool {
         self.pipeline_exists_in_tree(pipeline_id, self.root_frame_id)
     }
 
     fn pipeline_exists_in_tree(&self,
                                pipeline_id: PipelineId,
                                root_frame_id: Option<FrameId>) -> bool {
         self.current_frame_tree_iter(root_frame_id)
-            .any(|current_frame| current_frame.current.0 == pipeline_id)
+            .any(|current_frame| current_frame.current.pipeline_id == pipeline_id)
     }
 
 }