summaryrefslogtreecommitdiff
path: root/chromium/third_party/trace-viewer/src/tracing/trace_model/event.js
blob: 5cb222ba8f1e197d6fc3c4d69f30cdb6aebfe0c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2013 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.

'use strict';

base.require('base.guid');

/**
 * @fileoverview Provides the Event class.
 */
base.exportTo('tracing.trace_model', function() {

  /**
   * The SelectionState enum defines how Events are displayed in the view.
   */
  var SelectionState = {
    NONE: 0,
    SELECTED: 1,
    HIGHLIGHTED: 2,
    DIMMED: 3
  };

  /**
   * A Event is the base type for any non-container, selectable piece
   * of data in the trace model.
   *
   * @constructor
   */
  function Event() {
    this.guid_ = base.GUID.allocate();
    this.selectionState = SelectionState.NONE;
  }

  Event.prototype = {
    get guid() {
      return this.guid_;
    },

    get selected() {
      return this.selectionState === SelectionState.SELECTED;
    }
  };

  return {
    Event: Event,
    SelectionState: SelectionState
  };
});