Add paint metrics to Performance Timeline API

This commit is contained in:
Fernando Jiménez Moreno 2017-08-14 18:41:32 +02:00
parent 1c9c0334ba
commit 2d0037f195
15 changed files with 152 additions and 20 deletions

View file

@ -30,7 +30,8 @@ fn test_paint_metrics_construction() {
let (sender, _) = ipc::channel().unwrap();
let profiler_chan = ProfilerChan(sender);
let (layout_sender, _) = ipc::channel().unwrap();
let paint_time_metrics = PaintTimeMetrics::new(pipeline_id, profiler_chan, layout_sender);
let (script_sender, _) = ipc::channel().unwrap();
let paint_time_metrics = PaintTimeMetrics::new(pipeline_id, profiler_chan, layout_sender, script_sender);
assert_eq!(paint_time_metrics.get_navigation_start(), None, "navigation start is None");
assert_eq!(paint_time_metrics.get_first_paint(), None, "first paint is None");
assert_eq!(paint_time_metrics.get_first_contentful_paint(), None, "first contentful paint is None");
@ -44,7 +45,8 @@ fn test_common(display_list: &DisplayList, epoch: Epoch) -> PaintTimeMetrics {
let (sender, _) = ipc::channel().unwrap();
let profiler_chan = ProfilerChan(sender);
let (layout_sender, _) = ipc::channel().unwrap();
let mut paint_time_metrics = PaintTimeMetrics::new(pipeline_id, profiler_chan, layout_sender);
let (script_sender, _) = ipc::channel().unwrap();
let mut paint_time_metrics = PaintTimeMetrics::new(pipeline_id, profiler_chan, layout_sender, script_sender);
let dummy_profiler_metadata_factory = DummyProfilerMetadataFactory {};
paint_time_metrics.maybe_observe_paint_time(&dummy_profiler_metadata_factory,

View file

@ -14444,6 +14444,12 @@
{}
]
],
"mozilla/paint_timing.html": [
[
"/_mozilla/mozilla/paint_timing.html",
{}
]
],
"mozilla/parentNode_querySelector.html": [
[
"/_mozilla/mozilla/parentNode_querySelector.html",
@ -27286,7 +27292,7 @@
"testharness"
],
"mozilla/interfaces.html": [
"7ac46204fb780c96344f166d34d0fb888c9e25c4",
"48028c5a9b401bab52a155c8820140a65dbc2f11",
"testharness"
],
"mozilla/interfaces.js": [
@ -27294,7 +27300,7 @@
"support"
],
"mozilla/interfaces.worker.js": [
"1474c6500ce1c4aef99d200dae5407324ddbdd4a",
"5fb0da8a22a5afe00d1232c700720c080f5dff44",
"testharness"
],
"mozilla/iterable.html": [
@ -27525,6 +27531,10 @@
"1e0066636c757e68b13a4a5271d4184232c51e34",
"testharness"
],
"mozilla/paint_timing.html": [
"8cf0400c36168b57c386253d647b61013896d325",
"testharness"
],
"mozilla/parentNode_querySelector.html": [
"b9c5eee0b0c895109141a48676348a8a8ab5e3cc",
"testharness"

View file

@ -162,6 +162,7 @@ test_interfaces([
"PerformanceEntry",
"PerformanceObserver",
"PerformanceObserverEntryList",
"PerformancePaintTiming",
"PerformanceTiming",
"Plugin",
"PluginArray",

View file

@ -33,10 +33,11 @@ test_interfaces([
"ImageData",
"MessageEvent",
"Performance",
"PerformanceTiming",
"PerformanceEntry",
"PerformanceObserver",
"PerformanceObserverEntryList",
"PerformancePaintTiming",
"PerformanceTiming",
"ProgressEvent",
"Request",
"Response",

View file

@ -0,0 +1,18 @@
<!doctype html>
<meta charset="utf-8">
<title>Paint Timing API</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("Performance entries observer");
var observer = new PerformanceObserver(t.step_func_done(list => {
list.getEntries().forEach((entry, i) => {
var name = i == 0 ? "first-paint" : "first-contentful-paint";
assert_equals(entry.name, name, "Name is " + name);
assert_equals(entry.entryType, "paint", "Entry type is paint");
assert_true(entry.startTime > 0, "Start time is > 0");
assert_equals(entry.duration, 0, "Duration is 0");
});
}));
observer.observe({entryTypes: ['paint']});
</script>