| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Timeline.TimelineTreeView = class extends UI.VBox { | 7 Timeline.TimelineTreeView = class extends UI.VBox { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 this.element.classList.add('timeline-tree-view'); | 10 this.element.classList.add('timeline-tree-view'); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 /** | 25 /** |
| 26 * @param {!TimelineModel.TimelineModel} model | 26 * @param {!TimelineModel.TimelineModel} model |
| 27 * @param {!Array<!TimelineModel.TimelineModel.Filter>} filters | 27 * @param {!Array<!TimelineModel.TimelineModel.Filter>} filters |
| 28 */ | 28 */ |
| 29 _init(model, filters) { | 29 _init(model, filters) { |
| 30 this._model = model; | 30 this._model = model; |
| 31 this._linkifier = new Components.Linkifier(); | 31 this._linkifier = new Components.Linkifier(); |
| 32 | 32 |
| 33 this._filters = filters.slice(); | 33 this._filters = filters.slice(); |
| 34 | 34 |
| 35 const columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ (
[]); | 35 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([]
); |
| 36 this._populateColumns(columns); | 36 this._populateColumns(columns); |
| 37 | 37 |
| 38 this._splitWidget = new UI.SplitWidget(true, true, 'timelineTreeViewDetailsS
plitWidget'); | 38 var mainView = new UI.VBox(); |
| 39 const mainView = new UI.VBox(); | |
| 40 this._populateToolbar(mainView.element); | 39 this._populateToolbar(mainView.element); |
| 41 | |
| 42 this._dataGrid = new DataGrid.SortableDataGrid(columns); | 40 this._dataGrid = new DataGrid.SortableDataGrid(columns); |
| 43 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi
s._sortingChanged, this); | 41 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi
s._sortingChanged, this); |
| 44 this._dataGrid.element.addEventListener('mousemove', this._onMouseMove.bind(
this), true); | 42 this._dataGrid.element.addEventListener('mousemove', this._onMouseMove.bind(
this), true); |
| 45 this._dataGrid.setResizeMethod(DataGrid.DataGrid.ResizeMethod.Last); | 43 this._dataGrid.setResizeMethod(DataGrid.DataGrid.ResizeMethod.Last); |
| 46 this._dataGrid.setRowContextMenuCallback(this._onContextMenu.bind(this)); | 44 this._dataGrid.setRowContextMenuCallback(this._onContextMenu.bind(this)); |
| 47 this._dataGrid.asWidget().show(mainView.element); | 45 this._dataGrid.asWidget().show(mainView.element); |
| 48 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this.
_updateDetailsForSelection, this); | 46 |
| 47 this._splitWidget = new UI.SplitWidget(true, true, 'timelineTreeViewDetailsS
plitWidget'); |
| 48 this._splitWidget.show(this.element); |
| 49 this._splitWidget.setMainWidget(mainView); |
| 49 | 50 |
| 50 this._detailsView = new UI.VBox(); | 51 this._detailsView = new UI.VBox(); |
| 51 this._detailsView.element.classList.add('timeline-details-view', 'timeline-d
etails-view-body'); | 52 this._detailsView.element.classList.add('timeline-details-view', 'timeline-d
etails-view-body'); |
| 52 this._splitWidget.setMainWidget(mainView); | |
| 53 this._splitWidget.setSidebarWidget(this._detailsView); | 53 this._splitWidget.setSidebarWidget(this._detailsView); |
| 54 this._splitWidget.hideSidebar(); | 54 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this.
_updateDetailsForSelection, this); |
| 55 this._splitWidget.show(this.element); | |
| 56 | 55 |
| 57 /** @type {?TimelineModel.TimelineProfileTree.Node|undefined} */ | 56 /** @type {?TimelineModel.TimelineProfileTree.Node|undefined} */ |
| 58 this._lastSelectedNode; | 57 this._lastSelectedNode; |
| 59 } | 58 } |
| 60 | 59 |
| 61 /** | 60 /** |
| 62 * @param {!Timeline.TimelineSelection} selection | 61 * @param {!Timeline.TimelineSelection} selection |
| 63 */ | 62 */ |
| 64 updateContents(selection) { | 63 updateContents(selection) { |
| 65 this.setRange(selection.startTime(), selection.endTime()); | 64 this.setRange(selection.startTime(), selection.endTime()); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 } | 556 } |
| 558 const groupBy = Timeline.AggregatedTimelineTreeView.GroupBy; | 557 const groupBy = Timeline.AggregatedTimelineTreeView.GroupBy; |
| 559 addGroupingOption.call(this, Common.UIString('No Grouping'), groupBy.None); | 558 addGroupingOption.call(this, Common.UIString('No Grouping'), groupBy.None); |
| 560 addGroupingOption.call(this, Common.UIString('Group by Activity'), groupBy.E
ventName); | 559 addGroupingOption.call(this, Common.UIString('Group by Activity'), groupBy.E
ventName); |
| 561 addGroupingOption.call(this, Common.UIString('Group by Category'), groupBy.C
ategory); | 560 addGroupingOption.call(this, Common.UIString('Group by Category'), groupBy.C
ategory); |
| 562 addGroupingOption.call(this, Common.UIString('Group by Domain'), groupBy.Dom
ain); | 561 addGroupingOption.call(this, Common.UIString('Group by Domain'), groupBy.Dom
ain); |
| 563 addGroupingOption.call(this, Common.UIString('Group by Subdomain'), groupBy.
Subdomain); | 562 addGroupingOption.call(this, Common.UIString('Group by Subdomain'), groupBy.
Subdomain); |
| 564 addGroupingOption.call(this, Common.UIString('Group by URL'), groupBy.URL); | 563 addGroupingOption.call(this, Common.UIString('Group by URL'), groupBy.URL); |
| 565 addGroupingOption.call(this, Common.UIString('Group by Frame'), groupBy.Fram
e); | 564 addGroupingOption.call(this, Common.UIString('Group by Frame'), groupBy.Fram
e); |
| 566 panelToolbar.appendToolbarItem(this._groupByCombobox); | 565 panelToolbar.appendToolbarItem(this._groupByCombobox); |
| 567 panelToolbar.appendSpacer(); | |
| 568 panelToolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton
(Common.UIString('heaviest stack'))); | |
| 569 } | 566 } |
| 570 | 567 |
| 571 /** | 568 /** |
| 572 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode | 569 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode |
| 573 * @return {!Array<!TimelineModel.TimelineProfileTree.Node>} | 570 * @return {!Array<!TimelineModel.TimelineProfileTree.Node>} |
| 574 */ | 571 */ |
| 575 _buildHeaviestStack(treeNode) { | 572 _buildHeaviestStack(treeNode) { |
| 576 console.assert(!!treeNode.parent, 'Attempt to build stack for tree root'); | 573 console.assert(!!treeNode.parent, 'Attempt to build stack for tree root'); |
| 577 var result = []; | 574 var result = []; |
| 578 // Do not add root to the stack, as it's the tree itself. | 575 // Do not add root to the stack, as it's the tree itself. |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 | 950 |
| 954 _onSelectionChanged() { | 951 _onSelectionChanged() { |
| 955 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); | 952 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); |
| 956 } | 953 } |
| 957 }; | 954 }; |
| 958 | 955 |
| 959 /** @enum {symbol} */ | 956 /** @enum {symbol} */ |
| 960 Timeline.TimelineStackView.Events = { | 957 Timeline.TimelineStackView.Events = { |
| 961 SelectionChanged: Symbol('SelectionChanged') | 958 SelectionChanged: Symbol('SelectionChanged') |
| 962 }; | 959 }; |
| OLD | NEW |