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 20 matching lines...) Expand all Loading... |
31 init(model, filters) { | 31 init(model, filters) { |
32 this._model = model; | 32 this._model = model; |
33 this._linkifier = new Components.Linkifier(); | 33 this._linkifier = new Components.Linkifier(); |
34 | 34 |
35 this._filters = filters.slice(); | 35 this._filters = filters.slice(); |
36 | 36 |
37 const columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ (
[]); | 37 const columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ (
[]); |
38 this.populateColumns(columns); | 38 this.populateColumns(columns); |
39 | 39 |
40 this._splitWidget = new UI.SplitWidget(true, true, 'timelineTreeViewDetailsS
plitWidget'); | 40 this._splitWidget = new UI.SplitWidget(true, true, 'timelineTreeViewDetailsS
plitWidget'); |
41 const mainView = new UI.VBox(); | 41 var mainView = new UI.VBox(); |
42 this._populateToolbar(mainView.element); | 42 var toolbar = new UI.Toolbar('', mainView.element); |
| 43 this._populateToolbar(toolbar); |
43 | 44 |
44 this._dataGrid = new DataGrid.SortableDataGrid(columns); | 45 this._dataGrid = new DataGrid.SortableDataGrid(columns); |
45 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi
s._sortingChanged, this); | 46 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi
s._sortingChanged, this); |
46 this._dataGrid.element.addEventListener('mousemove', this._onMouseMove.bind(
this), true); | 47 this._dataGrid.element.addEventListener('mousemove', this._onMouseMove.bind(
this), true); |
47 this._dataGrid.setResizeMethod(DataGrid.DataGrid.ResizeMethod.Last); | 48 this._dataGrid.setResizeMethod(DataGrid.DataGrid.ResizeMethod.Last); |
48 this._dataGrid.setRowContextMenuCallback(this._onContextMenu.bind(this)); | 49 this._dataGrid.setRowContextMenuCallback(this._onContextMenu.bind(this)); |
49 this._dataGrid.asWidget().show(mainView.element); | 50 this._dataGrid.asWidget().show(mainView.element); |
50 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this.
_updateDetailsForSelection, this); | 51 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this.
_updateDetailsForSelection, this); |
51 | 52 |
52 this._detailsView = new UI.VBox(); | 53 this._detailsView = new UI.VBox(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 87 } |
87 | 88 |
88 /** | 89 /** |
89 * @return {boolean} | 90 * @return {boolean} |
90 */ | 91 */ |
91 _exposePercentages() { | 92 _exposePercentages() { |
92 return false; | 93 return false; |
93 } | 94 } |
94 | 95 |
95 /** | 96 /** |
96 * @param {!Element} parent | 97 * @param {!UI.Toolbar} toolbar |
97 */ | 98 */ |
98 _populateToolbar(parent) { | 99 _populateToolbar(toolbar) { |
99 } | 100 } |
100 | 101 |
101 /** | 102 /** |
102 * @param {?TimelineModel.TimelineProfileTree.Node} node | 103 * @param {?TimelineModel.TimelineProfileTree.Node} node |
103 */ | 104 */ |
104 _onHover(node) { | 105 _onHover(node) { |
105 } | 106 } |
106 | 107 |
107 /** | 108 /** |
108 * @param {!UI.ContextMenu} contextMenu | 109 * @param {!UI.ContextMenu} contextMenu |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 buildTopDownTree(doNotAggregate, groupIdCallback) { | 185 buildTopDownTree(doNotAggregate, groupIdCallback) { |
185 return new TimelineModel.TimelineProfileTree.TopDownRootNode( | 186 return new TimelineModel.TimelineProfileTree.TopDownRootNode( |
186 this._model.mainThreadEvents(), this._filters, this._startTime, this._en
dTime, doNotAggregate, groupIdCallback); | 187 this._model.mainThreadEvents(), this._filters, this._startTime, this._en
dTime, doNotAggregate, groupIdCallback); |
187 } | 188 } |
188 | 189 |
189 /** | 190 /** |
190 * @protected | 191 * @protected |
191 * @param {!Array<!DataGrid.DataGrid.ColumnDescriptor>} columns | 192 * @param {!Array<!DataGrid.DataGrid.ColumnDescriptor>} columns |
192 */ | 193 */ |
193 populateColumns(columns) { | 194 populateColumns(columns) { |
194 columns.push({id: 'self', title: Common.UIString('Self Time'), width: '110px
', fixedWidth: true, sortable: true}); | 195 columns.push({id: 'self', title: Common.UIString('Self Time'), width: '120px
', fixedWidth: true, sortable: true}); |
195 columns.push({id: 'total', title: Common.UIString('Total Time'), width: '110
px', fixedWidth: true, sortable: true}); | 196 columns.push({id: 'total', title: Common.UIString('Total Time'), width: '120
px', fixedWidth: true, sortable: true}); |
196 columns.push({id: 'activity', title: Common.UIString('Activity'), disclosure
: true, sortable: true}); | 197 columns.push({id: 'activity', title: Common.UIString('Activity'), disclosure
: true, sortable: true}); |
197 } | 198 } |
198 | 199 |
199 _sortingChanged() { | 200 _sortingChanged() { |
200 var columnId = this._dataGrid.sortColumnId(); | 201 var columnId = this._dataGrid.sortColumnId(); |
201 if (!columnId) | 202 if (!columnId) |
202 return; | 203 return; |
203 var sortFunction; | 204 var sortFunction; |
204 switch (columnId) { | 205 switch (columnId) { |
205 case 'startTime': | 206 case 'startTime': |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 return {name: frameName, color: color}; | 548 return {name: frameName, color: color}; |
548 | 549 |
549 default: | 550 default: |
550 console.assert(false, 'Unexpected aggregation type'); | 551 console.assert(false, 'Unexpected aggregation type'); |
551 } | 552 } |
552 return {name: node.id || Common.UIString('unattributed'), color: color}; | 553 return {name: node.id || Common.UIString('unattributed'), color: color}; |
553 } | 554 } |
554 | 555 |
555 /** | 556 /** |
556 * @override | 557 * @override |
557 * @param {!Element} parent | 558 * @param {!UI.Toolbar} toolbar |
558 */ | 559 */ |
559 _populateToolbar(parent) { | 560 _populateToolbar(toolbar) { |
560 var panelToolbar = new UI.Toolbar('', parent); | |
561 this._groupByCombobox = new UI.ToolbarComboBox(this._onGroupByChanged.bind(t
his)); | 561 this._groupByCombobox = new UI.ToolbarComboBox(this._onGroupByChanged.bind(t
his)); |
562 /** | 562 /** |
563 * @param {string} name | 563 * @param {string} name |
564 * @param {string} id | 564 * @param {string} id |
565 * @this {Timeline.TimelineTreeView} | 565 * @this {Timeline.TimelineTreeView} |
566 */ | 566 */ |
567 function addGroupingOption(name, id) { | 567 function addGroupingOption(name, id) { |
568 var option = this._groupByCombobox.createOption(name, '', id); | 568 var option = this._groupByCombobox.createOption(name, '', id); |
569 this._groupByCombobox.addOption(option); | 569 this._groupByCombobox.addOption(option); |
570 if (id === this._groupBySetting.get()) | 570 if (id === this._groupBySetting.get()) |
571 this._groupByCombobox.select(option); | 571 this._groupByCombobox.select(option); |
572 } | 572 } |
573 const groupBy = Timeline.AggregatedTimelineTreeView.GroupBy; | 573 const groupBy = Timeline.AggregatedTimelineTreeView.GroupBy; |
574 addGroupingOption.call(this, Common.UIString('No Grouping'), groupBy.None); | 574 addGroupingOption.call(this, Common.UIString('No Grouping'), groupBy.None); |
575 addGroupingOption.call(this, Common.UIString('Group by Activity'), groupBy.E
ventName); | 575 addGroupingOption.call(this, Common.UIString('Group by Activity'), groupBy.E
ventName); |
576 addGroupingOption.call(this, Common.UIString('Group by Category'), groupBy.C
ategory); | 576 addGroupingOption.call(this, Common.UIString('Group by Category'), groupBy.C
ategory); |
577 addGroupingOption.call(this, Common.UIString('Group by Domain'), groupBy.Dom
ain); | 577 addGroupingOption.call(this, Common.UIString('Group by Domain'), groupBy.Dom
ain); |
578 addGroupingOption.call(this, Common.UIString('Group by Subdomain'), groupBy.
Subdomain); | 578 addGroupingOption.call(this, Common.UIString('Group by Subdomain'), groupBy.
Subdomain); |
579 addGroupingOption.call(this, Common.UIString('Group by URL'), groupBy.URL); | 579 addGroupingOption.call(this, Common.UIString('Group by URL'), groupBy.URL); |
580 addGroupingOption.call(this, Common.UIString('Group by Frame'), groupBy.Fram
e); | 580 addGroupingOption.call(this, Common.UIString('Group by Frame'), groupBy.Fram
e); |
581 panelToolbar.appendToolbarItem(this._groupByCombobox); | 581 toolbar.appendToolbarItem(this._groupByCombobox); |
582 panelToolbar.appendSpacer(); | 582 toolbar.appendSpacer(); |
583 panelToolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton
(Common.UIString('heaviest stack'))); | 583 toolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton(Comm
on.UIString('heaviest stack'))); |
584 } | 584 } |
585 | 585 |
586 /** | 586 /** |
587 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode | 587 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode |
588 * @return {!Array<!TimelineModel.TimelineProfileTree.Node>} | 588 * @return {!Array<!TimelineModel.TimelineProfileTree.Node>} |
589 */ | 589 */ |
590 _buildHeaviestStack(treeNode) { | 590 _buildHeaviestStack(treeNode) { |
591 console.assert(!!treeNode.parent, 'Attempt to build stack for tree root'); | 591 console.assert(!!treeNode.parent, 'Attempt to build stack for tree root'); |
592 var result = []; | 592 var result = []; |
593 // Do not add root to the stack, as it's the tree itself. | 593 // Do not add root to the stack, as it's the tree itself. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 | 833 |
834 _onSelectionChanged() { | 834 _onSelectionChanged() { |
835 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); | 835 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); |
836 } | 836 } |
837 }; | 837 }; |
838 | 838 |
839 /** @enum {symbol} */ | 839 /** @enum {symbol} */ |
840 Timeline.TimelineStackView.Events = { | 840 Timeline.TimelineStackView.Events = { |
841 SelectionChanged: Symbol('SelectionChanged') | 841 SelectionChanged: Symbol('SelectionChanged') |
842 }; | 842 }; |
OLD | NEW |