Skip to content

Commit

Permalink
Remove unused teardown methods
Browse files Browse the repository at this point in the history
According to @pcwalton these used to be important for memory safety but are no longer needed now.
  • Loading branch information
brendanzab committed May 6, 2014
1 parent 325a39b commit 0ed6f92
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 75 deletions.
9 changes: 0 additions & 9 deletions src/components/gfx/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ impl FontGroup {
}
}

pub fn teardown(&mut self) {
self.fonts = vec!();
}

pub fn create_textrun(&self, text: ~str, decoration: text_decoration::T) -> TextRun {
assert!(self.fonts.len() > 0);

Expand Down Expand Up @@ -297,11 +293,6 @@ impl<'a> Font {
return result;
}

pub fn teardown(&mut self) {
self.shaper = None;
self.azure_font = None;
}

// TODO: this should return a borrowed pointer, but I can't figure
// out why borrowck doesn't like my implementation.

Expand Down
3 changes: 0 additions & 3 deletions src/components/gfx/text/text_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ impl<'a> TextRun {
return run;
}

pub fn teardown(&self) {
}

pub fn break_and_shape(font: &mut Font, text: &str) -> Vec<Arc<GlyphStore>> {
// TODO(Issue #230): do a better job. See Gecko's LineBreaker.

Expand Down
5 changes: 0 additions & 5 deletions src/components/main/layout/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,11 +709,6 @@ impl BlockFlow {
}
}

pub fn teardown(&mut self) {
self.box_.teardown();
self.float = None;
}

/// Return shrink-to-fit width.
///
/// This is where we use the preferred widths and minimum widths
Expand Down
8 changes: 0 additions & 8 deletions src/components/main/layout/box_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,14 +1391,6 @@ impl Box {
}
}

/// Cleans up all the memory associated with this box.
pub fn teardown(&self) {
match self.specific {
ScannedTextBox(ref text_box_info) => text_box_info.run.teardown(),
_ => {}
}
}

/// Returns true if the contents should be clipped (i.e. if `overflow` is `hidden`).
pub fn needs_clip(&self) -> bool {
self.style().Box.get().overflow == overflow::hidden
Expand Down
7 changes: 0 additions & 7 deletions src/components/main/layout/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,6 @@ impl InlineFlow {
}
}

pub fn teardown(&mut self) {
for (fragment, _) in self.boxes.iter() {
fragment.teardown();
}
self.boxes = InlineBoxes::new();
}

pub fn build_display_list_inline(&mut self, layout_context: &LayoutContext) {
let abs_rect = Rect(self.base.abs_position, self.base.position.size);
if !abs_rect.intersects(&layout_context.dirty) {
Expand Down
7 changes: 0 additions & 7 deletions src/components/main/layout/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ impl TableFlow {
}
}

pub fn teardown(&mut self) {
self.block_flow.teardown();
self.col_widths = vec!();
self.col_min_widths = vec!();
self.col_pref_widths = vec!();
}

/// Update the corresponding value of self_widths if a value of kid_widths has larger value
/// than one of self_widths.
pub fn update_col_widths(self_widths: &mut Vec<Au>, kid_widths: &Vec<Au>) -> Au {
Expand Down
4 changes: 0 additions & 4 deletions src/components/main/layout/table_caption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ impl TableCaptionFlow {
}
}

pub fn teardown(&mut self) {
self.block_flow.teardown();
}

pub fn build_display_list_table_caption(&mut self, layout_context: &LayoutContext) {
debug!("build_display_list_table_caption: same process as block flow");
self.block_flow.build_display_list_block(layout_context)
Expand Down
4 changes: 0 additions & 4 deletions src/components/main/layout/table_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ impl TableCellFlow {
}
}

pub fn teardown(&mut self) {
self.block_flow.teardown()
}

pub fn box_<'a>(&'a mut self) -> &'a Box {
&self.block_flow.box_
}
Expand Down
9 changes: 0 additions & 9 deletions src/components/main/layout/table_colgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ impl TableColGroupFlow {
widths: vec!(),
}
}

pub fn teardown(&mut self) {
for box_ in self.box_.iter() {
box_.teardown();
}
self.box_ = None;
self.cols = vec!();
self.widths = vec!();
}
}

impl Flow for TableColGroupFlow {
Expand Down
7 changes: 0 additions & 7 deletions src/components/main/layout/table_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ impl TableRowFlow {
}
}

pub fn teardown(&mut self) {
self.block_flow.teardown();
self.col_widths = vec!();
self.col_min_widths = vec!();
self.col_pref_widths = vec!();
}

pub fn box_<'a>(&'a mut self) -> &'a Box {
&self.block_flow.box_
}
Expand Down
7 changes: 0 additions & 7 deletions src/components/main/layout/table_rowgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ impl TableRowGroupFlow {
}
}

pub fn teardown(&mut self) {
self.block_flow.teardown();
self.col_widths = vec!();
self.col_min_widths = vec!();
self.col_pref_widths = vec!();
}

pub fn box_<'a>(&'a mut self) -> &'a Box {
&self.block_flow.box_
}
Expand Down
5 changes: 0 additions & 5 deletions src/components/main/layout/table_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ impl TableWrapperFlow {
self.block_flow.float.is_some()
}

pub fn teardown(&mut self) {
self.block_flow.teardown();
self.col_widths = vec!();
}

/// Assign height for table-wrapper flow.
/// `Assign height` of table-wrapper flow follows a similar process to that of block flow.
///
Expand Down

5 comments on commit 0ed6f92

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at brendanzab@0ed6f92

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging bjz/servo/remove-teardown = 0ed6f92 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bjz/servo/remove-teardown = 0ed6f92 merged ok, testing candidate = dedaa6a

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = dedaa6a

Please sign in to comment.