1<!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="/tracing/model/timed_event.html">
9<link rel="import" href="/tracing/value/unit.html">
10
11<script>
12'use strict';
13
14/**
15 * @fileoverview Provides the Flow class.
16 */
17tr.exportTo('tr.model', function() {
18  /**
19   * A Flow represents an interval of time plus parameters associated
20   * with that interval.
21   *
22   * @constructor
23   */
24  function FlowEvent(category, id, title, colorId, start, args, opt_duration) {
25    tr.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
35    this.startSlice = undefined;
36    this.endSlice = undefined;
37
38    this.startStackFrame = undefined;
39    this.endStackFrame = undefined;
40
41    if (opt_duration !== undefined)
42      this.duration = opt_duration;
43  }
44
45  FlowEvent.prototype = {
46    __proto__: tr.model.TimedEvent.prototype,
47
48    get userFriendlyName() {
49      return 'Flow event named ' + this.title + ' at ' +
50          tr.v.Unit.byName.timeStampInMs.format(this.timestamp);
51    }
52  };
53
54  tr.model.EventRegistry.register(
55      FlowEvent,
56      {
57        name: 'flowEvent',
58        pluralName: 'flowEvents',
59        singleViewElementName: 'tr-ui-a-single-flow-event-sub-view',
60        multiViewElementName: 'tr-ui-a-multi-flow-event-sub-view'
61      });
62
63  return {
64    FlowEvent: FlowEvent
65  };
66});
67</script>
68
69