Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <!-- |
| 3 | Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 4 | Use of this source code is governed by a BSD-style license that can be |
| 5 | found in the LICENSE file. |
| 6 | --> |
| 7 | |
| 8 | <link rel="import" href="/core/trace_model/timed_event.html"> |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 9 | <link rel="import" href="/core/analysis/util.html"> |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 10 | |
| 11 | <script> |
| 12 | 'use strict'; |
| 13 | |
| 14 | /** |
| 15 | * @fileoverview Provides the Flow class. |
| 16 | */ |
| 17 | tv.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 Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 24 | function FlowEvent(category, id, title, colorId, start, args, opt_duration) { |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 25 | 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 Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 35 | this.startSlice = undefined; |
| 36 | this.endSlice = undefined; |
| 37 | |
| 38 | if (opt_duration !== undefined) |
| 39 | this.duration = opt_duration; |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | FlowEvent.prototype = { |
| 43 | __proto__: tv.c.trace_model.TimedEvent.prototype, |
| 44 | |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 45 | get userFriendlyName() { |
| 46 | return 'Flow event named ' + this.title + ' at ' + |
| 47 | tv.c.analysis.tsString(this.timestamp); |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 48 | } |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 49 | }; |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 50 | |
| 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 | |