Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1647)

Side by Side Diff: tracing/tracing/value/diagnostics/unmergeable_diagnostic_set.html

Issue 3009553002: Refactor Histogram relationship diagnostics. (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tracing/tracing/value/diagnostics/tag_map.html ('k') | tracing/tracing/value/histogram.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/diagnostic.html"> 8 <link rel="import" href="/tracing/value/diagnostics/diagnostic.html">
9 9
10 <script> 10 <script>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 if (this._diagnostics[i].canAddDiagnostic(otherDiagnostic)) { 52 if (this._diagnostics[i].canAddDiagnostic(otherDiagnostic)) {
53 this._diagnostics[i].addDiagnostic(otherDiagnostic); 53 this._diagnostics[i].addDiagnostic(otherDiagnostic);
54 return; 54 return;
55 } 55 }
56 } 56 }
57 57
58 const clone = otherDiagnostic.clone(); 58 const clone = otherDiagnostic.clone();
59 this._diagnostics.push(clone); 59 this._diagnostics.push(clone);
60 } 60 }
61 61
62 mergeRelationships(otherDiagnostic, parentHist, otherParentHist) {
63 if (otherDiagnostic instanceof UnmergeableDiagnosticSet) {
64 for (const subDiagnostic of otherDiagnostic) {
65 this.mergeRelationships(subDiagnostic, parentHist, otherParentHist);
66 }
67 return;
68 }
69 for (const subDiagnostic of this) {
70 if (!(subDiagnostic instanceof tr.v.d.RelatedHistogramMap) &&
71 !(subDiagnostic instanceof tr.v.d.RelatedHistogramBreakdown)) {
72 continue;
73 }
74 subDiagnostic.mergeRelationships(
75 otherDiagnostic, parentHist, otherParentHist);
76 }
77 }
78
79 get length() { 62 get length() {
80 return this._diagnostics.length; 63 return this._diagnostics.length;
81 } 64 }
82 65
83 * [Symbol.iterator]() { 66 * [Symbol.iterator]() {
84 for (const diagnostic of this._diagnostics) yield diagnostic; 67 for (const diagnostic of this._diagnostics) yield diagnostic;
85 } 68 }
86 69
87 asDictInto_(d) { 70 asDictInto_(d) {
88 d.diagnostics = this._diagnostics.map(d => d.asDictOrReference()); 71 d.diagnostics = this._diagnostics.map(d => d.asDictOrReference());
89 } 72 }
90 73
91 static fromDict(d) { 74 static fromDict(d) {
92 return new UnmergeableDiagnosticSet(d.diagnostics.map( 75 return new UnmergeableDiagnosticSet(d.diagnostics.map(
93 d => ((typeof d === 'string') ? 76 d => ((typeof d === 'string') ?
94 new tr.v.d.DiagnosticRef(d) : tr.v.d.Diagnostic.fromDict(d)))); 77 new tr.v.d.DiagnosticRef(d) : tr.v.d.Diagnostic.fromDict(d))));
95 } 78 }
96 } 79 }
97 80
98 tr.v.d.Diagnostic.register(UnmergeableDiagnosticSet, { 81 tr.v.d.Diagnostic.register(UnmergeableDiagnosticSet, {
99 elementName: 'tr-v-ui-unmergeable-diagnostic-set-span' 82 elementName: 'tr-v-ui-unmergeable-diagnostic-set-span'
100 }); 83 });
101 84
102 return { 85 return {
103 UnmergeableDiagnosticSet, 86 UnmergeableDiagnosticSet,
104 }; 87 };
105 }); 88 });
106 </script> 89 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/value/diagnostics/tag_map.html ('k') | tracing/tracing/value/histogram.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698