Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js

Issue 2882343002: DevTools: Make flamechart coloring depend on group by selector. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 Timeline.TimelineUIUtils.eventTitle(node.event); 710 Timeline.TimelineUIUtils.eventTitle(node.event);
711 return { 711 return {
712 name: name, 712 name: name,
713 color: node.event.name === TimelineModel.TimelineModel.RecordType.JSFr ame ? 713 color: node.event.name === TimelineModel.TimelineModel.RecordType.JSFr ame ?
714 Timeline.TimelineUIUtils.eventStyle(node.event).category.color : 714 Timeline.TimelineUIUtils.eventStyle(node.event).category.color :
715 color 715 color
716 }; 716 };
717 717
718 case Timeline.AggregatedTimelineTreeView.GroupBy.Product: 718 case Timeline.AggregatedTimelineTreeView.GroupBy.Product:
719 var productName = this._productByEvent(/** @type {!SDK.TracingModel.Even t} */ (node.event)); 719 var productName = this._productByEvent(/** @type {!SDK.TracingModel.Even t} */ (node.event));
720 color = productName ? Timeline.TimelineUIUtils.colorForId(productName) : '#eee'; 720 color = productName ? ProductRegistry.BadgePool.colorForEntryName(produc tName) : '#eee';
721 var name = productName || this._domainByEvent(true, /** @type {!SDK.Trac ingModel.Event} */ (node.event)) || ''; 721 var name = productName || this._domainByEvent(true, /** @type {!SDK.Trac ingModel.Event} */ (node.event)) || '';
722 return {name: beautifyDomainName.call(this, name) || unattributed, color : color}; 722 return {name: beautifyDomainName.call(this, name) || unattributed, color : color};
723 723
724 case Timeline.AggregatedTimelineTreeView.GroupBy.URL: 724 case Timeline.AggregatedTimelineTreeView.GroupBy.URL:
725 break; 725 break;
726 726
727 case Timeline.AggregatedTimelineTreeView.GroupBy.Frame: 727 case Timeline.AggregatedTimelineTreeView.GroupBy.Frame:
728 var frame = this._model.timelineModel().pageFrameById(node.id); 728 var frame = this._model.timelineModel().pageFrameById(node.id);
729 var frameName = frame ? Timeline.TimelineUIUtils.displayNameForFrame(fra me, 80) : Common.UIString('Page'); 729 var frameName = frame ? Timeline.TimelineUIUtils.displayNameForFrame(fra me, 80) : Common.UIString('Page');
730 return {name: frameName, color: color}; 730 return {name: frameName, color: color};
731 731
732 default: 732 default:
733 console.assert(false, 'Unexpected grouping type'); 733 console.assert(false, 'Unexpected grouping type');
734 } 734 }
735 return {name: node.id || unattributed, color: color}; 735 return {name: node.id || unattributed, color: color};
736 } 736 }
737 737
738 /** 738 /**
739 * @override 739 * @override
740 * @param {!UI.Toolbar} toolbar 740 * @param {!UI.Toolbar} toolbar
741 */ 741 */
742 populateToolbar(toolbar) { 742 populateToolbar(toolbar) {
743 super.populateToolbar(toolbar); 743 super.populateToolbar(toolbar);
744 var groupBy = Timeline.AggregatedTimelineTreeView.GroupBy; 744 var groupBy = Timeline.AggregatedTimelineTreeView.GroupBy;
745 var options = [ 745 var options = [
746 {label: Common.UIString('No Grouping'), value: groupBy.None}, 746 {label: Common.UIString('No Grouping'), value: groupBy.None},
747 {label: Common.UIString('Group by Activity'), value: groupBy.EventName}, 747 {label: Common.UIString('Group by Activity'), value: groupBy.EventName},
748 {label: Common.UIString('Group by Category'), value: groupBy.Category}, 748 {label: Common.UIString('Group by Category'), value: groupBy.Category},
749 {label: Common.UIString('Group by Domain'), value: groupBy.Domain}, 749 {label: Common.UIString('Group by Domain'), value: groupBy.Domain},
750 {label: Common.UIString('Group by Frame'), value: groupBy.Frame},
751 {label: Common.UIString('Group by Product'), value: groupBy.Product},
750 {label: Common.UIString('Group by Subdomain'), value: groupBy.Subdomain}, 752 {label: Common.UIString('Group by Subdomain'), value: groupBy.Subdomain},
751 {label: Common.UIString('Group by Product'), value: groupBy.Product},
752 {label: Common.UIString('Group by URL'), value: groupBy.URL}, 753 {label: Common.UIString('Group by URL'), value: groupBy.URL},
753 {label: Common.UIString('Group by Frame'), value: groupBy.Frame},
754 ]; 754 ];
755 if (!Runtime.experiments.isEnabled('timelineColorByProduct')) 755 if (!Runtime.experiments.isEnabled('timelineColorByProduct'))
756 options = options.filter(option => option.value !== groupBy.Product); 756 options = options.filter(option => option.value !== groupBy.Product);
757 toolbar.appendToolbarItem(new UI.ToolbarSettingComboBox(options, this._group BySetting)); 757 toolbar.appendToolbarItem(new UI.ToolbarSettingComboBox(options, this._group BySetting));
758 toolbar.appendSpacer(); 758 toolbar.appendSpacer();
759 toolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton(Comm on.UIString('heaviest stack'))); 759 toolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton(Comm on.UIString('heaviest stack')));
760 } 760 }
761 761
762 /** 762 /**
763 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode 763 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 1017
1018 _onSelectionChanged() { 1018 _onSelectionChanged() {
1019 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha nged); 1019 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha nged);
1020 } 1020 }
1021 }; 1021 };
1022 1022
1023 /** @enum {symbol} */ 1023 /** @enum {symbol} */
1024 Timeline.TimelineStackView.Events = { 1024 Timeline.TimelineStackView.Events = {
1025 SelectionChanged: Symbol('SelectionChanged') 1025 SelectionChanged: Symbol('SelectionChanged')
1026 }; 1026 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698