1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5'use strict';
6
7/**
8 * @fileoverview Provides the TimelineSlice class.
9 */
10base.exportTo('tracing', function() {
11
12  /**
13   * A TimelineSlice represents an interval of time plus parameters associated
14   * with that interval.
15   *
16   * All time units are stored in milliseconds.
17   * @constructor
18   */
19  function TimelineSlice(category, title, colorId, start, args, opt_duration) {
20    this.category = category || '';
21    this.title = title;
22    this.start = start;
23    this.colorId = colorId;
24    this.args = args;
25    this.didNotFinish = false;
26    if (opt_duration !== undefined)
27      this.duration = opt_duration;
28  }
29
30  TimelineSlice.prototype = {
31    selected: false,
32
33    duration: undefined,
34
35    get end() {
36      return this.start + this.duration;
37    }
38  };
39
40  return {
41    TimelineSlice: TimelineSlice
42  };
43});
44