added time to interactive metrics, refactored metrics to use traits

changed task macro to take pipeline info
This commit is contained in:
ddh 2017-10-02 14:52:39 +01:00
parent 347176df25
commit 2ffbe53989
26 changed files with 730 additions and 138 deletions

View file

@ -9,7 +9,7 @@ use dom::bindings::str::DOMString;
use dom::globalscope::GlobalScope;
use dom::performanceentry::PerformanceEntry;
use dom_struct::dom_struct;
use script_traits::PaintMetricType;
use script_traits::PWMType;
#[dom_struct]
pub struct PerformancePaintTiming {
@ -17,11 +17,11 @@ pub struct PerformancePaintTiming {
}
impl PerformancePaintTiming {
fn new_inherited(metric_type: PaintMetricType, start_time: f64)
-> PerformancePaintTiming {
fn new_inherited(metric_type: PWMType, start_time: f64) -> PerformancePaintTiming {
let name = match metric_type {
PaintMetricType::FirstPaint => DOMString::from("first-paint"),
PaintMetricType::FirstContentfulPaint => DOMString::from("first-contentful-paint"),
PWMType::FirstPaint => DOMString::from("first-paint"),
PWMType::FirstContentfulPaint => DOMString::from("first-contentful-paint"),
_ => DOMString::from(""),
};
PerformancePaintTiming {
entry: PerformanceEntry::new_inherited(name,
@ -33,7 +33,7 @@ impl PerformancePaintTiming {
#[allow(unrooted_must_root)]
pub fn new(global: &GlobalScope,
metric_type: PaintMetricType,
metric_type: PWMType,
start_time: f64) -> DomRoot<PerformancePaintTiming> {
let entry = PerformancePaintTiming::new_inherited(metric_type, start_time);
reflect_dom_object(Box::new(entry), global, PerformancePaintTimingBinding::Wrap)