blob: 6bb390930151824920e94ca72a60ff144a3eb070 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
<link rel="import" href="/tracing/ui/analysis/object_instance_view.html">
<link rel="import" href="/tracing/ui/tracks/multi_row_track.html">
<link rel="import" href="/tracing/ui/tracks/object_instance_track.html">
<link rel="import" href="/tracing/base/sorted_array_utils.html">
<link rel="import" href="/tracing/ui/base/ui.html">
<script>
'use strict';
tr.exportTo('tr.ui.tracks', function() {
/**
* A track that displays a ObjectInstanceGroup.
* @constructor
* @extends {ContainerTrack}
*/
var ObjectInstanceGroupTrack = tr.ui.b.define(
'object-instance-group-track', tr.ui.tracks.MultiRowTrack);
ObjectInstanceGroupTrack.prototype = {
__proto__: tr.ui.tracks.MultiRowTrack.prototype,
decorate: function(viewport) {
tr.ui.tracks.MultiRowTrack.prototype.decorate.call(this, viewport);
this.classList.add('object-instance-group-track');
this.objectInstances_ = undefined;
},
get objectInstances() {
return this.itemsToGroup;
},
set objectInstances(objectInstances) {
this.setItemsToGroup(objectInstances);
},
addSubTrack_: function(objectInstances) {
var hasMultipleRows = this.subRows.length > 1;
var track = new tr.ui.tracks.ObjectInstanceTrack(this.viewport);
track.objectInstances = objectInstances;
this.appendChild(track);
return track;
},
buildSubRows_: function(objectInstances) {
objectInstances.sort(function(x, y) {
return x.creationTs - y.creationTs;
});
var subRows = [];
for (var i = 0; i < objectInstances.length; i++) {
var objectInstance = objectInstances[i];
var found = false;
for (var j = 0; j < subRows.length; j++) {
var subRow = subRows[j];
var lastItemInSubRow = subRow[subRow.length - 1];
if (objectInstance.creationTs >= lastItemInSubRow.deletionTs) {
found = true;
subRow.push(objectInstance);
break;
}
}
if (!found) {
var subRow = [objectInstance];
subRows.push(subRow);
}
}
return subRows;
},
updateHeadingAndTooltip_: function() {
}
};
return {
ObjectInstanceGroupTrack: ObjectInstanceGroupTrack
};
});
</script>
|