OLD | NEW |
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: this.columnHeader("self"), width: "120px",
sort: WebInspector.DataGrid.Order.Descending, sortable: true}); |
30 columns.push({id: "total", title: WebInspector.UIString("Total"), width: "12
0px", sortable: true}); | 30 columns.push({id: "total", title: this.columnHeader("total"), 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 Loading... |
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 * @param {string} columnId |
| 86 * @return {string} |
| 87 */ |
| 88 columnHeader: function(columnId) |
| 89 { |
| 90 throw "Not implemented"; |
| 91 }, |
| 92 |
| 93 /** |
85 * @return {?WebInspector.Target} | 94 * @return {?WebInspector.Target} |
86 */ | 95 */ |
87 target: function() | 96 target: function() |
88 { | 97 { |
89 return this._profileHeader.target(); | 98 return this._profileHeader.target(); |
90 }, | 99 }, |
91 | 100 |
92 /** | 101 /** |
93 * @param {number} timeLeft | 102 * @param {number} timeLeft |
94 * @param {number} timeRight | 103 * @param {number} timeRight |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 _notifyTempFileReady: function() | 572 _notifyTempFileReady: function() |
564 { | 573 { |
565 if (this._onTempFileReady) { | 574 if (this._onTempFileReady) { |
566 this._onTempFileReady(); | 575 this._onTempFileReady(); |
567 this._onTempFileReady = null; | 576 this._onTempFileReady = null; |
568 } | 577 } |
569 }, | 578 }, |
570 | 579 |
571 __proto__: WebInspector.ProfileHeader.prototype | 580 __proto__: WebInspector.ProfileHeader.prototype |
572 } | 581 } |
OLD | NEW |