mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Remove now unused id field for frame tree.
This commit is contained in:
parent
e581648c75
commit
ec91fa2cfd
2 changed files with 6 additions and 30 deletions
|
@ -5,7 +5,7 @@
|
||||||
//! Communication with the compositor task.
|
//! Communication with the compositor task.
|
||||||
|
|
||||||
pub use windowing;
|
pub use windowing;
|
||||||
pub use constellation::{FrameId, SendableFrameTree};
|
pub use constellation::SendableFrameTree;
|
||||||
|
|
||||||
use compositor;
|
use compositor;
|
||||||
use headless;
|
use headless;
|
||||||
|
|
|
@ -76,9 +76,6 @@ pub struct Constellation<LTF, STF> {
|
||||||
/// The next free ID to assign to a pipeline.
|
/// The next free ID to assign to a pipeline.
|
||||||
next_pipeline_id: PipelineId,
|
next_pipeline_id: PipelineId,
|
||||||
|
|
||||||
/// The next free ID to assign to a frame.
|
|
||||||
next_frame_id: FrameId,
|
|
||||||
|
|
||||||
/// Navigation operations that are in progress.
|
/// Navigation operations that are in progress.
|
||||||
pending_frames: Vec<FrameChange>,
|
pending_frames: Vec<FrameChange>,
|
||||||
|
|
||||||
|
@ -90,14 +87,8 @@ pub struct Constellation<LTF, STF> {
|
||||||
pub window_size: WindowSizeData,
|
pub window_size: WindowSizeData,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A unique ID used to identify a frame.
|
|
||||||
#[derive(Copy)]
|
|
||||||
pub struct FrameId(u32);
|
|
||||||
|
|
||||||
/// One frame in the hierarchy.
|
/// One frame in the hierarchy.
|
||||||
struct FrameTree {
|
struct FrameTree {
|
||||||
/// The ID of this frame.
|
|
||||||
pub id: FrameId,
|
|
||||||
/// The pipeline for this frame.
|
/// The pipeline for this frame.
|
||||||
pub pipeline: RefCell<Rc<Pipeline>>,
|
pub pipeline: RefCell<Rc<Pipeline>>,
|
||||||
/// The parent frame's pipeline.
|
/// The parent frame's pipeline.
|
||||||
|
@ -109,10 +100,9 @@ struct FrameTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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 {
|
||||||
FrameTree {
|
FrameTree {
|
||||||
id: id,
|
|
||||||
pipeline: RefCell::new(pipeline.clone()),
|
pipeline: RefCell::new(pipeline.clone()),
|
||||||
parent: RefCell::new(parent_pipeline),
|
parent: RefCell::new(parent_pipeline),
|
||||||
children: RefCell::new(vec!()),
|
children: RefCell::new(vec!()),
|
||||||
|
@ -364,7 +354,6 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
pipelines: HashMap::new(),
|
pipelines: HashMap::new(),
|
||||||
navigation_context: NavigationContext::new(),
|
navigation_context: NavigationContext::new(),
|
||||||
next_pipeline_id: PipelineId(0),
|
next_pipeline_id: PipelineId(0),
|
||||||
next_frame_id: FrameId(0),
|
|
||||||
pending_frames: vec!(),
|
pending_frames: vec!(),
|
||||||
pending_sizes: HashMap::new(),
|
pending_sizes: HashMap::new(),
|
||||||
time_profiler_chan: time_profiler_chan,
|
time_profiler_chan: time_profiler_chan,
|
||||||
|
@ -419,14 +408,6 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
id
|
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.
|
/// Convenience function for getting the currently active frame tree.
|
||||||
/// The currently active frame tree should always be the current painter
|
/// The currently active frame tree should always be the current painter
|
||||||
fn current_frame<'a>(&'a self) -> &'a Option<Rc<FrameTree>> {
|
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");
|
debug!("creating replacement pipeline for about:failure");
|
||||||
|
|
||||||
let new_id = self.get_next_pipeline_id();
|
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,
|
let pipeline = self.new_pipeline(new_id, parent, None,
|
||||||
LoadData::new(Url::parse("about:failure").unwrap()));
|
LoadData::new(Url::parse("about:failure").unwrap()));
|
||||||
|
|
||||||
self.browse(Some(pipeline_id),
|
self.browse(Some(pipeline_id),
|
||||||
Rc::new(FrameTree::new(new_frame_id, pipeline.clone(), None)),
|
Rc::new(FrameTree::new(pipeline.clone(), None)),
|
||||||
NavigationType::Load);
|
NavigationType::Load);
|
||||||
|
|
||||||
self.pipelines.insert(new_id, pipeline);
|
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) {
|
fn handle_init_load(&mut self, url: Url) {
|
||||||
let next_pipeline_id = self.get_next_pipeline_id();
|
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));
|
let pipeline = self.new_pipeline(next_pipeline_id, None, None, LoadData::new(url));
|
||||||
self.browse(None,
|
self.browse(None,
|
||||||
Rc::new(FrameTree::new(next_frame_id, pipeline.clone(), None)),
|
Rc::new(FrameTree::new(pipeline.clone(), None)),
|
||||||
NavigationType::Load);
|
NavigationType::Load);
|
||||||
self.pipelines.insert(pipeline.id, pipeline);
|
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),
|
self.update_child_pipeline(frame_tree.clone(), new_pipeline, old_subpage_id),
|
||||||
None => {
|
None => {
|
||||||
let child_tree = Rc::new(
|
let child_tree = Rc::new(
|
||||||
FrameTree::new(self.get_next_frame_id(),
|
FrameTree::new(new_pipeline,
|
||||||
new_pipeline,
|
|
||||||
Some(frame_tree.pipeline.borrow().clone())));
|
Some(frame_tree.pipeline.borrow().clone())));
|
||||||
frame_tree.add_child(ChildFrameTree::new(child_tree, new_rect));
|
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 = source_frame.parent.clone();
|
||||||
let parent_id = source_frame.pipeline.borrow().parent;
|
let parent_id = source_frame.pipeline.borrow().parent;
|
||||||
let next_pipeline_id = self.get_next_pipeline_id();
|
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);
|
let pipeline = self.new_pipeline(next_pipeline_id, parent_id, None, load_data);
|
||||||
self.browse(Some(source_id),
|
self.browse(Some(source_id),
|
||||||
Rc::new(FrameTree::new(next_frame_id,
|
Rc::new(FrameTree::new(pipeline.clone(),
|
||||||
pipeline.clone(),
|
|
||||||
parent.borrow().clone())),
|
parent.borrow().clone())),
|
||||||
NavigationType::Load);
|
NavigationType::Load);
|
||||||
// Send message to ScriptTask that will suspend all timers
|
// Send message to ScriptTask that will suspend all timers
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue