Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / tracing / trace_model / slice.js
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 tvcm.require('tracing.trace_model.timed_event');
8
9 /**
10  * @fileoverview Provides the Slice class.
11  */
12 tvcm.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                  opt_cpuStart, opt_cpuDuration) {
21     tracing.trace_model.TimedEvent.call(this, start);
22
23     this.category = category || '';
24     this.title = title;
25     this.colorId = colorId;
26     this.args = args;
27     this.didNotFinish = false;
28
29     if (opt_duration !== undefined)
30       this.duration = opt_duration;
31
32     if (opt_cpuStart !== undefined)
33       this.cpuStart = opt_cpuStart;
34
35     if (opt_cpuDuration !== undefined)
36       this.cpuDuration = opt_cpuDuration;
37   }
38
39   Slice.prototype = {
40     __proto__: tracing.trace_model.TimedEvent.prototype,
41
42     get analysisTypeName() {
43       return this.title;
44     }
45   };
46
47   return {
48     Slice: Slice
49   };
50 });