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

Side by Side Diff: Source/devtools/front_end/profiler/CPUProfileView.js

Issue 720223002: DevTools: only allow status bar items in status bars. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 var options = {}; 53 var options = {};
54 options[WebInspector.CPUProfileView._TypeFlame] = this.viewSelectComboBox.cr eateOption(WebInspector.UIString("Chart"), "", WebInspector.CPUProfileView._Type Flame); 54 options[WebInspector.CPUProfileView._TypeFlame] = this.viewSelectComboBox.cr eateOption(WebInspector.UIString("Chart"), "", WebInspector.CPUProfileView._Type Flame);
55 options[WebInspector.CPUProfileView._TypeHeavy] = this.viewSelectComboBox.cr eateOption(WebInspector.UIString("Heavy (Bottom Up)"), "", WebInspector.CPUProfi leView._TypeHeavy); 55 options[WebInspector.CPUProfileView._TypeHeavy] = this.viewSelectComboBox.cr eateOption(WebInspector.UIString("Heavy (Bottom Up)"), "", WebInspector.CPUProfi leView._TypeHeavy);
56 options[WebInspector.CPUProfileView._TypeTree] = this.viewSelectComboBox.cre ateOption(WebInspector.UIString("Tree (Top Down)"), "", WebInspector.CPUProfileV iew._TypeTree); 56 options[WebInspector.CPUProfileView._TypeTree] = this.viewSelectComboBox.cre ateOption(WebInspector.UIString("Tree (Top Down)"), "", WebInspector.CPUProfileV iew._TypeTree);
57 57
58 var optionName = this._viewType.get() || WebInspector.CPUProfileView._TypeFl ame; 58 var optionName = this._viewType.get() || WebInspector.CPUProfileView._TypeFl ame;
59 var option = options[optionName] || options[WebInspector.CPUProfileView._Typ eFlame]; 59 var option = options[optionName] || options[WebInspector.CPUProfileView._Typ eFlame];
60 this.viewSelectComboBox.select(option); 60 this.viewSelectComboBox.select(option);
61 61
62 this._statusBarButtonsElement = createElement("span");
63
64 this.focusButton = new WebInspector.StatusBarButton(WebInspector.UIString("F ocus selected function."), "focus-profile-node-status-bar-item"); 62 this.focusButton = new WebInspector.StatusBarButton(WebInspector.UIString("F ocus selected function."), "focus-profile-node-status-bar-item");
65 this.focusButton.setEnabled(false); 63 this.focusButton.setEnabled(false);
66 this.focusButton.addEventListener("click", this._focusClicked, this); 64 this.focusButton.addEventListener("click", this._focusClicked, this);
67 this._statusBarButtonsElement.appendChild(this.focusButton.element);
68 65
69 this.excludeButton = new WebInspector.StatusBarButton(WebInspector.UIString( "Exclude selected function."), "exclude-profile-node-status-bar-item"); 66 this.excludeButton = new WebInspector.StatusBarButton(WebInspector.UIString( "Exclude selected function."), "exclude-profile-node-status-bar-item");
70 this.excludeButton.setEnabled(false); 67 this.excludeButton.setEnabled(false);
71 this.excludeButton.addEventListener("click", this._excludeClicked, this); 68 this.excludeButton.addEventListener("click", this._excludeClicked, this);
72 this._statusBarButtonsElement.appendChild(this.excludeButton.element);
73 69
74 this.resetButton = new WebInspector.StatusBarButton(WebInspector.UIString("R estore all functions."), "reset-profile-status-bar-item"); 70 this.resetButton = new WebInspector.StatusBarButton(WebInspector.UIString("R estore all functions."), "reset-profile-status-bar-item");
75 this.resetButton.setVisible(false); 71 this.resetButton.setVisible(false);
76 this.resetButton.addEventListener("click", this._resetClicked, this); 72 this.resetButton.addEventListener("click", this._resetClicked, this);
77 this._statusBarButtonsElement.appendChild(this.resetButton.element);
78 73
79 this._profileHeader = profileHeader; 74 this._profileHeader = profileHeader;
80 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultFormatter(30)); 75 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultFormatter(30));
81 76
82 this.profile = new WebInspector.CPUProfileDataModel(profileHeader._profile | | profileHeader.protocolProfile()); 77 this.profile = new WebInspector.CPUProfileDataModel(profileHeader._profile | | profileHeader.protocolProfile());
83 78
84 this._changeView(); 79 this._changeView();
85 if (this._flameChart) 80 if (this._flameChart)
86 this._flameChart.update(); 81 this._flameChart.update();
87 } 82 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 * @param {!number} timeLeft 130 * @param {!number} timeLeft
136 * @param {!number} timeRight 131 * @param {!number} timeRight
137 */ 132 */
138 selectRange: function(timeLeft, timeRight) 133 selectRange: function(timeLeft, timeRight)
139 { 134 {
140 if (!this._flameChart) 135 if (!this._flameChart)
141 return; 136 return;
142 this._flameChart.selectRange(timeLeft, timeRight); 137 this._flameChart.selectRange(timeLeft, timeRight);
143 }, 138 },
144 139
145 get statusBarItems() 140 /**
141 * @return {!Array.<!WebInspector.StatusBarItem>}
142 */
143 statusBarItems: function()
146 { 144 {
147 return [this.viewSelectComboBox.element, this._statusBarButtonsElement]; 145 return [this.viewSelectComboBox, this.focusButton, this.excludeButton, t his.resetButton];
148 }, 146 },
149 147
150 /** 148 /**
151 * @return {!WebInspector.ProfileDataGridTree} 149 * @return {!WebInspector.ProfileDataGridTree}
152 */ 150 */
153 _getBottomUpProfileDataGridTree: function() 151 _getBottomUpProfileDataGridTree: function()
154 { 152 {
155 if (!this._bottomUpProfileDataGridTree) 153 if (!this._bottomUpProfileDataGridTree)
156 this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfile DataGridTree(this, /** @type {!ProfilerAgent.CPUProfileNode} */ (this.profile.pr ofileHead)); 154 this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfile DataGridTree(this, /** @type {!ProfilerAgent.CPUProfileNode} */ (this.profile.pr ofileHead));
157 return this._bottomUpProfileDataGridTree; 155 return this._bottomUpProfileDataGridTree;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 281
284 this._searchableView.closeSearch(); 282 this._searchableView.closeSearch();
285 283
286 if (this._visibleView) 284 if (this._visibleView)
287 this._visibleView.detach(); 285 this._visibleView.detach();
288 286
289 this._viewType.set(this.viewSelectComboBox.selectedOption().value); 287 this._viewType.set(this.viewSelectComboBox.selectedOption().value);
290 switch (this._viewType.get()) { 288 switch (this._viewType.get()) {
291 case WebInspector.CPUProfileView._TypeFlame: 289 case WebInspector.CPUProfileView._TypeFlame:
292 this._ensureFlameChartCreated(); 290 this._ensureFlameChartCreated();
293 this._statusBarButtonsElement.classList.toggle("hidden", true);
294 this._visibleView = this._flameChart; 291 this._visibleView = this._flameChart;
295 this._searchableElement = this._flameChart; 292 this._searchableElement = this._flameChart;
296 break; 293 break;
297 case WebInspector.CPUProfileView._TypeTree: 294 case WebInspector.CPUProfileView._TypeTree:
298 this.profileDataGridTree = this._getTopDownProfileDataGridTree(); 295 this.profileDataGridTree = this._getTopDownProfileDataGridTree();
299 this._sortProfile(); 296 this._sortProfile();
300 this._visibleView = this.dataGrid; 297 this._visibleView = this.dataGrid;
301 this._searchableElement = this.profileDataGridTree; 298 this._searchableElement = this.profileDataGridTree;
302 break; 299 break;
303 case WebInspector.CPUProfileView._TypeHeavy: 300 case WebInspector.CPUProfileView._TypeHeavy:
304 this.profileDataGridTree = this._getBottomUpProfileDataGridTree(); 301 this.profileDataGridTree = this._getBottomUpProfileDataGridTree();
305 this._sortProfile(); 302 this._sortProfile();
306 this._visibleView = this.dataGrid; 303 this._visibleView = this.dataGrid;
307 this._searchableElement = this.profileDataGridTree; 304 this._searchableElement = this.profileDataGridTree;
308 break; 305 break;
309 } 306 }
310 307
311 this._statusBarButtonsElement.classList.toggle("hidden", this._viewType. get() === WebInspector.CPUProfileView._TypeFlame); 308 var isFlame = this._viewType.get() === WebInspector.CPUProfileView._Type Flame;
309 this.focusButton.setVisible(!isFlame);
310 this.excludeButton.setVisible(!isFlame);
311 this.resetButton.setVisible(!isFlame);
312
312 this._visibleView.show(this._searchableView.element); 313 this._visibleView.show(this._searchableView.element);
313 }, 314 },
314 315
315 _focusClicked: function(event) 316 _focusClicked: function(event)
316 { 317 {
317 if (!this.dataGrid.selectedNode) 318 if (!this.dataGrid.selectedNode)
318 return; 319 return;
319 320
320 this.resetButton.setVisible(true); 321 this.resetButton.setVisible(true);
321 this.profileDataGridTree.focus(this.dataGrid.selectedNode); 322 this.profileDataGridTree.focus(this.dataGrid.selectedNode);
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 _notifyTempFileReady: function() 779 _notifyTempFileReady: function()
779 { 780 {
780 if (this._onTempFileReady) { 781 if (this._onTempFileReady) {
781 this._onTempFileReady(); 782 this._onTempFileReady();
782 this._onTempFileReady = null; 783 this._onTempFileReady = null;
783 } 784 }
784 }, 785 },
785 786
786 __proto__: WebInspector.ProfileHeader.prototype 787 __proto__: WebInspector.ProfileHeader.prototype
787 } 788 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/network/NetworkPanel.js ('k') | Source/devtools/front_end/profiler/CanvasProfileView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698