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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js

Issue 1932483002: DevTools: add measurement units to profile tree headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @constructor 6 * @constructor
7 * @implements {WebInspector.Searchable} 7 * @implements {WebInspector.Searchable}
8 * @extends {WebInspector.VBox} 8 * @extends {WebInspector.VBox}
9 * @param {!WebInspector.ProfileDataGridNode.Formatter} nodeFormatter 9 * @param {!WebInspector.ProfileDataGridNode.Formatter} nodeFormatter
10 * @param {!Array<string>=} viewTypes 10 * @param {!Array<string>=} viewTypes
11 */ 11 */
12 WebInspector.ProfileView = function(nodeFormatter, viewTypes) 12 WebInspector.ProfileView = function(nodeFormatter, viewTypes)
13 { 13 {
14 WebInspector.VBox.call(this); 14 WebInspector.VBox.call(this);
15 15
16 this._searchableView = new WebInspector.SearchableView(this); 16 this._searchableView = new WebInspector.SearchableView(this);
17 this._searchableView.setPlaceholder(WebInspector.UIString("Find by cost (>50 ms), name or file")); 17 this._searchableView.setPlaceholder(WebInspector.UIString("Find by cost (>50 ms), name or file"));
18 this._searchableView.show(this.element); 18 this._searchableView.show(this.element);
19 19
20 viewTypes = viewTypes || [ 20 viewTypes = viewTypes || [
21 WebInspector.ProfileView.ViewTypes.Flame, 21 WebInspector.ProfileView.ViewTypes.Flame,
22 WebInspector.ProfileView.ViewTypes.Heavy, 22 WebInspector.ProfileView.ViewTypes.Heavy,
23 WebInspector.ProfileView.ViewTypes.Tree 23 WebInspector.ProfileView.ViewTypes.Tree
24 ]; 24 ];
25 this._viewType = WebInspector.settings.createSetting("profileView", WebInspe ctor.ProfileView.ViewTypes.Heavy); 25 this._viewType = WebInspector.settings.createSetting("profileView", WebInspe ctor.ProfileView.ViewTypes.Heavy);
26 this._nodeFormatter = nodeFormatter; 26 this._nodeFormatter = nodeFormatter;
27 27
28 var columns = []; 28 var columns = [];
29 columns.push({id: "self", title: WebInspector.UIString("Self"), width: "120p x", sort: WebInspector.DataGrid.Order.Descending, sortable: true}); 29 columns.push({id: "self", title: WebInspector.UIString("Self %s", this.units ()), width: "120px", sort: WebInspector.DataGrid.Order.Descending, sortable: tru e});
30 columns.push({id: "total", title: WebInspector.UIString("Total"), width: "12 0px", sortable: true}); 30 columns.push({id: "total", title: WebInspector.UIString("Total %s", this.uni ts()), width: "120px", sortable: true});
31 columns.push({id: "function", title: WebInspector.UIString("Function"), disc losure: true, sortable: true}); 31 columns.push({id: "function", title: WebInspector.UIString("Function"), disc losure: true, sortable: true});
32 32
33 this.dataGrid = new WebInspector.DataGrid(columns); 33 this.dataGrid = new WebInspector.DataGrid(columns);
34 this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortProfile, this); 34 this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortProfile, this);
35 this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, th is._nodeSelected.bind(this, true)); 35 this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, th is._nodeSelected.bind(this, true));
36 this.dataGrid.addEventListener(WebInspector.DataGrid.Events.DeselectedNode, this._nodeSelected.bind(this, false)); 36 this.dataGrid.addEventListener(WebInspector.DataGrid.Events.DeselectedNode, this._nodeSelected.bind(this, false));
37 37
38 this.viewSelectComboBox = new WebInspector.ToolbarComboBox(this._changeView. bind(this)); 38 this.viewSelectComboBox = new WebInspector.ToolbarComboBox(this._changeView. bind(this));
39 var optionNames = new Map([ 39 var optionNames = new Map([
40 [WebInspector.ProfileView.ViewTypes.Flame, WebInspector.UIString("Chart" )], 40 [WebInspector.ProfileView.ViewTypes.Flame, WebInspector.UIString("Chart" )],
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 WebInspector.ProfileView.prototype = { 75 WebInspector.ProfileView.prototype = {
76 focus: function() 76 focus: function()
77 { 77 {
78 if (this._flameChart) 78 if (this._flameChart)
79 this._flameChart.focus(); 79 this._flameChart.focus();
80 else 80 else
81 WebInspector.Widget.prototype.focus.call(this); 81 WebInspector.Widget.prototype.focus.call(this);
82 }, 82 },
83 83
84 /** 84 /**
85 * @return {string}
86 */
87 units: function()
88 {
89 return "";
caseq 2016/04/27 21:24:08 should we throw "not implemented" instead?
alph 2016/04/28 00:47:26 Done.
90 },
91
92 /**
85 * @return {?WebInspector.Target} 93 * @return {?WebInspector.Target}
86 */ 94 */
87 target: function() 95 target: function()
88 { 96 {
89 return this._profileHeader.target(); 97 return this._profileHeader.target();
90 }, 98 },
91 99
92 /** 100 /**
93 * @param {number} timeLeft 101 * @param {number} timeLeft
94 * @param {number} timeRight 102 * @param {number} timeRight
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 _notifyTempFileReady: function() 571 _notifyTempFileReady: function()
564 { 572 {
565 if (this._onTempFileReady) { 573 if (this._onTempFileReady) {
566 this._onTempFileReady(); 574 this._onTempFileReady();
567 this._onTempFileReady = null; 575 this._onTempFileReady = null;
568 } 576 }
569 }, 577 },
570 578
571 __proto__: WebInspector.ProfileHeader.prototype 579 __proto__: WebInspector.ProfileHeader.prototype
572 } 580 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698