| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 Timeline.TimelineTreeView = class extends UI.VBox { | 8 Timeline.TimelineTreeView = class extends UI.VBox { |
| 9 constructor() { | 9 constructor() { |
| 10 super(); | 10 super(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 */ | 46 */ |
| 47 init(filters) { | 47 init(filters) { |
| 48 this._linkifier = new Components.Linkifier(); | 48 this._linkifier = new Components.Linkifier(); |
| 49 | 49 |
| 50 this._filters = filters.slice(); | 50 this._filters = filters.slice(); |
| 51 | 51 |
| 52 const columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ (
[]); | 52 const columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ (
[]); |
| 53 this.populateColumns(columns); | 53 this.populateColumns(columns); |
| 54 | 54 |
| 55 this._splitWidget = new UI.SplitWidget(true, true, 'timelineTreeViewDetailsS
plitWidget'); | 55 this._splitWidget = new UI.SplitWidget(true, true, 'timelineTreeViewDetailsS
plitWidget'); |
| 56 const mainView = new UI.VBox(); | 56 var mainView = new UI.VBox(); |
| 57 this._populateToolbar(mainView.element); | 57 var toolbar = new UI.Toolbar('', mainView.element); |
| 58 this._populateToolbar(toolbar); |
| 58 | 59 |
| 59 this._dataGrid = new DataGrid.SortableDataGrid(columns); | 60 this._dataGrid = new DataGrid.SortableDataGrid(columns); |
| 60 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi
s._sortingChanged, this); | 61 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi
s._sortingChanged, this); |
| 61 this._dataGrid.element.addEventListener('mousemove', this._onMouseMove.bind(
this), true); | 62 this._dataGrid.element.addEventListener('mousemove', this._onMouseMove.bind(
this), true); |
| 62 this._dataGrid.setResizeMethod(DataGrid.DataGrid.ResizeMethod.Last); | 63 this._dataGrid.setResizeMethod(DataGrid.DataGrid.ResizeMethod.Last); |
| 63 this._dataGrid.setRowContextMenuCallback(this._onContextMenu.bind(this)); | 64 this._dataGrid.setRowContextMenuCallback(this._onContextMenu.bind(this)); |
| 64 this._dataGrid.asWidget().show(mainView.element); | 65 this._dataGrid.asWidget().show(mainView.element); |
| 65 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this.
_updateDetailsForSelection, this); | 66 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this.
_updateDetailsForSelection, this); |
| 66 | 67 |
| 67 this._detailsView = new UI.VBox(); | 68 this._detailsView = new UI.VBox(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 102 } |
| 102 | 103 |
| 103 /** | 104 /** |
| 104 * @return {boolean} | 105 * @return {boolean} |
| 105 */ | 106 */ |
| 106 _exposePercentages() { | 107 _exposePercentages() { |
| 107 return false; | 108 return false; |
| 108 } | 109 } |
| 109 | 110 |
| 110 /** | 111 /** |
| 111 * @param {!Element} parent | 112 * @param {!UI.Toolbar} toolbar |
| 112 */ | 113 */ |
| 113 _populateToolbar(parent) { | 114 _populateToolbar(toolbar) { |
| 114 } | 115 } |
| 115 | 116 |
| 116 /** | 117 /** |
| 117 * @param {?TimelineModel.TimelineProfileTree.Node} node | 118 * @param {?TimelineModel.TimelineProfileTree.Node} node |
| 118 */ | 119 */ |
| 119 _onHover(node) { | 120 _onHover(node) { |
| 120 } | 121 } |
| 121 | 122 |
| 122 /** | 123 /** |
| 123 * @param {!UI.ContextMenu} contextMenu | 124 * @param {!UI.ContextMenu} contextMenu |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 return new TimelineModel.TimelineProfileTree.TopDownRootNode( | 203 return new TimelineModel.TimelineProfileTree.TopDownRootNode( |
| 203 this._model.timelineModel().mainThreadEvents(), this._filters, this._sta
rtTime, this._endTime, doNotAggregate, | 204 this._model.timelineModel().mainThreadEvents(), this._filters, this._sta
rtTime, this._endTime, doNotAggregate, |
| 204 groupIdCallback); | 205 groupIdCallback); |
| 205 } | 206 } |
| 206 | 207 |
| 207 /** | 208 /** |
| 208 * @protected | 209 * @protected |
| 209 * @param {!Array<!DataGrid.DataGrid.ColumnDescriptor>} columns | 210 * @param {!Array<!DataGrid.DataGrid.ColumnDescriptor>} columns |
| 210 */ | 211 */ |
| 211 populateColumns(columns) { | 212 populateColumns(columns) { |
| 212 columns.push({id: 'self', title: Common.UIString('Self Time'), width: '110px
', fixedWidth: true, sortable: true}); | 213 columns.push({id: 'self', title: Common.UIString('Self Time'), width: '120px
', fixedWidth: true, sortable: true}); |
| 213 columns.push({id: 'total', title: Common.UIString('Total Time'), width: '110
px', fixedWidth: true, sortable: true}); | 214 columns.push({id: 'total', title: Common.UIString('Total Time'), width: '120
px', fixedWidth: true, sortable: true}); |
| 214 columns.push({id: 'activity', title: Common.UIString('Activity'), disclosure
: true, sortable: true}); | 215 columns.push({id: 'activity', title: Common.UIString('Activity'), disclosure
: true, sortable: true}); |
| 215 } | 216 } |
| 216 | 217 |
| 217 _sortingChanged() { | 218 _sortingChanged() { |
| 218 var columnId = this._dataGrid.sortColumnId(); | 219 var columnId = this._dataGrid.sortColumnId(); |
| 219 if (!columnId) | 220 if (!columnId) |
| 220 return; | 221 return; |
| 221 var sortFunction; | 222 var sortFunction; |
| 222 switch (columnId) { | 223 switch (columnId) { |
| 223 case 'startTime': | 224 case 'startTime': |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 return {name: frameName, color: color}; | 565 return {name: frameName, color: color}; |
| 565 | 566 |
| 566 default: | 567 default: |
| 567 console.assert(false, 'Unexpected aggregation type'); | 568 console.assert(false, 'Unexpected aggregation type'); |
| 568 } | 569 } |
| 569 return {name: node.id || Common.UIString('unattributed'), color: color}; | 570 return {name: node.id || Common.UIString('unattributed'), color: color}; |
| 570 } | 571 } |
| 571 | 572 |
| 572 /** | 573 /** |
| 573 * @override | 574 * @override |
| 574 * @param {!Element} parent | 575 * @param {!UI.Toolbar} toolbar |
| 575 */ | 576 */ |
| 576 _populateToolbar(parent) { | 577 _populateToolbar(toolbar) { |
| 577 var panelToolbar = new UI.Toolbar('', parent); | |
| 578 this._groupByCombobox = new UI.ToolbarComboBox(this._onGroupByChanged.bind(t
his)); | 578 this._groupByCombobox = new UI.ToolbarComboBox(this._onGroupByChanged.bind(t
his)); |
| 579 /** | 579 /** |
| 580 * @param {string} name | 580 * @param {string} name |
| 581 * @param {string} id | 581 * @param {string} id |
| 582 * @this {Timeline.TimelineTreeView} | 582 * @this {Timeline.TimelineTreeView} |
| 583 */ | 583 */ |
| 584 function addGroupingOption(name, id) { | 584 function addGroupingOption(name, id) { |
| 585 var option = this._groupByCombobox.createOption(name, '', id); | 585 var option = this._groupByCombobox.createOption(name, '', id); |
| 586 this._groupByCombobox.addOption(option); | 586 this._groupByCombobox.addOption(option); |
| 587 if (id === this._groupBySetting.get()) | 587 if (id === this._groupBySetting.get()) |
| 588 this._groupByCombobox.select(option); | 588 this._groupByCombobox.select(option); |
| 589 } | 589 } |
| 590 const groupBy = Timeline.AggregatedTimelineTreeView.GroupBy; | 590 const groupBy = Timeline.AggregatedTimelineTreeView.GroupBy; |
| 591 addGroupingOption.call(this, Common.UIString('No Grouping'), groupBy.None); | 591 addGroupingOption.call(this, Common.UIString('No Grouping'), groupBy.None); |
| 592 addGroupingOption.call(this, Common.UIString('Group by Activity'), groupBy.E
ventName); | 592 addGroupingOption.call(this, Common.UIString('Group by Activity'), groupBy.E
ventName); |
| 593 addGroupingOption.call(this, Common.UIString('Group by Category'), groupBy.C
ategory); | 593 addGroupingOption.call(this, Common.UIString('Group by Category'), groupBy.C
ategory); |
| 594 addGroupingOption.call(this, Common.UIString('Group by Domain'), groupBy.Dom
ain); | 594 addGroupingOption.call(this, Common.UIString('Group by Domain'), groupBy.Dom
ain); |
| 595 addGroupingOption.call(this, Common.UIString('Group by Subdomain'), groupBy.
Subdomain); | 595 addGroupingOption.call(this, Common.UIString('Group by Subdomain'), groupBy.
Subdomain); |
| 596 addGroupingOption.call(this, Common.UIString('Group by URL'), groupBy.URL); | 596 addGroupingOption.call(this, Common.UIString('Group by URL'), groupBy.URL); |
| 597 addGroupingOption.call(this, Common.UIString('Group by Frame'), groupBy.Fram
e); | 597 addGroupingOption.call(this, Common.UIString('Group by Frame'), groupBy.Fram
e); |
| 598 panelToolbar.appendToolbarItem(this._groupByCombobox); | 598 toolbar.appendToolbarItem(this._groupByCombobox); |
| 599 panelToolbar.appendSpacer(); | 599 toolbar.appendSpacer(); |
| 600 panelToolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton
(Common.UIString('heaviest stack'))); | 600 toolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton(Comm
on.UIString('heaviest stack'))); |
| 601 } | 601 } |
| 602 | 602 |
| 603 /** | 603 /** |
| 604 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode | 604 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode |
| 605 * @return {!Array<!TimelineModel.TimelineProfileTree.Node>} | 605 * @return {!Array<!TimelineModel.TimelineProfileTree.Node>} |
| 606 */ | 606 */ |
| 607 _buildHeaviestStack(treeNode) { | 607 _buildHeaviestStack(treeNode) { |
| 608 console.assert(!!treeNode.parent, 'Attempt to build stack for tree root'); | 608 console.assert(!!treeNode.parent, 'Attempt to build stack for tree root'); |
| 609 var result = []; | 609 var result = []; |
| 610 // Do not add root to the stack, as it's the tree itself. | 610 // Do not add root to the stack, as it's the tree itself. |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 | 848 |
| 849 _onSelectionChanged() { | 849 _onSelectionChanged() { |
| 850 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); | 850 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); |
| 851 } | 851 } |
| 852 }; | 852 }; |
| 853 | 853 |
| 854 /** @enum {symbol} */ | 854 /** @enum {symbol} */ |
| 855 Timeline.TimelineStackView.Events = { | 855 Timeline.TimelineStackView.Events = { |
| 856 SelectionChanged: Symbol('SelectionChanged') | 856 SelectionChanged: Symbol('SelectionChanged') |
| 857 }; | 857 }; |
| OLD | NEW |