| 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 * @implements {UI.Searchable} | 7 * @implements {UI.Searchable} |
| 8 */ | 8 */ |
| 9 Timeline.TimelineTreeView = class extends UI.VBox { | 9 Timeline.TimelineTreeView = class extends UI.VBox { |
| 10 constructor() { | 10 constructor() { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 this._searchableView.cancelSearch(); | 242 this._searchableView.cancelSearch(); |
| 243 this._dataGrid.rootNode().removeChildren(); | 243 this._dataGrid.rootNode().removeChildren(); |
| 244 if (!this._model) { | 244 if (!this._model) { |
| 245 this._updateDetailsForSelection(); | 245 this._updateDetailsForSelection(); |
| 246 return; | 246 return; |
| 247 } | 247 } |
| 248 this._root = this._buildTree(); | 248 this._root = this._buildTree(); |
| 249 var children = this._root.children(); | 249 var children = this._root.children(); |
| 250 var maxSelfTime = 0; | 250 var maxSelfTime = 0; |
| 251 var maxTotalTime = 0; | 251 var maxTotalTime = 0; |
| 252 var totalUsedTime = this._root.totalTime - this._root.selfTime; |
| 252 for (var child of children.values()) { | 253 for (var child of children.values()) { |
| 253 maxSelfTime = Math.max(maxSelfTime, child.selfTime); | 254 maxSelfTime = Math.max(maxSelfTime, child.selfTime); |
| 254 maxTotalTime = Math.max(maxTotalTime, child.totalTime); | 255 maxTotalTime = Math.max(maxTotalTime, child.totalTime); |
| 255 } | 256 } |
| 256 for (var child of children.values()) { | 257 for (var child of children.values()) { |
| 257 // Exclude the idle time off the total calculation. | 258 // Exclude the idle time off the total calculation. |
| 258 var gridNode = | 259 var gridNode = new Timeline.TimelineTreeView.TreeGridNode(child, totalUsed
Time, maxSelfTime, maxTotalTime, this); |
| 259 new Timeline.TimelineTreeView.TreeGridNode(child, this._root.totalTime
, maxSelfTime, maxTotalTime, this); | |
| 260 this._dataGrid.insertChild(gridNode); | 260 this._dataGrid.insertChild(gridNode); |
| 261 } | 261 } |
| 262 this._sortingChanged(); | 262 this._sortingChanged(); |
| 263 this._updateDetailsForSelection(); | 263 this._updateDetailsForSelection(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 /** | 266 /** |
| 267 * @return {!TimelineModel.TimelineProfileTree.Node} | 267 * @return {!TimelineModel.TimelineProfileTree.Node} |
| 268 */ | 268 */ |
| 269 _buildTree() { | 269 _buildTree() { |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 return groupByDomain.bind(null, true); | 837 return groupByDomain.bind(null, true); |
| 838 case Timeline.AggregatedTimelineTreeView.GroupBy.URL: | 838 case Timeline.AggregatedTimelineTreeView.GroupBy.URL: |
| 839 return groupByURL; | 839 return groupByURL; |
| 840 case Timeline.AggregatedTimelineTreeView.GroupBy.Frame: | 840 case Timeline.AggregatedTimelineTreeView.GroupBy.Frame: |
| 841 return event => TimelineModel.TimelineData.forEvent(event).frameId; | 841 return event => TimelineModel.TimelineData.forEvent(event).frameId; |
| 842 default: | 842 default: |
| 843 console.assert(false, `Unexpected aggregation setting: ${groupBy}`); | 843 console.assert(false, `Unexpected aggregation setting: ${groupBy}`); |
| 844 return null; | 844 return null; |
| 845 } | 845 } |
| 846 } | 846 } |
| 847 |
| 847 /** | 848 /** |
| 848 * @override | 849 * @override |
| 849 * @param {!UI.ContextMenu} contextMenu | 850 * @param {!UI.ContextMenu} contextMenu |
| 850 * @param {!TimelineModel.TimelineProfileTree.Node} node | 851 * @param {!TimelineModel.TimelineProfileTree.Node} node |
| 851 */ | 852 */ |
| 852 _appendContextMenuItems(contextMenu, node) { | 853 _appendContextMenuItems(contextMenu, node) { |
| 853 if (this._groupBySetting.get() !== Timeline.AggregatedTimelineTreeView.Group
By.Frame) | 854 if (this._groupBySetting.get() !== Timeline.AggregatedTimelineTreeView.Group
By.Frame) |
| 854 return; | 855 return; |
| 855 if (!node.isGroupNode()) | 856 if (!node.isGroupNode()) |
| 856 return; | 857 return; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 | 986 |
| 986 _onSelectionChanged() { | 987 _onSelectionChanged() { |
| 987 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); | 988 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); |
| 988 } | 989 } |
| 989 }; | 990 }; |
| 990 | 991 |
| 991 /** @enum {symbol} */ | 992 /** @enum {symbol} */ |
| 992 Timeline.TimelineStackView.Events = { | 993 Timeline.TimelineStackView.Events = { |
| 993 SelectionChanged: Symbol('SelectionChanged') | 994 SelectionChanged: Symbol('SelectionChanged') |
| 994 }; | 995 }; |
| OLD | NEW |