summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/tracing/tracing/value/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/value/ui')
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span.html75
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span_test.html28
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table.html90
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table_test.html30
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_span.html69
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span.html41
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span_test.html22
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view.html299
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view_test.html199
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span.html192
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span_test.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/iteration_info_span.html73
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit.html40
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit_test.html22
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span.html37
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span_test.html57
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span.html38
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span_test.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span.html38
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span_test.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span.html263
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span_test.html236
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table.html315
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table_test.html87
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/value_set_view.html87
25 files changed, 0 insertions, 2472 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span.html
deleted file mode 100644
index 9f90e35bdb7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/statistics.html">
-<script>
-'use strict';
-tr.exportTo('tr.v.ui', function() {
- var ArrayOfNumbersSummaryModes = {
- AVERAGE_MODE: 'average-mode',
- TOTAL_MODE: 'total-mode'
- };
- return {
- ArrayOfNumbersSummaryModes: ArrayOfNumbersSummaryModes
- };
-});
-</script>
-<polymer-element name="tr-v-ui-array-of-numbers-span">
- <template>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.numbers_ = undefined;
- this.summaryMode_ = tr.v.ui.ArrayOfNumbersSummaryModes.AVERAGE_MODE;
- },
-
- get summaryMode() {
- return this.summaryMode_;
- },
-
- set summaryMode(summaryMode) {
- this.summaryMode_ = summaryMode;
- this.updateContents_();
- },
-
- get numbers() {
- return this.numbers_;
- },
-
- set numbers(numbers) {
- if (numbers === undefined) {
- this.numbers_ = undefined;
- this.updateContents_();
- return;
- }
- if (!(numbers instanceof Array))
- throw new Error('Must provide an array');
- this.numbers_ = numbers;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.numbers_ === undefined) {
- this.shadowRoot.textContent = '-';
- return;
- }
-
- var ArrayOfNumbersSummaryModes = tr.v.ui.ArrayOfNumbersSummaryModes;
- var value;
- if (this.summaryMode_ === ArrayOfNumbersSummaryModes.AVERAGE_MODE)
- value = tr.b.Statistics.mean(this.numbers_);
- else
- value = tr.b.Statistics.sum(this.numbers_);
-
- var valueRounded = Math.round(value * 1000.0) / 1000.0;
- this.shadowRoot.textContent = valueRounded;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span_test.html
deleted file mode 100644
index 9847276b8d7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span_test.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/value/ui/array_of_numbers_span.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiateInAverageMode', function() {
- var span = document.createElement('tr-v-ui-array-of-numbers-span');
- span.numbers = [1, 2, 3];
- span.summaryMode = tr.v.ui.ArrayOfNumbersSummaryModes.AVERAGE_MODE;
- this.addHTMLOutput(span);
- assert.equal(span.shadowRoot.textContent, '2');
- });
-
- test('instantiateInTotalsMode', function() {
- var span = document.createElement('tr-v-ui-array-of-numbers-span');
- span.numbers = [1, 2, 3];
- span.summaryMode = tr.v.ui.ArrayOfNumbersSummaryModes.TOTALS_MODE;
- this.addHTMLOutput(span);
- assert.equal(span.shadowRoot.textContent, '6');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table.html b/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table.html
deleted file mode 100644
index 107849c0b01..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table.html
+++ /dev/null
@@ -1,90 +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/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-
-<polymer-element name="tr-v-ui-diagnostic-map-table">
- <template>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.titledDiagnosticMaps_ = undefined;
- },
-
- /**
- * The |title| will be used as the heading for the column containing
- * diagnostic-spans for |diagnosticMap|'s Diagnostics.
- *
- * @param {!Array.<!Object>} maps
- * @param {!string} maps[].title
- * @param {!tr.v.d.DiagnosticMap} maps[].diagnosticMap
- */
- set titledDiagnosticMaps(maps) {
- this.titledDiagnosticMaps_ = maps;
- this.updateContent_();
- },
-
- updateContent_: function() {
- if (this.titledDiagnosticMaps_ === undefined ||
- this.titledDiagnosticMaps_.length === 0) {
- this.$.table.tableRows = [];
- this.$.table.tableColumns = [];
- return;
- }
-
- var columns = [{
- title: 'Name',
-
- value: function(row) {
- return row.name;
- },
-
- cmp: function(a, b) {
- return a.name.localeCompare(b.name);
- }
- }];
-
- var rowNames = {};
- var rows = [];
-
- this.titledDiagnosticMaps_.forEach(function(titledMap) {
- var title = titledMap.title;
- var diagnosticMap = titledMap.diagnosticMap;
-
- columns.push({
- title: title,
-
- value: function(row) {
- var diagnostic = diagnosticMap.get(row.name);
- if (diagnostic === undefined)
- return '';
-
- return tr.v.ui.createDiagnosticSpan(diagnostic);
- }
- });
-
- diagnosticMap.forEach(function(name, diagnostic) {
- if (rowNames[name] !== true) {
- rowNames[name] = true;
- rows.push({name: name});
- }
- });
- }, this);
-
- rows.sort(columns[0].cmp);
- this.$.table.tableColumns = columns;
- this.$.table.tableRows = rows;
- this.$.table.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table_test.html
deleted file mode 100644
index 31eafe23413..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table_test.html
+++ /dev/null
@@ -1,30 +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/value/diagnostics/diagnostic_map.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_map_table.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var map0 = new tr.v.d.DiagnosticMap();
- map0.add('genericA', new tr.v.d.Generic({a: 0}));
- map0.add('genericB', new tr.v.d.Generic({b: 0}));
- var map1 = new tr.v.d.DiagnosticMap();
- map1.add('genericA', new tr.v.d.Generic({a: 1}));
- map1.add('genericB', new tr.v.d.Generic({b: 1}));
- var table = document.createElement('tr-v-ui-diagnostic-map-table');
- table.titledDiagnosticMaps = [
- {title: 'map0', diagnosticMap: map0},
- {title: 'map1', diagnosticMap: map1},
- ];
- this.addHTMLOutput(table);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_span.html
deleted file mode 100644
index 23940f0c0dd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_span.html
+++ /dev/null
@@ -1,69 +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/ui/base/deep_utils.html">
-<link rel="import" href="/tracing/ui/base/polymer_utils.html">
-<link rel="import" href="/tracing/value/diagnostics/diagnostic.html">
-<link rel="import" href="/tracing/value/ui/generic_diagnostic_span.html">
-<link rel="import" href="/tracing/value/ui/iteration_info_span.html">
-<link rel="import" href="/tracing/value/ui/related_event_set_span.html">
-<link rel="import" href="/tracing/value/ui/related_value_map_span.html">
-<link rel="import" href="/tracing/value/ui/related_value_set_span.html">
-
-<script>
-'use strict';
-tr.exportTo('tr.v.ui', function() {
- /**
- * Find the name of a polymer element registered to display |diagnostic|
- * or one of its base classes.
- *
- * @param {!tr.v.d.Diagnostic} diagnostic
- * @return {string}
- */
- function findElementNameForDiagnostic(diagnostic) {
- var typeInfo = undefined;
- var curProto = diagnostic.constructor.prototype;
- while (curProto) {
- typeInfo = tr.v.d.Diagnostic.findTypeInfo(curProto.constructor);
- if (typeInfo && typeInfo.metadata.elementName)
- break;
- typeInfo = undefined;
- curProto = curProto.__proto__;
- }
-
- if (typeInfo === undefined) {
- throw new Error(
- diagnostic.constructor.name +
- ' or a base class must have a registered elementName');
- }
-
- var tagName = typeInfo.metadata.elementName;
-
- if (!tr.ui.b.getPolymerElementNamed(tagName))
- throw new Error('Element not registered: ' + tagName);
-
- return tagName;
- }
-
- /**
- * Create a visualization for |diagnostic|.
- *
- * @param {!tr.v.d.Diagnostic} diagnostic
- * @return {Element}
- */
- function createDiagnosticSpan(diagnostic) {
- var tagName = findElementNameForDiagnostic(diagnostic);
- var span = document.createElement(tagName);
- span.diagnostic = diagnostic;
- return span;
- }
-
- return {
- createDiagnosticSpan: createDiagnosticSpan
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span.html
deleted file mode 100644
index 502cf020362..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span.html
+++ /dev/null
@@ -1,41 +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/ui/analysis/generic_object_view.html">
-
-<polymer-element name="tr-v-ui-generic-diagnostic-span">
- <template>
- <tr-ui-a-generic-object-view id="generic"></tr-ui-a-generic-object-view>
- </template>
-
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.diagnostic === undefined) {
- this.$.generic.object = undefined;
- return;
- }
-
- this.$.generic.object = this.diagnostic.value;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span_test.html
deleted file mode 100644
index d6b8727381f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span_test.html
+++ /dev/null
@@ -1,22 +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/value/diagnostics/generic.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var diagnostic = new tr.v.d.Generic({foo: 'bar', baz: [42]});
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-GENERIC-DIAGNOSTIC-SPAN', span.tagName);
- this.addHTMLOutput(span);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view.html b/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view.html
deleted file mode 100644
index f9becaee0e4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view.html
+++ /dev/null
@@ -1,299 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/base/statistics.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/generic_table.html">
-<link rel="import" href="/tracing/value/ui/array_of_numbers_span.html">
-
-<polymer-element name="tr-v-ui-generic-table-view">
- <template>
- <style>
- :host {
- display: flex;
- }
- #table {
- flex: 1 1 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.ui', function() {
- var TEXT_COLUMN_MODE = 1;
- var NUMERIC_COLUMN_MODE = 2;
- var ELEMENT_COLUMN_MODE = 3;
-
- function isNumeric(value) {
- // TODO(nduca): Also consider other units that are numeric.
- if ((typeof value) === 'number')
- return true;
- else if (value instanceof Number)
- return true;
- return false;
- }
-
- function GenericTableViewTotalsItem(opt_values) {
- if (opt_values !== undefined)
- this.values = opt_values;
- else
- this.values = [];
- }
-
- function GenericTableViewColumnDescriptor(fieldName, firstFieldValue) {
- this.title = fieldName;
- this.fieldName = fieldName;
-
- this.updateModeGivenValue(firstFieldValue);
- }
-
- GenericTableViewColumnDescriptor.prototype = {
- get columnMode() {
- return this.columnMode_;
- },
-
- get isInNumericMode() {
- return this.columnMode_ === NUMERIC_COLUMN_MODE;
- },
-
- cmp: function(a, b) {
- if (this.columnMode_ === ELEMENT_COLUMN_MODE)
- return 0;
-
- return tr.b.comparePossiblyUndefinedValues(a, b, function(a, b) {
- var vA = a[this.fieldName];
- var vB = b[this.fieldName];
- return tr.b.comparePossiblyUndefinedValues(vA, vB, function(vA, vB) {
- if (vA.localeCompare)
- return vA.localeCompare(vB);
- return vA - vB;
- }, this);
- }, this);
- },
-
- updateModeGivenValue: function(fieldValue) {
- if (this.columnMode_ === undefined) {
- if (fieldValue === undefined || fieldValue === null)
- return;
-
- if (isNumeric(fieldValue)) {
- this.columnMode_ = NUMERIC_COLUMN_MODE;
- return;
- }
-
- if (fieldValue instanceof HTMLElement) {
- this.columnMode_ = ELEMENT_COLUMN_MODE;
- return;
- }
-
- this.columnMode_ = TEXT_COLUMN_MODE;
- return;
- }
-
- // Undefineds & nulls shouldn't change the mode.
- if (fieldValue === undefined || fieldValue === null)
- return;
-
- // If we were already in numeric mode, then we don't
- // need to put it into numeric mode again. And, if we were
- // previously in text mode, then we can't go into numeric mode now.
- if (isNumeric(fieldValue))
- return;
-
- if (fieldValue instanceof HTMLElement) {
- this.columnMode_ = ELEMENT_COLUMN_MODE;
- return;
- }
-
- if (this.columnMode_ === NUMERIC_COLUMN_MODE)
- this.columnMode_ = TEXT_COLUMN_MODE;
- },
-
- value: function(item) {
- var fieldValue = item[this.fieldName];
- if (fieldValue instanceof GenericTableViewTotalsItem) {
- var span = document.createElement('tr-v-ui-array-of-numbers-span');
- span.summaryMode = tr.v.ui.ArrayOfNumbersSummaryModes.TOTAL_MODE;
- span.numbers = fieldValue.values;
- return span;
- }
-
- if (fieldValue === undefined)
- return '-';
-
- if (fieldValue instanceof HTMLElement)
- return fieldValue;
-
- if (fieldValue instanceof Object) {
- var gov = document.createElement('tr-ui-a-generic-object-view');
- gov.object = fieldValue;
- return gov;
- }
-
- // TODO(nduca): Use units objects if applicable.
- return fieldValue;
- }
- };
-
- Polymer('tr-v-ui-generic-table-view', {
- created: function() {
- this.items_ = undefined;
- this.importantColumNames_ = [];
- },
-
- get items() {
- return this.items_;
- },
-
- set items(itemsOrGenericTable) {
- if (itemsOrGenericTable === undefined) {
- this.items_ = undefined;
- } else if (itemsOrGenericTable instanceof Array) {
- this.items_ = itemsOrGenericTable;
- } else if (itemsOrGenericTable instanceof tr.v.GenericTable) {
- this.items_ = itemsOrGenericTable.items;
- }
- this.updateContents_();
- },
-
- get importantColumNames() {
- return this.importantColumNames_;
- },
-
- set importantColumNames(importantColumNames) {
- this.importantColumNames_ = importantColumNames;
- this.updateContents_();
- },
-
- createColumns_: function() {
- var columnsByName = {};
- this.items_.forEach(function(item) {
- tr.b.iterItems(item, function(itemFieldName, itemFieldValue) {
- var colDesc = columnsByName[itemFieldName];
- if (colDesc !== undefined) {
- colDesc.updateModeGivenValue(itemFieldValue);
- return;
- }
-
- colDesc = new GenericTableViewColumnDescriptor(
- itemFieldName, itemFieldValue);
- columnsByName[itemFieldName] = colDesc;
- }, this);
- }, this);
-
- var columns = tr.b.dictionaryValues(columnsByName);
- if (columns.length === 0)
- return undefined;
-
- // Sort by name.
- var isColumnNameImportant = {};
- var importantColumNames = this.importantColumNames || [];
- importantColumNames.forEach(function(icn) {
- isColumnNameImportant[icn] = true;
- });
- columns.sort(function(a, b) {
- var iA = isColumnNameImportant[a.title] ? 1 : 0;
- var iB = isColumnNameImportant[b.title] ? 1 : 0;
- if ((iB - iA) !== 0)
- return iB - iA;
- return a.title.localeCompare(b.title);
- });
-
- // Set sizes. This is convoluted by the fact that the first
- // table column must have fixed size.
- var colWidthPercentage;
- if (columns.length == 1)
- colWidthPercentage = '100%';
- else
- colWidthPercentage = (100 / (columns.length - 1)).toFixed(3) + '%';
- columns[0].width = '250px';
- for (var i = 1; i < columns.length; i++)
- columns[i].width = colWidthPercentage;
-
- return columns;
- },
-
- createFooterRowsIfNeeded_: function(columns) {
- // Make totals row if needed.
- var hasColumnThatIsNumeric = columns.some(function(column) {
- return column.isInNumericMode;
- });
- if (!hasColumnThatIsNumeric)
- return [];
-
- var totalsItems = {};
- columns.forEach(function(column) {
- if (!column.isInNumericMode)
- return;
- var totalsItem = new GenericTableViewTotalsItem();
- this.items_.forEach(function(item) {
- var fieldValue = item[column.fieldName];
- if (fieldValue === undefined || fieldValue === null)
- return;
- totalsItem.values.push(fieldValue);
- });
- totalsItems[column.fieldName] = totalsItem;
- }, this);
-
- return [totalsItems];
- },
-
- updateContents_: function() {
- var columns;
- if (this.items_ !== undefined)
- columns = this.createColumns_();
-
- if (!columns) {
- this.$.table.tableColumns = [];
- this.$.table.tableRows = [];
- this.$.table.footerRows = [];
- return;
- }
-
- this.$.table.tableColumns = columns;
- this.$.table.tableRows = this.items_;
- this.$.table.footerRows = this.createFooterRowsIfNeeded_(columns);
- this.$.table.rebuild();
- },
-
- get selectionMode() {
- return this.$.table.selectionMode;
- },
-
- set selectionMode(selectionMode) {
- this.$.table.selectionMode = selectionMode;
- },
-
- get rowHighlightStyle() {
- return this.$.table.rowHighlightStyle;
- },
-
- set rowHighlightStyle(rowHighlightStyle) {
- this.$.table.rowHighlightStyle = rowHighlightStyle;
- },
-
- get cellHighlightStyle() {
- return this.$.table.cellHighlightStyle;
- },
-
- set cellHighlightStyle(cellHighlightStyle) {
- this.$.table.cellHighlightStyle = cellHighlightStyle;
- }
- });
-
- return {
- GenericTableViewTotalsItem: GenericTableViewTotalsItem,
- GenericTableViewColumnDescriptor: GenericTableViewColumnDescriptor
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view_test.html
deleted file mode 100644
index 85bfe45f2c7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view_test.html
+++ /dev/null
@@ -1,199 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 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/value/generic_table.html">
-<link rel="import" href="/tracing/value/ui/generic_table_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var GenericTableViewColumnDescriptor =
- tr.v.ui.GenericTableViewColumnDescriptor;
- var GenericTableViewTotalsItem = tr.v.ui.GenericTableViewTotalsItem;
-
- test('descBasicNumericMode', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a');
- assert.isFalse(colDesc.isInNumericMode);
-
- colDesc.updateModeGivenValue(4);
- assert.isTrue(colDesc.isInNumericMode);
-
- colDesc.updateModeGivenValue(4);
- assert.isTrue(colDesc.isInNumericMode);
-
- colDesc.updateModeGivenValue(undefined);
- colDesc.updateModeGivenValue(null);
- assert.isTrue(colDesc.isInNumericMode);
-
- colDesc.updateModeGivenValue('a');
- assert.isFalse(colDesc.isInNumericMode);
- });
-
- test('descBasicNonNumericMode', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a');
- assert.isFalse(colDesc.isInNumericMode);
- colDesc.updateModeGivenValue(4);
- assert.isTrue(colDesc.isInNumericMode);
- colDesc.updateModeGivenValue('a');
- assert.isFalse(colDesc.isInNumericMode);
- });
-
- test('descCmpWithNumbers', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a', 1);
- assert.equal(colDesc.cmp({a: 1}, {a: 2}), -1);
- assert.equal(colDesc.cmp({a: 1}, undefined), -1);
- });
-
- test('descCmpWithText', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a', 'text');
- assert.equal(colDesc.cmp({a: 'a'}, {a: 'b'}), -1);
- assert.equal(colDesc.cmp({a: 'a'}, undefined), -1);
- });
-
- test('descValue', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a', 1);
- var value = colDesc.value({a: undefined});
- assert.equal(value, '-');
-
- value = colDesc.value({a: 3});
- assert.equal(value, 3);
-
- var totalsValue = colDesc.value(
- {a: new GenericTableViewTotalsItem([1, 2, 3])});
- assert.equal(totalsValue.tagName.toLowerCase(),
- 'tr-v-ui-array-of-numbers-span');
- assert.deepEqual(totalsValue.numbers, [1, 2, 3]);
- });
-
- test('everythingTogether', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: 'someString',
- b: 2,
- c: 'adsf'
- },
- {
- a: 'someOtherString',
- b: 2,
- c: 'adsf'
- }
- ];
- this.addHTMLOutput(table);
- });
-
- test('summableColumn', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: 1
- },
- {
- a: 2
- },
- {
- a: 3
- }
- ];
- this.addHTMLOutput(table);
-
- assert.equal(table.$.table.tableColumns.length, 1);
- assert.equal(table.$.table.tableRows.length, 3);
- assert.isTrue(table.$.table.tableColumns[0].isInNumericMode);
- assert.equal(table.$.table.tableColumns[0].fieldName, 'a');
- var totalsItem = table.$.table.footerRows[0].a;
- assert.deepEqual(totalsItem.values, [1, 2, 3]);
- });
-
-
- test('usingGenericTable', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = new tr.v.GenericTable([
- {
- a: 1
- }
- ]);
- assert.equal(table.items.length, 1);
- });
-
- test('valueIsObject', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = new tr.v.GenericTable([
- {
- a: {x: 1, y: 'string'}
- },
- {
- a: 'something'
- }
- ]);
- this.addHTMLOutput(table);
- assert.equal(table.items.length, 2);
- });
-
- test('mixedTypeTable', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: 1
- },
- {
- a: 2
- },
- {
- b: 'c'
- }
- ];
- this.addHTMLOutput(table);
- });
-
- test('tableWithElement', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: 1
- },
- {
- a: tr.ui.b.createSpan({textContent: 'ohai'})
- },
- {
- b: 'c'
- }
- ];
- this.addHTMLOutput(table);
- });
-
-
- test('emptyTable', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [{}];
- assert.equal(table.$.table.tableColumns.length, 0);
- });
-
- test('undefinedAndValue', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- },
- {
- a: 2
- }
- ];
- this.addHTMLOutput(table);
- });
-
- test('undefinedOnly', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: undefined
- }
- ];
- this.addHTMLOutput(table);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span.html
deleted file mode 100644
index 2bc489865c7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span.html
+++ /dev/null
@@ -1,192 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/statistics.html">
-<link rel="import" href="/tracing/ui/base/bar_chart.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-
-<polymer-element name="tr-v-ui-histogram-span">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
-
- #stats {
- display: flex;
- flex-direction: row;
- flex: 0 0 auto;
- font-weight: bold;
- }
-
- #nnans {
- color: red;
- }
- #table {
- flex: 1 1 auto;
- }
- </style>
- <div id="stats">
- <span id="nsamples"></span>&nbsp;samples,&nbsp;
- <span id="hadnans"><span id="nnans"></span> non-numeric samples,&nbsp;
- </span>
- average=<tr-v-ui-scalar-span id="average"></tr-v-ui-scalar-span>
- </div>
- <div id="container"></div>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.histogram_ = undefined;
- this.chart_ = new tr.ui.b.BarChart();
- this.chart_.width = 400;
- this.chart_.height = 200;
- this.mouseDownBin_ = undefined;
- this.brushedBins_ = [];
- this.chart_.addEventListener('item-mousedown',
- this.onMouseDown_.bind(this));
- this.chart_.addEventListener('item-mousemove',
- this.onMouseMove_.bind(this));
- this.chart_.addEventListener('item-mouseup',
- this.onMouseUp_.bind(this));
- },
-
- ready: function() {
- this.$.container.appendChild(this.chart_);
- },
-
- get brushedBins() {
- return this.brushedBins_;
- },
-
- updateBrushedRange_: function(currentX) {
- this.brushedBins_ = [this.histogram_.getBinForValue(currentX)];
- var r = new tr.b.Range();
- r.addValue(this.mouseDownX_);
- r.addValue(currentX);
-
- // Collect bins:
- var centralMin = Number.MAX_VALUE;
- var centralMax = -Number.MAX_VALUE;
- this.histogram_.centralBins.forEach(function(bin) {
- centralMin = Math.min(centralMin, bin.range.min);
- centralMax = Math.max(centralMax, bin.range.max);
- if ((bin.range.max > r.min) &&
- (bin.range.min < r.max) &&
- (this.brushedBins_.indexOf(bin) < 0))
- this.brushedBins_.push(bin);
- }, this);
- if ((this.histogram_.underflowBin.max > r.min) &&
- (this.brushedBins_.indexOf(this.histogram_.underflowBin) < 0)) {
- this.brushedBins_.push(this.histogram_.underflowBin);
- }
- if ((this.histogram_.overflowBin.min < r.max) &&
- (this.brushedBins_.indexOf(this.histogram_.overflowBin) < 0)) {
- this.brushedBins_.push(this.histogram_.overflowBin);
- }
- this.brushedBins_.sort(function(a, b) {
- return a.range.min - b.range.min;
- });
-
- // Prevent Infinity:
- var minBin = this.histogram_.getBinForValue(r.min);
- var maxBin = this.histogram_.getBinForValue(r.max);
- var binWidth = this.histogram_.centralBins[0].range.range;
- r.min = minBin ? Math.max(centralMin - binWidth, minBin.range.min) :
- centralMin - binWidth;
- r.max = maxBin ? Math.min(centralMax + binWidth, maxBin.range.max) :
- centralMax + binWidth;
-
- this.chart_.brushedRange = r;
-
- this.dispatchEvent(new tr.b.Event('brushed-bins-changed'));
- },
-
- onMouseDown_: function(chartEvent) {
- chartEvent.stopPropagation();
- if (!this.histogram_)
- return;
- this.mouseDownX_ = chartEvent.x;
- this.updateBrushedRange_(chartEvent.x);
- },
-
- onMouseMove_: function(chartEvent) {
- chartEvent.stopPropagation();
- if (!this.histogram_)
- return;
- this.updateBrushedRange_(chartEvent.x);
- },
-
- onMouseUp_: function(chartEvent) {
- chartEvent.stopPropagation();
- if (!this.histogram_)
- return;
- this.updateBrushedRange_(chartEvent.x);
- this.mouseDownX_ = undefined;
- },
-
- get histogram() {
- return this.histogram_;
- },
-
- set histogram(histogram) {
- this.histogram_ = histogram;
- this.updateContents_();
- },
-
- set isYLogScale(logScale) {
- this.chart_.isYLogScale = logScale;
- },
-
- updateContents_: function() {
- this.$.container.style.display = this.histogram_ ? '' : 'none';
- if (!this.histogram_) {
- this.$.nsamples.textContent = 0;
- this.$.average.setValueAndUnit(undefined, undefined);
- return;
- }
-
- this.$.nsamples.textContent = this.histogram_.numValues;
- this.$.average.setValueAndUnit(this.histogram_.average,
- this.histogram_.unit);
- if (this.histogram_.numNans > 0) {
- this.$.hadnans.style.display = '';
- this.$.nnans.textContent = this.histogram_.numNans;
- } else {
- this.$.hadnans.style.display = 'none';
- }
-
- var maximumBinValue = tr.b.Statistics.max(this.histogram_.allBins,
- function(bin) {
- return bin.count;
- });
- var chartData = [];
- var binWidth = this.histogram_.centralBins[0].range.range;
- this.histogram_.allBins.forEach(function(bin) {
- var x = bin.range.min;
- if (x === -Number.MAX_VALUE) {
- if (!bin.count)
- return;
- x = bin.range.max - binWidth;
- }
- chartData.push({x: x,
- y: bin.count});
- });
- chartData.sort(function(x, y) {
- return x.x - y.x;
- });
- this.$.container.style.display = chartData.length ? '' : 'none';
- this.chart_.data = chartData;
- this.brushedBins_ = [];
- this.chart_.brushedRange = new tr.b.Range();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span_test.html
deleted file mode 100644
index ad550b714f9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span_test.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/value/histogram.html">
-<link rel="import" href="/tracing/value/ui/histogram_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var DURATION_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 1000),
- 10);
-
- test('basic', function() {
- var h = DURATION_NUMERIC_BUILDER.build();
- h.add(-1, 'a');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'c');
- h.add(500, 'c');
- h.add(999, 'd');
- h.add(1000, 'd');
-
- var span = document.createElement('tr-v-ui-histogram-span');
- span.histogram = h;
- this.addHTMLOutput(span);
- });
-
- test('undefined', function() {
- var span = document.createElement('tr-v-ui-histogram-span');
- span.histogram = undefined;
- this.addHTMLOutput(span);
- });
-
- test('emptyHistogram', function() {
- var h = DURATION_NUMERIC_BUILDER.build();
-
- var span = document.createElement('tr-v-ui-histogram-span');
- span.histogram = h;
- this.addHTMLOutput(span);
- });
-
- test('nans', function() {
- var h = DURATION_NUMERIC_BUILDER.build();
- h.add(undefined, 'b');
- h.add(NaN, 'c');
-
- var span = document.createElement('tr-v-ui-histogram-span');
- span.histogram = h;
- this.addHTMLOutput(span);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/iteration_info_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/iteration_info_span.html
deleted file mode 100644
index c8799005dc2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/iteration_info_span.html
+++ /dev/null
@@ -1,73 +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/ui/base/table.html">
-
-<polymer-element name="tr-v-ui-iteration-info-span">
- <template>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
-
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- this.$.table.showHeader = false;
- this.$.table.tableColumns = [
- {
- value: function(row) {
- return row[0];
- },
- },
- {
- value: function(row) {
- return row[1];
- }
- }
- ];
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.diagnostic === undefined) {
- this.$.table.tableRows = [];
- return;
- }
-
- var rows = [
- ['benchmark name', this.diagnostic.benchmarkName],
- ['benchmark start', this.diagnostic.benchmarkStart],
- ['url', this.diagnostic.storyUrl],
- ['story', this.diagnostic.storyDisplayName],
- ['storyset repeat', this.diagnostic.storysetRepeatCounter],
- ['story repeat', this.diagnostic.storyRepeatCounter],
- ];
-
- if (this.diagnostic.label)
- rows.push(['label', this.diagnostic.label]);
-
- if (Object.keys(this.diagnostic.storyGroupingKeys).length > 0) {
- var gov = document.createElement('tr-ui-a-generic-object-view');
- gov.object = this.diagnostic.storyGroupingKeys;
- rows.push(['grouping keys', gov]);
- }
-
- rows.sort((x, y) => x[0].localeCompare(y[0]));
- this.$.table.tableRows = rows;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit.html b/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit.html
deleted file mode 100644
index 7e5a94efad1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/value/unit.html">
-
-<polymer-element name="tr-v-ui-preferred-display-unit">
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.preferredTimeDisplayMode_ = undefined;
- },
-
- attached: function() {
- tr.v.Unit.didPreferredTimeDisplayUnitChange();
- },
-
- detached: function() {
- tr.v.Unit.didPreferredTimeDisplayUnitChange();
- },
-
- // null means no-preference
- get preferredTimeDisplayMode() {
- return this.preferredTimeDisplayMode_;
- },
-
- set preferredTimeDisplayMode(v) {
- if (this.preferredTimeDisplayMode_ === v)
- return;
- this.preferredTimeDisplayMode_ = v;
- tr.v.Unit.didPreferredTimeDisplayUnitChange();
- }
-
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit_test.html
deleted file mode 100644
index 742783fc17a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit_test.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/value/time_display_mode.html">
-<link rel="import" href="/tracing/value/ui/preferred_display_unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var unit = document.createElement('tr-v-ui-preferred-display-unit');
- var ms = tr.v.TimeDisplayModes.ms;
- unit.preferredDisplayUnit = ms;
- assert.equal(unit.preferredDisplayUnit, ms);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span.html
deleted file mode 100644
index 349547f3b85..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span.html
+++ /dev/null
@@ -1,37 +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/ui/analysis/analysis_link.html">
-
-<polymer-element name="tr-v-ui-related-event-set-span">
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.textContent = '';
- var events = this.diagnostic.events;
- var link = document.createElement('tr-ui-a-analysis-link');
- var label = (events.length === 1) ? 'event' : 'events';
- link.setSelectionAndContent(events, events.length + ' ' + label);
- this.appendChild(link);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span_test.html
deleted file mode 100644
index 97adc4d708c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span_test.html
+++ /dev/null
@@ -1,57 +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/core/test_utils.html">
-<link rel="import" href="/tracing/value/diagnostics/related_event_set.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate_RelatedEventSet0', function() {
- var diagnostic = new tr.v.d.RelatedEventSet();
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-EVENT-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- assert.strictEqual('0 events', span.textContent);
- });
-
- test('instantiate_RelatedEventSet1', function() {
- var diagnostic = new tr.v.d.RelatedEventSet();
- tr.c.TestUtils.newModel(function(model) {
- var proc = model.getOrCreateProcess(1);
- var thread = proc.getOrCreateThread(2);
- var event = tr.c.TestUtils.newSliceEx({start: 0, duration: 1});
- thread.sliceGroup.pushSlice(event);
- diagnostic.push(event);
- });
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-EVENT-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- assert.strictEqual('1 event', span.textContent);
- });
-
- test('instantiate_RelatedEventSet2', function() {
- var diagnostic = new tr.v.d.RelatedEventSet();
- tr.c.TestUtils.newModel(function(model) {
- var proc = model.getOrCreateProcess(1);
- var thread = proc.getOrCreateThread(2);
- var event = tr.c.TestUtils.newSliceEx({start: 0, duration: 1});
- thread.sliceGroup.pushSlice(event);
- diagnostic.push(event);
- event = tr.c.TestUtils.newSliceEx({start: 1, duration: 1});
- thread.sliceGroup.pushSlice(event);
- diagnostic.push(event);
- });
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-EVENT-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- assert.strictEqual('2 events', span.textContent);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span.html
deleted file mode 100644
index c691c128c07..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span.html
+++ /dev/null
@@ -1,38 +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/ui/analysis/analysis_link.html">
-
-<polymer-element name="tr-v-ui-related-value-map-span">
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.textContent = '';
- this.diagnostic.iterItems(function(name, value) {
- var link = document.createElement('tr-ui-a-analysis-link');
- link.setSelectionAndContent(value, name);
- this.appendChild(link);
- this.appendChild(document.createElement('br'));
- }, this);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span_test.html
deleted file mode 100644
index c63ae6f1134..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span_test.html
+++ /dev/null
@@ -1,35 +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/value/diagnostics/related_value_map.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate_RelatedValueMap', function() {
- var aValue = new tr.v.SkipValue('a');
- var bValue = new tr.v.SkipValue('b');
- var diagnostic = new tr.v.d.RelatedValueMap();
- diagnostic.set('foo', aValue);
- diagnostic.set('bar', bValue);
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-VALUE-MAP-SPAN', span.tagName);
- this.addHTMLOutput(span);
- assert.isDefined(tr.b.findDeepElementMatchingPredicate(
- span, function(element) {
- return element.textContent === 'foo';
- }));
- assert.isDefined(tr.b.findDeepElementMatchingPredicate(
- span, function(element) {
- return element.textContent === 'bar';
- }));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span.html
deleted file mode 100644
index 2edffb9df05..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span.html
+++ /dev/null
@@ -1,38 +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/ui/analysis/analysis_link.html">
-
-<polymer-element name="tr-v-ui-related-value-set-span">
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.textContent = '';
- this.diagnostic.values.forEach(function(value) {
- var link = document.createElement('tr-ui-a-analysis-link');
- link.setSelectionAndContent(value, value.name);
- this.appendChild(link);
- this.appendChild(document.createElement('br'));
- }, this);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span_test.html
deleted file mode 100644
index 222dee57af6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span_test.html
+++ /dev/null
@@ -1,35 +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/value/diagnostics/composition.html">
-<link rel="import" href="/tracing/value/diagnostics/related_value_set.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate_RelatedValueSet', function() {
- var aValue = new tr.v.SkipValue('a');
- var bValue = new tr.v.SkipValue('b');
- var diagnostic = new tr.v.d.RelatedValueSet([aValue, bValue]);
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-VALUE-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- });
-
- test('instantiate_Composition', function() {
- var aValue = new tr.v.SkipValue('a');
- var bValue = new tr.v.SkipValue('b');
- var diagnostic = new tr.v.d.Composition([aValue, bValue]);
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-VALUE-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span.html
deleted file mode 100644
index 7588ee50d48..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span.html
+++ /dev/null
@@ -1,263 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 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/base/deep_utils.html">
-<link rel="import" href="/tracing/ui/base/polymer_utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-tr.exportTo('tr.v.ui', function() {
- /**
- * @param {undefined|tr.v.NumericValue|tr.v.Numeric} value
- * @param {Object=} opt_config
- * @return {string|Element}
- */
- function createScalarSpan(value, opt_config) {
- if (value === undefined)
- return '';
-
- var config = opt_config || {};
- var ownerDocument = config.ownerDocument || document;
-
- var span = ownerDocument.createElement('tr-v-ui-scalar-span');
-
- if (value instanceof tr.v.NumericValue) {
- value = value.numeric;
- config.unit = value.unit;
- }
-
- var numericValue;
- if (value instanceof tr.v.ScalarNumeric) {
- span.value = value;
- numericValue = value.value;
- } else if (value instanceof tr.v.Numeric) {
- numericValue = value.average;
- span.setValueAndUnit(numericValue, value.unit);
- } else {
- var unit = config.unit;
- if (unit === undefined) {
- throw new Error(
- 'Unit must be provided in config when value is a number');
- }
- span.setValueAndUnit(value, unit);
- numericValue = value;
- }
-
- if (config.context)
- span.context = config.context;
-
- if (config.total)
- span.percentage = numericValue / config.total;
-
- if (config.rightAlign)
- span.rightAlign = true;
-
- return span;
- }
-
- tr.v.Unit.addEventListener('display-mode-changed', function(e) {
- var scalarSpanTagName = 'tr-v-ui-scalar-span';
- var subclassNames = tr.ui.b.getPolymerElementsThatSubclass(
- scalarSpanTagName);
- subclassNames.push(scalarSpanTagName);
- var isSubclass = {};
- subclassNames.forEach(function(n) {
- isSubclass[n.toUpperCase()] = true;
- });
-
- var m = tr.b.findDeepElementsMatchingPredicate(
- document.body,
- function(el) {
- return isSubclass[el.tagName];
- });
- m.forEach(function(el) {
- el.updateContent_();
- });
- });
-
- return {
- createScalarSpan: createScalarSpan
- };
-});
-</script>
-
-<polymer-element name="tr-v-ui-scalar-span">
- <template>
- <style>
- :host {
- display: block;
- position: relative;
- }
- #content.right-align {
- text-align: right;
- position: relative;
- display: block;
- }
- #sparkline {
- width: 0%;
- position: absolute;
- bottom: 0;
- right: 0;
- display: none;
- height: 100%;
- background-color: hsla(216, 100%, 94.5%, .75);
- border-left: 1px solid hsl(216, 100%, 89%);
- box-sizing: border-box;
- }
- #warning {
- margin-left: 4px;
- font-size: 66%;
- }
- </style>
- <span id="sparkline"></span>
- <span id="content"></span>
- <span id="warning" style="display:none">&#9888;</span>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.value_ = undefined;
- this.unit_ = undefined;
- this.context_ = undefined;
-
- this.warning_ = undefined;
- this.percentage_ = undefined;
- },
-
- set contentTextDecoration(deco) {
- this.$.content.style.textDecoration = deco;
- },
-
- get value() {
- return this.value_;
- },
-
- set value(value) {
- if (value instanceof tr.v.ScalarNumeric) {
- this.value_ = value.value;
- this.unit_ = value.unit;
- } else {
- this.value_ = value;
- }
- this.updateContent_();
- },
-
- get unit() {
- return this.unit_;
- },
-
- set unit(unit) {
- this.unit_ = unit;
- this.updateContent_();
- },
-
- get context() {
- return this.context_;
- },
-
- set context(context) {
- this.context_ = context;
- this.updateContent_();
- },
-
- setValueAndUnit: function(value, unit) {
- this.value_ = value;
- this.unit_ = unit;
- this.updateContent_();
- },
-
- get percentage() {
- return this.percentage_;
- },
-
- set percentage(percentage) {
- this.percentage_ = percentage;
- this.updateSparkline_();
- },
-
- get rightAlign() {
- return this.$.content.classList.contains('right-align');
- },
-
- set rightAlign(rightAlign) {
- if (rightAlign)
- this.$.content.classList.add('right-align');
- else
- this.$.content.classList.remove('right-align');
- },
-
- updateSparkline_: function() {
- if (this.percentage_ === undefined) {
- this.$.sparkline.style.display = 'none';
- this.$.sparkline.style.width = '0';
- } else {
- this.$.sparkline.style.display = 'block';
- this.$.sparkline.style.width = (this.percentage_ * 100) + '%';
- }
- },
-
- updateContent_: function() {
- if (this.unit_ === undefined) {
- this.$.content.textContent = '';
- this.$.content.style.color = '';
- return;
- }
-
- this.$.content.textContent = this.unit_.format(this.value, this.context);
-
- var BIGGER_IS_BETTER = tr.v.ImprovementDirection.BIGGER_IS_BETTER;
- var SMALLER_IS_BETTER = tr.v.ImprovementDirection.SMALLER_IS_BETTER;
- var color = '';
- if (this.unit_.isDelta) {
- var improvementDirection = this.unit_.improvementDirection;
- if (this.value > 0) {
- // Positive delta.
- switch (improvementDirection) {
- case BIGGER_IS_BETTER:
- color = 'green';
- break;
- case SMALLER_IS_BETTER:
- color = 'red';
- break;
- }
- } else if (this.value < 0) {
- // Negative delta.
- switch (improvementDirection) {
- case BIGGER_IS_BETTER:
- color = 'red';
- break;
- case SMALLER_IS_BETTER:
- color = 'green';
- break;
- }
- }
- }
- this.$.content.style.color = color;
- },
-
- get warning() {
- return this.warning_;
- },
-
- set warning(warning) {
- this.warning_ = warning;
- var warningEl = this.$.warning;
- if (this.warning_) {
- warningEl.title = warning;
- warningEl.style.display = '';
- } else {
- warningEl.title = '';
- warningEl.style.display = 'none';
- }
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span_test.html
deleted file mode 100644
index 04c266cdc3a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span_test.html
+++ /dev/null
@@ -1,236 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 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/value/numeric.html">
-<link rel="import" href="/tracing/value/time_display_mode.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/unit_scale.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ScalarNumeric = tr.v.ScalarNumeric;
- var Unit = tr.v.Unit;
- var THIS_DOC = document._currentScript.ownerDocument;
-
- function checkScalarSpan(
- test, value, unit, expectedTextContent, opt_expectedColor) {
- var span = tr.v.ui.createScalarSpan(new tr.v.ScalarNumeric(unit, value));
- assert.strictEqual(span.$.content.textContent, expectedTextContent);
- assert.strictEqual(span.$.content.style.color, opt_expectedColor || '');
- test.addHTMLOutput(span);
- }
-
- test('instantiate', function() {
- checkScalarSpan(this, 123.456789, Unit.byName.timeDurationInMs,
- '123.457 ms');
- checkScalarSpan(this, 0, Unit.byName.normalizedPercentage, '0.000%');
- checkScalarSpan(this, -2560, Unit.byName.sizeInBytes, '-2.5 KiB');
- });
-
- test('instantiate_smallerIsBetter', function() {
- checkScalarSpan(this, 45097156608, Unit.byName.sizeInBytes_smallerIsBetter,
- '42.0 GiB');
- checkScalarSpan(this, 0, Unit.byName.energyInJoules_smallerIsBetter,
- '0.000 J');
- checkScalarSpan(this, -0.25, Unit.byName.unitlessNumber_smallerIsBetter,
- '-0.250');
- });
-
- test('instantiate_biggerIsBetter', function() {
- checkScalarSpan(this, 0.07, Unit.byName.powerInWatts_smallerIsBetter,
- '0.070 W');
- checkScalarSpan(this, 0, Unit.byName.timeStampInMs_biggerIsBetter,
- '0.000 ms');
- checkScalarSpan(this, -0.00003,
- Unit.byName.normalizedPercentage_biggerIsBetter, '-0.003%');
- });
-
- test('instantiate_delta', function() {
- checkScalarSpan(this, 123.456789, Unit.byName.timeDurationInMsDelta,
- '+123.457 ms');
- checkScalarSpan(this, 0, Unit.byName.normalizedPercentageDelta,
- '\u00B10.000%');
- checkScalarSpan(this, -2560, Unit.byName.sizeInBytesDelta,
- '-2.5 KiB');
- });
-
- test('instantiate_delta_smallerIsBetter', function() {
- checkScalarSpan(this, 45097156608,
- Unit.byName.sizeInBytesDelta_smallerIsBetter, '+42.0 GiB', 'red');
- checkScalarSpan(this, 0, Unit.byName.energyInJoulesDelta_smallerIsBetter,
- '\u00B10.000 J');
- checkScalarSpan(this, -0.25,
- Unit.byName.unitlessNumberDelta_smallerIsBetter, '-0.250', 'green');
- });
-
- test('instantiate_delta_biggerIsBetter', function() {
- checkScalarSpan(this, 0.07, Unit.byName.powerInWattsDelta_biggerIsBetter,
- '+0.070 W', 'green');
- checkScalarSpan(this, 0, Unit.byName.timeStampInMsDelta_biggerIsBetter,
- '\u00B10.000 ms');
- checkScalarSpan(this, -0.00003,
- Unit.byName.normalizedPercentageDelta_biggerIsBetter, '-0.003%', 'red');
- });
-
- test('createScalarSpan', function() {
- // No config.
- var span = tr.v.ui.createScalarSpan(
- new ScalarNumeric(Unit.byName.powerInWatts, 3.14));
- assert.strictEqual(span.$.content.textContent, '3.140 W');
- assert.strictEqual(span.ownerDocument, document);
- assert.strictEqual(span.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.strictEqual(span.value, 3.14);
- assert.strictEqual(span.unit, Unit.byName.powerInWatts);
- assert.isUndefined(span.context);
- assert.isUndefined(span.percentage);
- assert.isUndefined(span.warning);
- assert.isFalse(span.rightAlign);
- this.addHTMLOutput(span);
-
- // Custom owner document and right align.
- var span = tr.v.ui.createScalarSpan(
- new ScalarNumeric(Unit.byName.energyInJoules, 2.72),
- { ownerDocument: THIS_DOC, rightAlign: true });
- assert.strictEqual(span.$.content.textContent, '2.720 J');
- assert.strictEqual(span.ownerDocument, THIS_DOC);
- assert.strictEqual(span.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.strictEqual(span.value, 2.72);
- assert.strictEqual(span.unit, Unit.byName.energyInJoules);
- assert.isUndefined(span.context);
- assert.isUndefined(span.percentage);
- assert.isUndefined(span.warning);
- assert.isTrue(span.rightAlign);
- this.addHTMLOutput(span);
-
- // Unit and sparkline set via config.
- var span = tr.v.ui.createScalarSpan(1.62,
- { unit: Unit.byName.timeStampInMs, total: 3.24 });
- assert.strictEqual(span.$.content.textContent, '1.620 ms');
- assert.strictEqual(span.ownerDocument, document);
- assert.strictEqual(span.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.strictEqual(span.value, 1.62);
- assert.strictEqual(span.unit, Unit.byName.timeStampInMs);
- assert.isUndefined(span.context);
- assert.strictEqual(span.percentage, 0.5);
- assert.isUndefined(span.warning);
- assert.isFalse(span.rightAlign);
- this.addHTMLOutput(span);
-
- // Custom context.
- var span = tr.v.ui.createScalarSpan(
- new ScalarNumeric(Unit.byName.sizeInBytesDelta_smallerIsBetter,
- 256 * 1024 * 1024), { context: {
- unitPrefix: tr.v.UnitScale.Binary.KIBI,
- minimumFractionDigits: 2
- } });
- assert.strictEqual(span.$.content.textContent, '+262,144.00 KiB');
- assert.strictEqual(span.ownerDocument, document);
- assert.strictEqual(span.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.strictEqual(span.value, 256 * 1024 * 1024);
- assert.strictEqual(span.unit, Unit.byName.sizeInBytesDelta_smallerIsBetter);
- assert.deepEqual(span.context,
- { unitPrefix: tr.v.UnitScale.Binary.KIBI, minimumFractionDigits: 2 });
- assert.isUndefined(span.percentage);
- assert.isUndefined(span.warning);
- assert.isFalse(span.rightAlign);
- this.addHTMLOutput(span);
- });
-
- test('instantiate_withWarning', function() {
- var span = document.createElement('tr-v-ui-scalar-span');
- span.value = 400000000;
- span.unit = Unit.byName.sizeInBytes;
- span.warning = 'There is a problem with this size';
- this.addHTMLOutput(span);
- });
-
- test('instantiate_withPercentage', function() {
- var span = document.createElement('tr-v-ui-scalar-span');
- span.value = new ScalarNumeric(Unit.byName.unitlessNumber, 99);
- span.percentage = 0.66;
- this.addHTMLOutput(span);
- });
-
- test('instantiate_withRightAlign', function() {
- var span = document.createElement('tr-v-ui-scalar-span');
- span.value = new ScalarNumeric(Unit.byName.timeStampInMs, 5.777);
- span.rightAlign = true;
- this.addHTMLOutput(span);
- });
-
- test('instantiate_withContext', function() {
- var span = document.createElement('tr-v-ui-scalar-span');
- span.value = new ScalarNumeric(
- Unit.byName.unitlessNumberDelta_smallerIsBetter, 42);
- span.context = { maximumFractionDigits: 2 };
- assert.strictEqual(span.$.content.textContent, '+42.00');
- this.addHTMLOutput(span);
- });
-
- test('warningAndNonWarningHaveSimilarHeights', function() {
- var spanA = document.createElement('tr-v-ui-scalar-span');
- spanA.setValueAndUnit(400, Unit.byName.timeDurationInMs);
-
- var spanB = document.createElement('tr-v-ui-scalar-span');
- spanB.setValueAndUnit(400, Unit.byName.timeDurationInMs);
- spanB.warning = 'There is a problem with this time';
-
- var overall = document.createElement('div');
- overall.style.display = 'flex';
- overall.appendChild(spanA);
- spanB.style.marginLeft = '4px';
- overall.appendChild(spanB);
- this.addHTMLOutput(overall);
- });
-
- test('respectCurrentDisplayUnit', function() {
- try {
- Unit.currentTimeDisplayMode = tr.v.TimeDisplayModes.ns;
-
- var span = document.createElement('tr-v-ui-scalar-span');
- span.setValueAndUnit(73, Unit.byName.timeStampInMs);
- this.addHTMLOutput(span);
-
- assert.isTrue(span.$.content.textContent.indexOf('ns') > 0);
- Unit.currentTimeDisplayMode = tr.v.TimeDisplayModes.ms;
- assert.isTrue(span.$.content.textContent.indexOf('ms') > 0);
- } finally {
- Unit.reset();
- }
- });
-
- test('displaySparkline', function() {
- var div = document.createElement('div');
- div.style.width = '100px';
- this.addHTMLOutput(div);
-
- function addAndCheckScalarSpan(percentage, expectedDisplay, expectedWidth) {
- var span = tr.v.ui.createScalarSpan(new ScalarNumeric(
- Unit.byName.timeDurationInMs, 10 * div.children.length));
- if (percentage !== null)
- span.percentage = percentage;
-
- div.appendChild(span);
-
- var computedStyle = getComputedStyle(span.$.sparkline);
- assert.equal(computedStyle.display, expectedDisplay);
- assert.equal(parseInt(computedStyle.width), expectedWidth);
- }
-
- addAndCheckScalarSpan(null /* no percentage set */, 'none', 0);
- addAndCheckScalarSpan(undefined, 'none', 0);
- addAndCheckScalarSpan(0, 'block', 1);
- addAndCheckScalarSpan(0.05, 'block', 5);
- addAndCheckScalarSpan(0.5, 'block', 50);
- addAndCheckScalarSpan(0.95, 'block', 95);
- addAndCheckScalarSpan(1, 'block', 100);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table.html b/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table.html
deleted file mode 100644
index e9388185408..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table.html
+++ /dev/null
@@ -1,315 +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/raf.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-<link rel="import" href="/tracing/value/ui/histogram_span.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/ui/value_set_view.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name='tr-v-ui-value-set-table'>
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- table-container {
- display: flex;
- min-height: 0px;
- overflow-y: auto;
- }
- div#error {
- color: red;
- }
- #histogram {
- display: none;
- }
- </style>
-
- <div id="error"></div>
- <table-container>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </table-container>
- <tr-v-ui-histogram-span id="histogram"></tr-v-ui-histogram-span>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-tr.exportTo('tr.ui', function() {
- Polymer('tr-v-ui-value-set-table', {
- /**
- * Return true if this view supports this ValueSet.
- * Value-set-table supports all possible metrics, so it always returns true.
- *
- * @param {!tr.v.ValueSet} values
- * @return {boolean}
- */
- supportsValueSet: function(values) {
- return true;
- },
-
- /**
- * This can optionally depend on the ValueSet.
- *
- * @return {string}
- */
- get tabLabel() {
- return 'Table';
- },
-
- ready: function() {
- this.values_ = undefined;
- this.summaryValues_ = {};
- this.columns_ = undefined;
- this.$.table.selectionMode = tr.ui.b.TableFormat.SelectionMode.CELL;
- this.$.table.addEventListener('selection-changed',
- this.onSelectionChanged_.bind(this));
- },
-
- onSelectionChanged_: function() {
- var row = this.$.table.selectedTableRow;
- var col = this.$.table.selectedColumnIndex;
- var cell = undefined;
- if (row && col && this.columns_)
- cell = row[this.columns_[col].title];
-
- if ((cell instanceof tr.v.NumericValue) &&
- (cell.numeric instanceof tr.v.Numeric)) {
- this.$.histogram.style.display = 'block';
- this.$.histogram.histogram = cell.numeric;
- } else {
- this.$.histogram.style.display = 'none';
- }
- },
-
- handleFailureValues_: function() {
- this.values.map(function(value) {
- if (value instanceof tr.v.FailureValue) {
- this.$.error.textContent = value.description;
- this.$.table.style.display = 'none';
- this.style.width = '10em';
- }
- }, this);
- },
-
- addDiagnosticSubRows_: function(value, row, column) {
- value.diagnostics.forEach(function(name, diagnostic) {
- if (name === tr.v.SUMMARY_VALUE_MAP_DIAGNOSTIC_NAME)
- return;
-
- // If a previous |value| had a diagnostic with the same name, then
- // there is already a subRow that should contain this diagnostic.
- for (var subRow of row.subRows) {
- if (subRow.name === name) {
- subRow[column] = diagnostic;
- return;
- }
- }
-
- // This is the first time that a diagnostic with this name has been
- // seen for Values whose name is |value.name|, so create a new subRow.
- var subRow = {name: name};
- subRow[column] = diagnostic;
- row.subRows.push(subRow);
- });
- },
-
- get values() {
- return this.values_;
- },
-
- findSummaryValues_: function() {
- this.summaryValues_ = {};
- this.values.map(function(value) {
- var summaryValueMap = value.diagnostics.get(
- tr.v.SUMMARY_VALUE_MAP_DIAGNOSTIC_NAME);
- if (!(summaryValueMap instanceof tr.v.d.RelatedValueMap))
- return;
-
- summaryValueMap.values.forEach(function(summaryValue) {
- this.summaryValues_[summaryValue.guid] = summaryValue;
- }, this);
- }, this);
- },
-
- /**
- * @param {!tr.v.ValueSet} values
- */
- set values(values) {
- this.values_ = values;
- this.style.width = '';
- this.$.table.style.display = '';
- this.$.error.textContent = '';
-
- this.handleFailureValues_();
- if (this.$.error.textContent)
- return;
-
- this.findSummaryValues_();
-
- /* rows will look something like [
- {name: 'long tasks',
- displayLabelA: Value,
- displayLabelB: Value,
- subRows: [
- {name: 'iteration',
- displayLabelA: Diagnostic,
- displayLabelB: Diagnostic,
- }
- ]
- }
- ]
- TODO(benjhayden): After Values are summarized and merged, there will be
- more row tiers: value name > benchmark name > story name > benchmark
- start > storyset repeat > story repeat > diagnostics.
- */
- var rows = [];
-
- // This will be used to sort the columns by start time.
- var startTimesForDisplayLabels = {};
-
- tr.b.iterItems(values.organizedByName, function(name, vals) {
- var row = {name: name, subRows: []};
- var isEmptyRow = true;
-
- vals.forEach(function(val) {
- if (this.summaryValues_[val.guid])
- return;
-
- if (!row.description && val.description)
- row.description = val.description;
-
- var displayLabel = 'Value';
- var startMs = 0;
- var iteration = val.diagnostics.get(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME);
- if (iteration instanceof tr.v.d.IterationInfo) {
- displayLabel = iteration.displayLabel;
- startMs = iteration.benchmarkStart.getTime();
- }
-
- this.addDiagnosticSubRows_(val, row, displayLabel);
-
- startTimesForDisplayLabels[displayLabel] = Math.min(
- startTimesForDisplayLabels[displayLabel] || 0,
- startMs);
-
- if (row[displayLabel] !== undefined) {
- console.warn('Multiple Values with same name and displayLabel:',
- name, displayLabel, row[displayLabel], val,
- 'Sorry, only one will be displayed until summarization and ' +
- 'merging are implemented.');
- }
- row[displayLabel] = val;
- isEmptyRow = false;
- }, this);
-
- if (isEmptyRow)
- return;
-
- rows.push(row);
- }, this);
-
- if (rows.length === 0) {
- this.$.error.textContent = 'zero values';
- this.$.table.style.display = 'none';
- this.style.width = '10em';
- return;
- }
-
- this.buildColumns_(startTimesForDisplayLabels);
-
- this.$.table.tableColumns = this.columns_;
- this.$.table.tableRows = rows;
- this.$.table.sortColumnIndex = 0;
- this.$.table.rebuild();
- this.$.table.selectedTableRow = rows[0];
- this.$.table.selectedColumnIndex = 1;
-
- tr.b.requestAnimationFrame(function() {
- this.style.width = this.$.table.getBoundingClientRect().width;
- }, this);
- },
-
- buildColumns_: function(startTimesForDisplayLabels) {
- var displayLabels = Object.keys(startTimesForDisplayLabels);
- displayLabels.sort(function(a, b) {
- return startTimesForDisplayLabels[a] - startTimesForDisplayLabels[b];
- });
-
- this.columns_ = [
- {
- title: 'Name',
- align: tr.ui.b.TableFormat.ColumnAlignment.LEFT,
-
- value: function(row) {
- var nameEl = document.createElement('span');
- nameEl.textContent = row.name;
- if (row.description)
- nameEl.title = row.description;
- nameEl.style.textOverflow = 'ellipsis';
- return nameEl;
- },
-
- cmp: function(rowA, rowB) {
- rowA = rowA ? rowA.name : '';
- rowB = rowB ? rowB.name : '';
- return rowA.localeCompare(rowB);
- },
- }
- ];
-
- displayLabels.forEach(function(displayLabel) {
- this.columns_.push({
- title: displayLabel,
- align: tr.ui.b.TableFormat.ColumnAlignment.RIGHT,
- supportsCellSelection: true,
-
- value: function(row) {
- var cell = row[displayLabel];
- if (cell instanceof tr.v.d.Diagnostic) {
- return tr.v.ui.createDiagnosticSpan(cell);
- } else if (cell instanceof tr.v.NumericValue) {
- return tr.v.ui.createScalarSpan(cell);
- } else if (cell === undefined) {
- return '';
- } else {
- throw new Error('Invalid cell', cell);
- }
- },
-
- cmp: function(rowA, rowB) {
- var cellA = rowA[displayLabel];
- var cellB = rowB[displayLabel];
- if (!(cellA instanceof tr.v.NumericValue) ||
- !(cellB instanceof tr.v.NumericValue))
- return undefined;
-
- var numericA = cellA.numeric;
- var numericB = cellB.numeric;
-
- var valueA = (numericA instanceof tr.v.ScalarNumeric) ?
- numericA.value : numericA.average;
- var valueB = (numericB instanceof tr.v.ScalarNumeric) ?
- numericB.value : numericB.average;
-
- return valueA - valueB;
- }
- });
- }, this);
- }
- });
-
- tr.ui.registerValueSetView('tr-v-ui-value-set-table');
-
- return {};
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table_test.html
deleted file mode 100644
index 5358e8442f3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table_test.html
+++ /dev/null
@@ -1,87 +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/value/ui/value_set_table.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TEST_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 1000),
- 20);
-
- test('instantiate', function() {
- var table = document.createElement('tr-v-ui-value-set-table');
- var values = new tr.v.ValueSet();
- assert.isTrue(table.supportsValueSet(values));
-
- var numeric0a = TEST_NUMERIC_BUILDER.build();
- for (var i = 0; i < 1e2; ++i) {
- numeric0a.add(Math.random() * 1000);
- }
- var fooA = new tr.v.NumericValue('foo', numeric0a, {
- description: 'they should have sent a poet'
- });
- values.addValue(fooA);
- fooA.diagnostics.add(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, new tr.v.d.IterationInfo({
- label: 'iteration A',
- benchmarkStartMs: new Date().getTime(),
- }));
-
- var numeric1a = TEST_NUMERIC_BUILDER.build();
- for (var i = 0; i < 1e2; ++i) {
- numeric1a.add(Math.random() * 1000);
- }
- var barA = new tr.v.NumericValue('bar', numeric1a, {
- description: 'indescribable'
- });
- values.addValue(barA);
- barA.diagnostics.add(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, new tr.v.d.IterationInfo({
- label: 'iteration A',
- benchmarkStartMs: new Date().getTime(),
- }));
-
- var numeric0b = TEST_NUMERIC_BUILDER.build();
- for (var i = 0; i < 1e2; ++i) {
- numeric0b.add(Math.random() * 1000);
- }
- var fooB = new tr.v.NumericValue('foo', numeric0b, {
- description: 'they should have sent a poet'
- });
- values.addValue(fooB);
- fooB.diagnostics.add(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, new tr.v.d.IterationInfo({
- label: 'iteration B',
- benchmarkStartMs: new Date().getTime(),
- }));
-
- var numeric1b = TEST_NUMERIC_BUILDER.build();
- for (var i = 0; i < 1e2; ++i) {
- numeric1b.add(Math.random() * 1000);
- }
- var barB = new tr.v.NumericValue('bar', numeric1b, {
- description: 'indescribable'
- });
- values.addValue(barB);
- barB.diagnostics.add(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, new tr.v.d.IterationInfo({
- label: 'iteration B',
- benchmarkStartMs: new Date().getTime(),
- }));
-
- table.values = values;
- this.addHTMLOutput(table);
- // XXX test multi-col
- // XXX test selection
- // XXX test sorting by name, valueA, valueB
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_view.html b/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_view.html
deleted file mode 100644
index 9a773957e74..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_view.html
+++ /dev/null
@@ -1,87 +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/ui/base/polymer_utils.html">
-<link rel="import" href="/tracing/ui/base/tab_view.html">
-
-<polymer-element name='tr-v-ui-value-set-view'>
- <template>
- <tr-ui-a-tab-view id="container"></tr-ui-a-tab-view>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-tr.exportTo('tr.ui', function() {
- var VALUE_SET_VIEW_ELEMENT_NAMES = [];
-
- var SELECTED_TAB_SETTINGS_KEY = 'tr-v-ui-value-set-view-element-name';
-
- Polymer('tr-v-ui-value-set-view', {
- ready: function() {
- this.$.container.addEventListener(
- 'selected-tab-change', this.onSelectedTabChange_.bind(this));
- },
-
- onSelectedTabChange_: function() {
- if (!this.$.container.selectedTab)
- return;
-
- tr.b.Settings.set(
- SELECTED_TAB_SETTINGS_KEY,
- this.$.container.selectedTab.tagName.toLowerCase());
- },
-
- /**
- * @param {!tr.v.ValueSet} values
- */
- set values(values) {
- this.$.container.textContent = '';
-
- var initialTabElementName = tr.b.Settings.get(
- SELECTED_TAB_SETTINGS_KEY, undefined);
-
- VALUE_SET_VIEW_ELEMENT_NAMES.forEach(function(elementName, index) {
- var view = document.createElement(elementName);
- if (!view.supportsValueSet(values))
- return;
-
- view.values = values;
-
- if (elementName.toLowerCase() === initialTabElementName)
- view.setAttribute('selected', true);
-
- view.setAttribute('tab-label', view.tabLabel);
-
- this.$.container.appendChild(view);
- }, this);
-
- if (this.$.container.children.length === 1) {
- this.$.container.tabsHidden = true;
- } else if (this.$.container.selectedTab === undefined) {
- this.$.container.children[0].setAttribute('selected', true);
- }
- }
- });
-
- /**
- * Register the name of a polymer element that supports displaying ValueSets.
- *
- * @param {string} elementName
- */
- function registerValueSetView(elementName) {
- if (!tr.ui.b.getPolymerElementNamed(elementName))
- throw new Error('Element not registered: ' + elementName);
-
- VALUE_SET_VIEW_ELEMENT_NAMES.push(elementName);
- }
-
- return {
- registerValueSetView: registerValueSetView
- };
-});
-</script>