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

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

Issue 2444223002: [Devtools] Cleanup DataGrid's typecast and identifier naming (Closed)
Patch Set: changes Created 4 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
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.SimpleView} 8 * @extends {WebInspector.SimpleView}
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.SimpleView.call(this, WebInspector.UIString("Profile")); 14 WebInspector.SimpleView.call(this, WebInspector.UIString("Profile"));
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 = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([]);
29 columns.push({id: "self", title: this.columnHeader("self"), width: "120px", fixedWidth: true, sortable: true, sort: WebInspector.DataGrid.Order.Descending}) ; 29 columns.push({id: "self", title: this.columnHeader("self"), width: "120px", fixedWidth: true, sortable: true, sort: WebInspector.DataGrid.Order.Descending}) ;
30 columns.push({id: "total", title: this.columnHeader("total"), width: "120px" , fixedWidth: true, sortable: true}); 30 columns.push({id: "total", title: this.columnHeader("total"), width: "120px" , fixedWidth: true, 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));
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 this.resetButton.setEnabled(false); 368 this.resetButton.setEnabled(false);
369 this.profileDataGridTree.restore(); 369 this.profileDataGridTree.restore();
370 this._linkifier.reset(); 370 this._linkifier.reset();
371 this.refresh(); 371 this.refresh();
372 this.refreshVisibleData(); 372 this.refreshVisibleData();
373 }, 373 },
374 374
375 _sortProfile: function() 375 _sortProfile: function()
376 { 376 {
377 var sortAscending = this.dataGrid.isSortOrderAscending(); 377 var sortAscending = this.dataGrid.isSortOrderAscending();
378 var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier(); 378 var sortColumnId = this.dataGrid.sortColumnId();
379 var sortProperty = sortColumnIdentifier === "function" ? "functionName" : sortColumnIdentifier || ""; 379 var sortProperty = sortColumnId === "function" ? "functionName" : sortCo lumnId || "";
380 this.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyC omparator(sortProperty, sortAscending)); 380 this.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyC omparator(sortProperty, sortAscending));
381 381
382 this.refresh(); 382 this.refresh();
383 }, 383 },
384 384
385 __proto__: WebInspector.SimpleView.prototype 385 __proto__: WebInspector.SimpleView.prototype
386 }; 386 };
387 387
388 /** 388 /**
389 * @constructor 389 * @constructor
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 _notifyTempFileReady: function() 599 _notifyTempFileReady: function()
600 { 600 {
601 if (this._onTempFileReady) { 601 if (this._onTempFileReady) {
602 this._onTempFileReady(); 602 this._onTempFileReady();
603 this._onTempFileReady = null; 603 this._onTempFileReady = null;
604 } 604 }
605 }, 605 },
606 606
607 __proto__: WebInspector.ProfileHeader.prototype 607 __proto__: WebInspector.ProfileHeader.prototype
608 }; 608 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698