Index: tracing/tracing/value/diagnostics/related_histogram_set.html |
diff --git a/tracing/tracing/value/diagnostics/related_histogram_set.html b/tracing/tracing/value/diagnostics/related_histogram_set.html |
deleted file mode 100644 |
index fdcd8a584b08727179cadd203bc835324b5030c3..0000000000000000000000000000000000000000 |
--- a/tracing/tracing/value/diagnostics/related_histogram_set.html |
+++ /dev/null |
@@ -1,160 +0,0 @@ |
-<!DOCTYPE html> |
-<!-- |
-Copyright 2016 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/base/iteration_helpers.html"> |
-<link rel="import" href="/tracing/value/diagnostics/diagnostic.html"> |
-<link rel="import" href="/tracing/value/diagnostics/histogram_ref.html"> |
- |
-<script> |
-'use strict'; |
- |
-tr.exportTo('tr.v.d', function() { |
- class RelatedHistogramSet extends tr.v.d.Diagnostic { |
- constructor(opt_histograms) { |
- super(); |
- this.histogramsByGuid_ = new Map(); |
- |
- if (opt_histograms) { |
- for (const hist of opt_histograms) { |
- this.add(hist); |
- } |
- } |
- } |
- |
- canAddDiagnostic(otherDiagnostic) { |
- return otherDiagnostic instanceof RelatedHistogramSet; |
- } |
- |
- addDiagnostic(otherDiagnostic) { |
- // Related Histograms might not exist yet. |
- } |
- |
- mergeRelationships(otherDiagnostic, parentHist, otherParentHist) { |
- /* |
- Modify |this| to contain Histograms that should be related to |
- |parentHist|. |
- |
- |otherParentHist| was merged to |parentHist|. |
- |otherDiagnostic| contains Histograms that are related to |
- |otherParentHist|. |
- |
- Since mergeRelationships() is called after all Histograms are merged, |
- then the MERGED_TO diagnostics of the Histograms in |otherDiagnostic| |
- contain Histograms that should be related to |parentHist| via |this| |
- RelatedHistogramSet. |
- |
- otherParentHist -----------------------------> parentHist |
- | merged to RelatedHistogramSet | |
- | | |
- | otherDiagnostic | this |
- | RelatedHistogramSet | RelatedHistogramSet |
- v v |
- otherRelatedHist -----------------------------> relatedHist |
- merged to RelatedHistogramSet |
- |
- However, |otherRelatedHist| may have been merged to Histograms using |
- different grouping keys, so if |relatedHist|'s merge path is different |
- from |parentHist|'s merge path, then |relatedHist| should not be related |
- to |parentHist|. |
- */ |
- const parentGroupingPath = tr.v.d.GroupingPath.getFromHistogram( |
- parentHist); |
- for (const otherRelatedHist of otherDiagnostic) { |
- const mergedTo = otherRelatedHist.diagnostics.get( |
- tr.v.d.RESERVED_NAMES.MERGED_TO); |
- if (mergedTo === undefined) continue; |
- |
- for (const relatedHist of mergedTo) { |
- if (this.has(relatedHist)) continue; |
- |
- const relatedGroupingPath = tr.v.d.GroupingPath.getFromHistogram( |
- relatedHist); |
- if (relatedGroupingPath === undefined) continue; |
- if (!parentGroupingPath.equals(relatedGroupingPath)) continue; |
- |
- this.add(relatedHist); |
- } |
- } |
- } |
- |
- /** |
- * @param {!(tr.v.d.HistogramRef|tr.v.Histogram)} v |
- */ |
- add(hist) { |
- if (!(hist instanceof tr.v.Histogram) && |
- !(hist instanceof tr.v.d.HistogramRef)) { |
- throw new Error('Must be instanceof Histogram or HistogramRef: ' + |
- hist); |
- } |
- |
- if (this.histogramsByGuid_.has(hist.guid)) { |
- throw new Error('Tried to add same hist twice'); |
- } |
- |
- this.histogramsByGuid_.set(hist.guid, hist); |
- } |
- |
- has(hist) { |
- return this.histogramsByGuid_.has(hist.guid); |
- } |
- |
- get length() { |
- return this.histogramsByGuid_.size; |
- } |
- |
- * [Symbol.iterator]() { |
- for (const [guid, hist] of this.histogramsByGuid_) { |
- yield hist; |
- } |
- } |
- |
- /** |
- * Resolve all HistogramRefs into Histograms by looking up their guids in |
- * |histograms|. |
- * If a Histogram cannot be found and |opt_required| is true, then throw an |
- * Error. |
- * If a Histogram cannot be found and |opt_required| is false, then the |
- * HistogramRef will remain a HistogramRef. |
- * |
- * @param {!tr.v.HistogramSet} histograms |
- * @param {boolean=} opt_required |
- */ |
- resolve(histograms, opt_required) { |
- for (const [guid, value] of this.histogramsByGuid_) { |
- if (!(value instanceof tr.v.d.HistogramRef)) continue; |
- |
- const hist = histograms.lookupHistogram(guid); |
- if (hist instanceof tr.v.Histogram) { |
- this.histogramsByGuid_.set(guid, hist); |
- } else if (opt_required) { |
- throw new Error('Unable to find Histogram ' + guid); |
- } |
- } |
- } |
- |
- asDictInto_(d) { |
- d.guids = []; |
- for (const hist of this) { |
- d.guids.push(hist.guid); |
- } |
- } |
- |
- static fromDict(d) { |
- return new RelatedHistogramSet(d.guids.map( |
- guid => new tr.v.d.HistogramRef(guid))); |
- } |
- } |
- |
- tr.v.d.Diagnostic.register(RelatedHistogramSet, { |
- elementName: 'tr-v-ui-related-histogram-set-span' |
- }); |
- |
- return { |
- RelatedHistogramSet, |
- }; |
-}); |
-</script> |