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