| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 gridNode.reveal(); | 231 gridNode.reveal(); |
| 232 gridNode.select(suppressSelectedEvent); | 232 gridNode.select(suppressSelectedEvent); |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 /** | 236 /** |
| 237 * @protected | 237 * @protected |
| 238 */ | 238 */ |
| 239 refreshTree() { | 239 refreshTree() { |
| 240 this._linkifier.reset(); | 240 this._linkifier.reset(); |
| 241 if (this._searchableView) | |
| 242 this._searchableView.cancelSearch(); | |
| 243 this._dataGrid.rootNode().removeChildren(); | 241 this._dataGrid.rootNode().removeChildren(); |
| 244 if (!this._model) { | 242 if (!this._model) { |
| 245 this._updateDetailsForSelection(); | 243 this._updateDetailsForSelection(); |
| 246 return; | 244 return; |
| 247 } | 245 } |
| 248 this._root = this._buildTree(); | 246 this._root = this._buildTree(); |
| 249 var children = this._root.children(); | 247 var children = this._root.children(); |
| 250 var maxSelfTime = 0; | 248 var maxSelfTime = 0; |
| 251 var maxTotalTime = 0; | 249 var maxTotalTime = 0; |
| 252 var totalUsedTime = this._root.totalTime - this._root.selfTime; | 250 var totalUsedTime = this._root.totalTime - this._root.selfTime; |
| 253 for (var child of children.values()) { | 251 for (var child of children.values()) { |
| 254 maxSelfTime = Math.max(maxSelfTime, child.selfTime); | 252 maxSelfTime = Math.max(maxSelfTime, child.selfTime); |
| 255 maxTotalTime = Math.max(maxTotalTime, child.totalTime); | 253 maxTotalTime = Math.max(maxTotalTime, child.totalTime); |
| 256 } | 254 } |
| 257 for (var child of children.values()) { | 255 for (var child of children.values()) { |
| 258 // Exclude the idle time off the total calculation. | 256 // Exclude the idle time off the total calculation. |
| 259 var gridNode = new Timeline.TimelineTreeView.TreeGridNode(child, totalUsed
Time, maxSelfTime, maxTotalTime, this); | 257 var gridNode = new Timeline.TimelineTreeView.TreeGridNode(child, totalUsed
Time, maxSelfTime, maxTotalTime, this); |
| 260 this._dataGrid.insertChild(gridNode); | 258 this._dataGrid.insertChild(gridNode); |
| 261 } | 259 } |
| 262 this._sortingChanged(); | 260 this._sortingChanged(); |
| 263 this._updateDetailsForSelection(); | 261 this._updateDetailsForSelection(); |
| 262 if (this._searchableView) |
| 263 this._searchableView.refreshSearch(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 /** | 266 /** |
| 267 * @return {!TimelineModel.TimelineProfileTree.Node} | 267 * @return {!TimelineModel.TimelineProfileTree.Node} |
| 268 */ | 268 */ |
| 269 _buildTree() { | 269 _buildTree() { |
| 270 throw new Error('Not Implemented'); | 270 throw new Error('Not Implemented'); |
| 271 } | 271 } |
| 272 | 272 |
| 273 /** | 273 /** |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 */ | 629 */ |
| 630 constructor(filters) { | 630 constructor(filters) { |
| 631 super(); | 631 super(); |
| 632 this._groupBySetting = | 632 this._groupBySetting = |
| 633 Common.settings.createSetting('timelineTreeGroupBy', Timeline.Aggregated
TimelineTreeView.GroupBy.None); | 633 Common.settings.createSetting('timelineTreeGroupBy', Timeline.Aggregated
TimelineTreeView.GroupBy.None); |
| 634 this._groupBySetting.addChangeListener(this.refreshTree.bind(this)); | 634 this._groupBySetting.addChangeListener(this.refreshTree.bind(this)); |
| 635 this.init(filters); | 635 this.init(filters); |
| 636 this._stackView = new Timeline.TimelineStackView(this); | 636 this._stackView = new Timeline.TimelineStackView(this); |
| 637 this._stackView.addEventListener( | 637 this._stackView.addEventListener( |
| 638 Timeline.TimelineStackView.Events.SelectionChanged, this._onStackViewSel
ectionChanged, this); | 638 Timeline.TimelineStackView.Events.SelectionChanged, this._onStackViewSel
ectionChanged, this); |
| 639 if (!Runtime.experiments.isEnabled('timelineColorByProduct')) | |
| 640 return; | |
| 641 /** @type {!Map<string, string>} */ | 639 /** @type {!Map<string, string>} */ |
| 642 this._productByURLCache = new Map(); | 640 this._productByURLCache = new Map(); |
| 643 ProductRegistry.instance().then(registry => { | 641 ProductRegistry.instance().then(registry => { |
| 644 this._productRegistry = registry; | 642 this._productRegistry = registry; |
| 645 this.refreshTree(); | 643 this.refreshTree(); |
| 646 }); | 644 }); |
| 647 } | 645 } |
| 648 | 646 |
| 649 /** | 647 /** |
| 650 * @override | 648 * @override |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 var options = [ | 743 var options = [ |
| 746 {label: Common.UIString('No Grouping'), value: groupBy.None}, | 744 {label: Common.UIString('No Grouping'), value: groupBy.None}, |
| 747 {label: Common.UIString('Group by Activity'), value: groupBy.EventName}, | 745 {label: Common.UIString('Group by Activity'), value: groupBy.EventName}, |
| 748 {label: Common.UIString('Group by Category'), value: groupBy.Category}, | 746 {label: Common.UIString('Group by Category'), value: groupBy.Category}, |
| 749 {label: Common.UIString('Group by Domain'), value: groupBy.Domain}, | 747 {label: Common.UIString('Group by Domain'), value: groupBy.Domain}, |
| 750 {label: Common.UIString('Group by Frame'), value: groupBy.Frame}, | 748 {label: Common.UIString('Group by Frame'), value: groupBy.Frame}, |
| 751 {label: Common.UIString('Group by Product'), value: groupBy.Product}, | 749 {label: Common.UIString('Group by Product'), value: groupBy.Product}, |
| 752 {label: Common.UIString('Group by Subdomain'), value: groupBy.Subdomain}, | 750 {label: Common.UIString('Group by Subdomain'), value: groupBy.Subdomain}, |
| 753 {label: Common.UIString('Group by URL'), value: groupBy.URL}, | 751 {label: Common.UIString('Group by URL'), value: groupBy.URL}, |
| 754 ]; | 752 ]; |
| 755 if (!Runtime.experiments.isEnabled('timelineColorByProduct')) | |
| 756 options = options.filter(option => option.value !== groupBy.Product); | |
| 757 toolbar.appendToolbarItem(new UI.ToolbarSettingComboBox(options, this._group
BySetting)); | 753 toolbar.appendToolbarItem(new UI.ToolbarSettingComboBox(options, this._group
BySetting)); |
| 758 toolbar.appendSpacer(); | 754 toolbar.appendSpacer(); |
| 759 toolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton(Comm
on.UIString('heaviest stack'))); | 755 toolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton(Comm
on.UIString('heaviest stack'))); |
| 760 } | 756 } |
| 761 | 757 |
| 762 /** | 758 /** |
| 763 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode | 759 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode |
| 764 * @return {!Array<!TimelineModel.TimelineProfileTree.Node>} | 760 * @return {!Array<!TimelineModel.TimelineProfileTree.Node>} |
| 765 */ | 761 */ |
| 766 _buildHeaviestStack(treeNode) { | 762 _buildHeaviestStack(treeNode) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 var domainMatch = /([^.]*\.)?[^.]*$/.exec(parsedURL.host); | 852 var domainMatch = /([^.]*\.)?[^.]*$/.exec(parsedURL.host); |
| 857 return domainMatch && domainMatch[0] || ''; | 853 return domainMatch && domainMatch[0] || ''; |
| 858 } | 854 } |
| 859 | 855 |
| 860 /** | 856 /** |
| 861 * @param {!SDK.TracingModel.Event} event | 857 * @param {!SDK.TracingModel.Event} event |
| 862 * @return {string} | 858 * @return {string} |
| 863 */ | 859 */ |
| 864 _productByEvent(event) { | 860 _productByEvent(event) { |
| 865 var url = TimelineModel.TimelineProfileTree.eventURL(event); | 861 var url = TimelineModel.TimelineProfileTree.eventURL(event); |
| 866 if (!url || !this._productByURLCache) | 862 if (!url) |
| 867 return ''; | 863 return ''; |
| 868 if (this._productByURLCache.has(url)) | 864 if (this._productByURLCache.has(url)) |
| 869 return this._productByURLCache.get(url); | 865 return this._productByURLCache.get(url); |
| 870 if (!this._productRegistry) | 866 if (!this._productRegistry) |
| 871 return ''; | 867 return ''; |
| 872 var parsedURL = url.asParsedURL(); | 868 var parsedURL = url.asParsedURL(); |
| 873 var name = parsedURL && this._productRegistry.nameForUrl(parsedURL) || ''; | 869 var name = parsedURL && this._productRegistry.nameForUrl(parsedURL) || ''; |
| 874 this._productByURLCache.set(url, name); | 870 this._productByURLCache.set(url, name); |
| 875 return name; | 871 return name; |
| 876 } | 872 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 | 1013 |
| 1018 _onSelectionChanged() { | 1014 _onSelectionChanged() { |
| 1019 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); | 1015 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha
nged); |
| 1020 } | 1016 } |
| 1021 }; | 1017 }; |
| 1022 | 1018 |
| 1023 /** @enum {symbol} */ | 1019 /** @enum {symbol} */ |
| 1024 Timeline.TimelineStackView.Events = { | 1020 Timeline.TimelineStackView.Events = { |
| 1025 SelectionChanged: Symbol('SelectionChanged') | 1021 SelectionChanged: Symbol('SelectionChanged') |
| 1026 }; | 1022 }; |
| OLD | NEW |