| <!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="/core/trace_model/timed_event.html"> |
| <link rel="import" href="/core/trace_model/event_info.html"> |
| <link rel="import" href="/core/analysis/util.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tv.exportTo('tv.c.trace_model', function() { |
| |
| function Alert(info, start, opt_associatedEvents, opt_args) { |
| tv.c.trace_model.TimedEvent.call(this, start); |
| this.info = info; |
| this.args = opt_args || {}; |
| this.associatedEvents = opt_associatedEvents || []; |
| this.associatedEvents.forEach(function(event) { |
| event.associatedAlerts.push(this); |
| }, this); |
| } |
| |
| Alert.prototype = { |
| __proto__: tv.c.trace_model.TimedEvent.prototype, |
| |
| get title() { |
| return this.info.title; |
| }, |
| |
| get colorId() { |
| return this.info.colorId; |
| }, |
| |
| get userFriendlyName() { |
| return 'Alert ' + this.title + ' at ' + |
| tv.c.analysis.tsString(this.start); |
| } |
| }; |
| |
| tv.c.trace_model.EventRegistry.register( |
| Alert, |
| { |
| name: 'alert', |
| pluralName: 'alerts', |
| singleViewElementName: 'tv-c-a-alert-sub-view', |
| multiViewElementName: 'tv-c-a-alert-sub-view' |
| }); |
| |
| return { |
| Alert: Alert |
| }; |
| }); |
| </script> |