| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| <link rel="import" href="/base/base.html"> |
| <link rel="import" href="/base/statistics.html"> |
| <link rel="import" href="/core/auditor.html"> |
| <link rel="import" href="/core/trace_model/trace_model.html"> |
| <link rel="import" href="/extras/audits/utils.html"> |
| <link rel="import" href="/extras/audits/chrome_model_helper.html"> |
| |
| <script> |
| 'use strict'; |
| |
| /** |
| * @fileoverview Base class for trace data Auditors. |
| */ |
| tv.exportTo('tv.e.audits', function() { |
| function RAILInteractionRecord(title, colorId, start, duration) { |
| tv.c.trace_model.InteractionRecord.call(this, |
| title, colorId, start, duration); |
| } |
| RAILInteractionRecord.prototype = { |
| __proto__: tv.c.trace_model.InteractionRecord.prototype, |
| |
| updateArgs: function() { |
| var args = {}; |
| |
| var layoutSlices = this.associatedEvents.filter(function(event) { |
| return event.title === 'FrameView::layout'; |
| }); |
| var timeInLayout = tv.b.Statistics.sum(layoutSlices, function(event) { |
| return event.duration; |
| }); |
| |
| args['layoutInfo'] = { |
| 'timeInLayout': timeInLayout |
| }; |
| |
| this.args = args; |
| }, |
| |
| get railTypeName() { |
| // At some point, we will subclass RAILInteractionRecord, at which point |
| // this will be overridden by the subclasses. |
| return this.title; |
| }, |
| |
| get railScore() { |
| return this.duration; |
| } |
| }; |
| |
| return { |
| RAILInteractionRecord: RAILInteractionRecord |
| }; |
| }); |
| </script> |