Chromium Code Reviews| Index: tracing/tracing/results2_template.html |
| diff --git a/tracing/tracing/results2_template.html b/tracing/tracing/results2_template.html |
| index 46481c196a2ad7bed3e1c20b0a3629820df1b13c..4a7e779d15d61d8a013c8fdf1310792c42b7ad10 100644 |
| --- a/tracing/tracing/results2_template.html |
| +++ b/tracing/tracing/results2_template.html |
| @@ -8,6 +8,7 @@ found in the LICENSE file. |
| <div id="loading">Loading framework...</div> |
| +<link rel="import" href="/tracing/value/chart_json_converter.html"> |
| <link rel="import" href="/tracing/value/histogram_set.html"> |
| <link rel="import" href="/tracing/value/ui/histogram_set_view.html"> |
| @@ -21,7 +22,8 @@ class HistogramImporter { |
| // exists, and is definitely before the json divs exist. |
| this.loadingDiv_ = document.getElementById('loading'); |
| this.histograms_ = undefined; |
| - this.jsonDivs_ = []; |
| + this.histogramJsonDivs_ = []; |
| + this.chartJsonDivs_ = []; |
| this.view_ = undefined; |
| this.update_('Parsing HTML...'); |
| @@ -52,28 +54,28 @@ class HistogramImporter { |
| } |
| getJsonDivs_() { |
| - this.jsonDivs_ = document.getElementsByTagName('histogram-json'); |
| + this.histogramJsonDivs_ = document.getElementsByTagName('histogram-json'); |
| + this.chartJsonDivs_ = document.getElementsByTagName('chart-json'); |
| - this.schedule_('Loading Histogram 0 of ' + this.jsonDivs_.length, |
| + this.schedule_('Loading Histogram 0 of ' + this.histogramJsonDivs_.length, |
| this.loadSomeHistograms_); |
| } |
| get isDoneLoadingHistograms_() { |
| - return this.histograms_.length === this.jsonDivs_.length; |
| + return this.histograms_.length === this.histogramJsonDivs_.length; |
| } |
| loadSomeHistograms_() { |
| var startIndex = this.histograms_.length; |
| - var stopIndex = Math.min(startIndex + 100, this.jsonDivs_.length); |
| + var stopIndex = Math.min(startIndex + 100, this.histogramJsonDivs_.length); |
| for (var i = startIndex; i < stopIndex; ++i) { |
| - var dict = JSON.parse(this.jsonDivs_[i].innerHTML); |
| + var dict = JSON.parse(this.histogramJsonDivs_[i].innerHTML); |
| this.histograms_.addHistogram(tr.v.Histogram.fromDict(dict)); |
| } |
| if (!this.isDoneLoadingHistograms_) { |
| - this.schedule_( |
| - 'Loading Histogram ' + stopIndex + ' of ' + this.jsonDivs_.length, |
| - this.loadSomeHistograms_); |
| + this.schedule_('Loading Histogram ' + stopIndex + ' of ' + |
| + this.histogramJsonDivs_.length, this.loadSomeHistograms_); |
| return; |
| } |
| @@ -83,6 +85,14 @@ class HistogramImporter { |
| resolveRelationships_() { |
| this.histograms_.resolveRelatedHistograms(); |
| + this.schedule_('Loading Chart JSON...', this.loadChartJson_); |
| + } |
| + |
| + loadChartJson_() { |
| + for (var i = 0; i < this.chartJsonDivs_.length; ++i) { |
| + var dict = JSON.parse(this.chartJsonDivs_[i].innerHTML); |
| + tr.v.ChartJsonConverter.convertChartJson(dict, this.histograms_); |
| + } |
| this.schedule_('Displaying Histogram table...', this.displayHistograms); |
| } |
| @@ -96,8 +106,8 @@ class HistogramImporter { |
| } |
| removeJsonDivs_() { |
| - document.body.removeChild(this.jsonDivs_[0].parentNode); |
| - delete this.jsonDivs_; |
| + var firstJsonDiv = this.histogramJsonDivs_[0] || this.chartJsonDivs_[0]; |
| + document.body.removeChild(firstJsonDiv.parentNode); |
| } |
| } |
| @@ -105,6 +115,7 @@ var importer = new HistogramImporter(); |
| document.addEventListener('DOMContentLoaded', () => { |
| importer.importHistograms(); |
| + importer = undefined; |
|
eakuefner
2016/11/18 21:37:11
?
|
| }); |
| })(); |