OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2017 The Chromium Authors. All rights reserved. | 3 Copyright 2017 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/value/diagnostics/reserved_names.html"> | 8 <link rel="import" href="/tracing/value/diagnostics/reserved_names.html"> |
9 | 9 |
10 <script> | 10 <script> |
11 'use strict'; | 11 'use strict'; |
12 | 12 |
13 tr.exportTo('tr.v.d', function() { | 13 tr.exportTo('tr.v.d', function() { |
14 /** | 14 /** |
15 * Add related names GenericSet diagnostic. | 15 * Add related names GenericSet diagnostic. |
16 * | 16 * |
17 * @param {!tr.v.HistogramSet} histograms | 17 * @param {!tr.v.HistogramSet} histograms |
18 */ | 18 */ |
19 function addRelatedNames(histograms) { | 19 function addRelatedNames(histograms) { |
20 for (const hist of histograms) { | 20 for (const hist of histograms) { |
21 const relatedNames = new Set(); | 21 const relatedNames = new Set(); |
22 for (const [name, diagnostic] of hist.diagnostics) { | 22 for (const [name, diagnostic] of hist.diagnostics) { |
23 if (diagnostic instanceof tr.v.d.RelatedHistogramSet) { | |
24 for (const relatedHist of diagnostic) { | |
25 relatedNames.add(relatedHist.name); | |
26 } | |
27 } | |
28 if (diagnostic instanceof tr.v.d.RelatedHistogramMap) { | 23 if (diagnostic instanceof tr.v.d.RelatedHistogramMap) { |
29 for (const [relationshipName, relatedHist] of diagnostic) { | 24 for (const [relationshipName, relatedHist] of diagnostic) { |
30 relatedNames.add(relatedHist.name); | 25 relatedNames.add(relatedHist.name); |
31 } | 26 } |
32 } | 27 } |
33 } | 28 } |
34 if (relatedNames.size) { | 29 if (relatedNames.size) { |
35 hist.diagnostics.set( | 30 hist.diagnostics.set( |
36 tr.v.d.RESERVED_NAMES.RELATED_NAMES, | 31 tr.v.d.RESERVED_NAMES.RELATED_NAMES, |
37 new tr.v.d.GenericSet(relatedNames)); | 32 new tr.v.d.GenericSet(relatedNames)); |
38 } | 33 } |
39 } | 34 } |
40 } | 35 } |
41 | 36 |
42 return { | 37 return { |
43 addRelatedNames, | 38 addRelatedNames, |
44 }; | 39 }; |
45 }); | 40 }); |
46 </script> | 41 </script> |
OLD | NEW |