1<!DOCTYPE html>
2<!--
3Copyright (c) 2013 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7
8<link rel="import" href="/tracing/model/slice.html">
9
10<script>
11'use strict';
12
13/**
14 * @fileoverview Provides the Thread class.
15 */
16tr.exportTo('tr.model', function() {
17  var Slice = tr.model.Slice;
18
19  /**
20   * A ThreadSlice represents an interval of time on a thread resource
21   * with associated nesting slice information.
22   *
23   * ThreadSlices are typically associated with a specific trace event pair on a
24   * specific thread.
25   * For example,
26   *   TRACE_EVENT_BEGIN1("x","myArg", 7) at time=0.1ms
27   *   TRACE_EVENT_END0()                 at time=0.3ms
28   * This results in a single slice from 0.1 with duration 0.2 on a
29   * specific thread.
30   *
31   * @constructor
32   */
33  function ThreadSlice(cat, title, colorId, start, args, opt_duration,
34                       opt_cpuStart, opt_cpuDuration, opt_argsStripped,
35                       opt_bind_id) {
36    Slice.call(this, cat, title, colorId, start, args, opt_duration,
37               opt_cpuStart, opt_cpuDuration, opt_argsStripped, opt_bind_id);
38    // Do not modify this directly.
39    // subSlices is configured by SliceGroup.rebuildSubRows_.
40    this.subSlices = [];
41  }
42
43  ThreadSlice.prototype = {
44    __proto__: Slice.prototype
45  };
46
47  tr.model.EventRegistry.register(
48      ThreadSlice,
49      {
50        name: 'slice',
51        pluralName: 'slices',
52        singleViewElementName: 'tr-ui-a-single-thread-slice-sub-view',
53        multiViewElementName: 'tr-ui-a-multi-thread-slice-sub-view'
54      });
55
56  return {
57    ThreadSlice: ThreadSlice
58  };
59});
60</script>
61