aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-03-11 03:45:47 -0600
committerbors-servo <metajack+bors@gmail.com>2015-03-11 03:45:47 -0600
commit6ba3014d9b413d5d1d9911833e3ac08ecf97d65a (patch)
tree6b5853f6454fc7fe87b1968e330ce1d26e63750c
parente581648c75a55a5939a16f4089295154e38dbc23 (diff)
parente265b6b15b70ccf85f9e2f038be7ca8f913ea69f (diff)
downloadservo-6ba3014d9b413d5d1d9911833e3ac08ecf97d65a.tar.gz
servo-6ba3014d9b413d5d1d9911833e3ac08ecf97d65a.zip
auto merge of #5192 : glennw/servo/remove-frame-id, r=Ms2ger
This will be re-introduced in a follow up PR with a different usage, but I'm trying to create small, independent PRs that are easier to review than one large change.
-rw-r--r--components/compositing/compositor_task.rs2
-rw-r--r--components/compositing/constellation.rs34
-rw-r--r--components/script/page.rs8
-rw-r--r--components/script/script_task.rs3
4 files changed, 9 insertions, 38 deletions
diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs
index 172716be5bf..7edc6542202 100644
--- a/components/compositing/compositor_task.rs
+++ b/components/compositing/compositor_task.rs
@@ -5,7 +5,7 @@
//! Communication with the compositor task.
pub use windowing;
-pub use constellation::{FrameId, SendableFrameTree};
+pub use constellation::SendableFrameTree;
use compositor;
use headless;
diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs
index 3def1896346..abebea1d215 100644
--- a/components/compositing/constellation.rs
+++ b/components/compositing/constellation.rs
@@ -76,9 +76,6 @@ pub struct Constellation<LTF, STF> {
/// The next free ID to assign to a pipeline.
next_pipeline_id: PipelineId,
- /// The next free ID to assign to a frame.
- next_frame_id: FrameId,
-
/// Navigation operations that are in progress.
pending_frames: Vec<FrameChange>,
@@ -90,14 +87,8 @@ pub struct Constellation<LTF, STF> {
pub window_size: WindowSizeData,
}
-/// A unique ID used to identify a frame.
-#[derive(Copy)]
-pub struct FrameId(u32);
-
/// One frame in the hierarchy.
struct FrameTree {
- /// The ID of this frame.
- pub id: FrameId,
/// The pipeline for this frame.
pub pipeline: RefCell<Rc<Pipeline>>,
/// The parent frame's pipeline.
@@ -109,10 +100,9 @@ struct FrameTree {
}
impl FrameTree {
- fn new(id: FrameId, pipeline: Rc<Pipeline>, parent_pipeline: Option<Rc<Pipeline>>)
+ fn new(pipeline: Rc<Pipeline>, parent_pipeline: Option<Rc<Pipeline>>)
-> FrameTree {
FrameTree {
- id: id,
pipeline: RefCell::new(pipeline.clone()),
parent: RefCell::new(parent_pipeline),
children: RefCell::new(vec!()),
@@ -364,7 +354,6 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
pipelines: HashMap::new(),
navigation_context: NavigationContext::new(),
next_pipeline_id: PipelineId(0),
- next_frame_id: FrameId(0),
pending_frames: vec!(),
pending_sizes: HashMap::new(),
time_profiler_chan: time_profiler_chan,
@@ -419,14 +408,6 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
id
}
- /// Helper function for getting a unique frame ID.
- fn get_next_frame_id(&mut self) -> FrameId {
- let id = self.next_frame_id;
- let FrameId(ref mut i) = self.next_frame_id;
- *i += 1;
- id
- }
-
/// Convenience function for getting the currently active frame tree.
/// The currently active frame tree should always be the current painter
fn current_frame<'a>(&'a self) -> &'a Option<Rc<FrameTree>> {
@@ -567,12 +548,11 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("creating replacement pipeline for about:failure");
let new_id = self.get_next_pipeline_id();
- let new_frame_id = self.get_next_frame_id();
let pipeline = self.new_pipeline(new_id, parent, None,
LoadData::new(Url::parse("about:failure").unwrap()));
self.browse(Some(pipeline_id),
- Rc::new(FrameTree::new(new_frame_id, pipeline.clone(), None)),
+ Rc::new(FrameTree::new(pipeline.clone(), None)),
NavigationType::Load);
self.pipelines.insert(new_id, pipeline);
@@ -594,10 +574,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn handle_init_load(&mut self, url: Url) {
let next_pipeline_id = self.get_next_pipeline_id();
- let next_frame_id = self.get_next_frame_id();
let pipeline = self.new_pipeline(next_pipeline_id, None, None, LoadData::new(url));
self.browse(None,
- Rc::new(FrameTree::new(next_frame_id, pipeline.clone(), None)),
+ Rc::new(FrameTree::new(pipeline.clone(), None)),
NavigationType::Load);
self.pipelines.insert(pipeline.id, pipeline);
}
@@ -729,8 +708,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.update_child_pipeline(frame_tree.clone(), new_pipeline, old_subpage_id),
None => {
let child_tree = Rc::new(
- FrameTree::new(self.get_next_frame_id(),
- new_pipeline,
+ FrameTree::new(new_pipeline,
Some(frame_tree.pipeline.borrow().clone())));
frame_tree.add_child(ChildFrameTree::new(child_tree, new_rect));
}
@@ -826,11 +804,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let parent = source_frame.parent.clone();
let parent_id = source_frame.pipeline.borrow().parent;
let next_pipeline_id = self.get_next_pipeline_id();
- let next_frame_id = self.get_next_frame_id();
let pipeline = self.new_pipeline(next_pipeline_id, parent_id, None, load_data);
self.browse(Some(source_id),
- Rc::new(FrameTree::new(next_frame_id,
- pipeline.clone(),
+ Rc::new(FrameTree::new(pipeline.clone(),
parent.borrow().clone())),
NavigationType::Load);
// Send message to ScriptTask that will suspend all timers
diff --git a/components/script/page.rs b/components/script/page.rs
index ffaa25c9e14..cea2ddefc27 100644
--- a/components/script/page.rs
+++ b/components/script/page.rs
@@ -8,7 +8,7 @@ use dom::document::{Document, DocumentHelpers};
use dom::node::NodeHelpers;
use dom::window::Window;
-use msg::constellation_msg::{PipelineId, SubpageId};
+use msg::constellation_msg::PipelineId;
use util::smallvec::SmallVec;
use std::cell::Cell;
use std::rc::Rc;
@@ -20,9 +20,6 @@ pub struct Page {
/// Pipeline id associated with this page.
id: PipelineId,
- /// Subpage id associated with this page, if any.
- subpage_id: Option<SubpageId>,
-
/// The outermost frame containing the document and window.
frame: DOMRefCell<Option<Frame>>,
@@ -65,10 +62,9 @@ impl IterablePage for Rc<Page> {
}
impl Page {
- pub fn new(id: PipelineId, subpage_id: Option<SubpageId>, url: Url) -> Page {
+ pub fn new(id: PipelineId, url: Url) -> Page {
Page {
id: id,
- subpage_id: subpage_id,
frame: DOMRefCell::new(None),
url: url,
needs_reflow: Cell::new(true),
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index deffe3e8f66..e5d24cfffbe 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -909,8 +909,7 @@ impl ScriptTask {
let cx = cx.as_ref().unwrap();
// Create a new frame tree entry.
- let page = Rc::new(Page::new(incomplete.pipeline_id, incomplete.subpage_id.map(|p| p.1),
- final_url.clone()));
+ let page = Rc::new(Page::new(incomplete.pipeline_id, final_url.clone()));
if !root_page_exists {
// We have a new root frame tree.
*self.page.borrow_mut() = Some(page.clone());