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
7base.require('tracing.trace_model.trace_model_event');
8
9/**
10 * @fileoverview Provides the Slice class.
11 */
12base.exportTo('tracing.trace_model', function() {
13  /**
14   * A Slice represents an interval of time plus parameters associated
15   * with that interval.
16   *
17   * @constructor
18   */
19  function Slice(category, title, colorId, start, args, opt_duration) {
20    tracing.trace_model.TraceModelEvent.
21        call(this, category, title, colorId, start, args);
22
23    if (opt_duration !== undefined)
24      this.duration = opt_duration;
25  }
26
27  Slice.prototype = {
28    __proto__: tracing.trace_model.TraceModelEvent.prototype,
29
30    get end() {
31      return this.start + this.duration;
32    }
33  };
34
35  return {
36    Slice: Slice
37  };
38});
39