blob: 70d670bf47bb00e6c0f1a4f553bd3f53b24703b3 [file] [log] [blame]
Chris Craik93216d02015-03-05 13:58:42 -08001<!DOCTYPE html>
2<!--
3Copyright (c) 2013 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
8<link rel="import" href="/core/trace_model/timed_event.html">
Chris Craikf516a622015-04-01 17:52:39 -07009<link rel="import" href="/core/analysis/util.html">
Chris Craik93216d02015-03-05 13:58:42 -080010
11<script>
12'use strict';
13
14/**
15 * @fileoverview Provides the Flow class.
16 */
17tv.exportTo('tv.c.trace_model', function() {
18 /**
19 * A Flow represents an interval of time plus parameters associated
20 * with that interval.
21 *
22 * @constructor
23 */
Chris Craikf516a622015-04-01 17:52:39 -070024 function FlowEvent(category, id, title, colorId, start, args, opt_duration) {
Chris Craik93216d02015-03-05 13:58:42 -080025 tv.c.trace_model.TimedEvent.call(this, start);
26
27 this.category = category || '';
28 this.title = title;
29 this.colorId = colorId;
30 this.start = start;
31 this.args = args;
32
33 this.id = id;
34
Chris Craikf516a622015-04-01 17:52:39 -070035 this.startSlice = undefined;
36 this.endSlice = undefined;
37
38 if (opt_duration !== undefined)
39 this.duration = opt_duration;
Chris Craik93216d02015-03-05 13:58:42 -080040 }
41
42 FlowEvent.prototype = {
43 __proto__: tv.c.trace_model.TimedEvent.prototype,
44
Chris Craikf516a622015-04-01 17:52:39 -070045 get userFriendlyName() {
46 return 'Flow event named ' + this.title + ' at ' +
47 tv.c.analysis.tsString(this.timestamp);
Chris Craik93216d02015-03-05 13:58:42 -080048 }
Chris Craik44c28202015-05-12 17:25:16 -070049 };
Chris Craik93216d02015-03-05 13:58:42 -080050
51 tv.c.trace_model.EventRegistry.register(
52 FlowEvent,
53 {
54 name: 'flowEvent',
55 pluralName: 'flowEvents',
56 singleViewElementName: 'tv-c-single-flow-event-sub-view',
57 multiViewElementName: 'tv-c-multi-flow-event-sub-view'
58 });
59
60 return {
61 FlowEvent: FlowEvent
62 };
63});
64</script>
65