blob: b39e751013223095e13663e51fec5adc2ab44591 [file] [log] [blame]
Chris Craik44c28202015-05-12 17:25:16 -07001<!DOCTYPE html>
2<!--
3Copyright (c) 2015 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7<link rel="import" href="/base/base.html">
8<link rel="import" href="/base/statistics.html">
9<link rel="import" href="/core/auditor.html">
10<link rel="import" href="/core/trace_model/trace_model.html">
11<link rel="import" href="/extras/audits/utils.html">
12<link rel="import" href="/extras/audits/chrome_model_helper.html">
13
14<script>
15'use strict';
16
17/**
18 * @fileoverview Base class for trace data Auditors.
19 */
20tv.exportTo('tv.e.audits', function() {
21 function RAILInteractionRecord(title, colorId, start, duration) {
22 tv.c.trace_model.InteractionRecord.call(this,
23 title, colorId, start, duration);
24 }
25 RAILInteractionRecord.prototype = {
26 __proto__: tv.c.trace_model.InteractionRecord.prototype,
27
28 updateArgs: function() {
29 var args = {};
30
31 var layoutSlices = this.associatedEvents.filter(function(event) {
32 return event.title === 'FrameView::layout';
33 });
34 var timeInLayout = tv.b.Statistics.sum(layoutSlices, function(event) {
35 return event.duration;
36 });
37
38 args['layoutInfo'] = {
39 'timeInLayout': timeInLayout
40 };
41
42 this.args = args;
43 },
44
45 get railTypeName() {
46 // At some point, we will subclass RAILInteractionRecord, at which point
47 // this will be overridden by the subclasses.
48 return this.title;
49 },
50
51 get railScore() {
52 return this.duration;
53 }
54 };
55
56 return {
57 RAILInteractionRecord: RAILInteractionRecord
58 };
59});
60</script>