util: Make some minor formatting cleanups to profiling and gfx

This commit is contained in:
Patrick Walton 2014-10-21 16:04:44 -07:00
parent f5e8df9dac
commit d2d012165f
4 changed files with 30 additions and 59 deletions

View file

@ -215,7 +215,8 @@ impl FontContext {
/// reference if already used by this font context.
pub fn get_render_font_from_template(&mut self,
template: &Arc<FontTemplateData>,
pt_size: Au) -> Rc<RefCell<ScaledFont>> {
pt_size: Au)
-> Rc<RefCell<ScaledFont>> {
for cached_font in self.render_font_cache.iter() {
if cached_font.pt_size == pt_size &&
cached_font.identifier == template.identifier {

View file

@ -61,7 +61,7 @@ impl LayerId {
}
/// The scrolling policy of a layer.
#[deriving(PartialEq)]
#[deriving(Clone, PartialEq)]
pub enum ScrollPolicy {
/// These layers scroll when the parent receives a scrolling message.
Scrollable,

View file

@ -27,9 +27,9 @@ impl TimeProfilerChan {
#[deriving(PartialEq, Clone, PartialOrd, Eq, Ord)]
pub struct TimerMetadata {
url: String,
iframe: bool,
first_reflow: bool,
url: String,
iframe: bool,
incremental: bool,
}
pub trait Formatable {
@ -42,9 +42,14 @@ impl Formatable for Option<TimerMetadata> {
// TODO(cgaebel): Center-align in the format strings as soon as rustc supports it.
&Some(ref meta) => {
let url = meta.url.as_slice();
let first_reflow = if meta.first_reflow { " yes" } else { " no " };
let url = if url.len() > 30 {
url.slice_to(30)
} else {
url
};
let incremental = if meta.incremental { " yes" } else { " no " };
let iframe = if meta.iframe { " yes" } else { " no " };
format!(" {:14} {:9} {:30}", first_reflow, iframe, url)
format!(" {:14} {:9} {:30}", incremental, iframe, url)
},
&None =>
format!(" {:14} {:9} {:30}", " N/A", " N/A", " N/A")
@ -254,7 +259,7 @@ pub fn profile<T>(category: TimeProfilerCategory,
TimerMetadata {
url: url.serialize(),
iframe: iframe,
first_reflow: first_reflow,
incremental: !first_reflow,
});
time_profiler_chan.send(TimeMsg((category, meta), ms));
return val;