summaryrefslogtreecommitdiff
path: root/chromium/third_party/trace-viewer/src/tracing/trace_model/slice.js
blob: 98295237b7e8bb84dabc6ce1573b8a927bde726b (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
50
// Copyright (c) 2012 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('tracing.trace_model.timed_event');

/**
 * @fileoverview Provides the Slice class.
 */
base.exportTo('tracing.trace_model', function() {
  /**
   * A Slice represents an interval of time plus parameters associated
   * with that interval.
   *
   * @constructor
   */
  function Slice(category, title, colorId, start, args, opt_duration,
                 opt_threadStart, opt_threadDuration) {
    tracing.trace_model.TimedEvent.call(this, start);

    this.category = category || '';
    this.title = title;
    this.colorId = colorId;
    this.args = args;
    this.didNotFinish = false;

    if (opt_duration !== undefined)
      this.duration = opt_duration;

    if (opt_threadStart !== undefined)
      this.threadStart = opt_threadStart;

    if (opt_threadDuration !== undefined)
      this.threadDuration = opt_threadDuration;
  }

  Slice.prototype = {
    __proto__: tracing.trace_model.TimedEvent.prototype,

    get analysisTypeName() {
      return this.title;
    }
  };

  return {
    Slice: Slice
  };
});