| 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 * @implements {UI.Searchable} | 5 * @implements {UI.Searchable} |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 Profiler.ProfileView = class extends UI.SimpleView { | 8 Profiler.ProfileView = class extends UI.SimpleView { |
| 9 constructor() { | 9 constructor() { |
| 10 super(Common.UIString('Profile')); | 10 super(Common.UIString('Profile')); |
| 11 | 11 |
| 12 this._searchableView = new UI.SearchableView(this); | 12 this._searchableView = new UI.SearchableView(this); |
| 13 this._searchableView.setPlaceholder(Common.UIString('Find by cost (>50ms), n
ame or file')); | 13 this._searchableView.setPlaceholder(Common.UIString('Find by cost (>50ms), n
ame or file')); |
| 14 this._searchableView.show(this.element); | 14 this._searchableView.show(this.element); |
| 15 | 15 |
| 16 var columns = /** @type {!Array<!UI.DataGrid.ColumnDescriptor>} */ ([]); | 16 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([]
); |
| 17 columns.push({ | 17 columns.push({ |
| 18 id: 'self', | 18 id: 'self', |
| 19 title: this.columnHeader('self'), | 19 title: this.columnHeader('self'), |
| 20 width: '120px', | 20 width: '120px', |
| 21 fixedWidth: true, | 21 fixedWidth: true, |
| 22 sortable: true, | 22 sortable: true, |
| 23 sort: UI.DataGrid.Order.Descending | 23 sort: DataGrid.DataGrid.Order.Descending |
| 24 }); | 24 }); |
| 25 columns.push({id: 'total', title: this.columnHeader('total'), width: '120px'
, fixedWidth: true, sortable: true}); | 25 columns.push({id: 'total', title: this.columnHeader('total'), width: '120px'
, fixedWidth: true, sortable: true}); |
| 26 columns.push({id: 'function', title: Common.UIString('Function'), disclosure
: true, sortable: true}); | 26 columns.push({id: 'function', title: Common.UIString('Function'), disclosure
: true, sortable: true}); |
| 27 | 27 |
| 28 this.dataGrid = new UI.DataGrid(columns); | 28 this.dataGrid = new DataGrid.DataGrid(columns); |
| 29 this.dataGrid.addEventListener(UI.DataGrid.Events.SortingChanged, this._sort
Profile, this); | 29 this.dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, this
._sortProfile, this); |
| 30 this.dataGrid.addEventListener(UI.DataGrid.Events.SelectedNode, this._nodeSe
lected.bind(this, true)); | 30 this.dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this._
nodeSelected.bind(this, true)); |
| 31 this.dataGrid.addEventListener(UI.DataGrid.Events.DeselectedNode, this._node
Selected.bind(this, false)); | 31 this.dataGrid.addEventListener(DataGrid.DataGrid.Events.DeselectedNode, this
._nodeSelected.bind(this, false)); |
| 32 | 32 |
| 33 this.viewSelectComboBox = new UI.ToolbarComboBox(this._changeView.bind(this)
); | 33 this.viewSelectComboBox = new UI.ToolbarComboBox(this._changeView.bind(this)
); |
| 34 | 34 |
| 35 this.focusButton = new UI.ToolbarButton(Common.UIString('Focus selected func
tion'), 'largeicon-visibility'); | 35 this.focusButton = new UI.ToolbarButton(Common.UIString('Focus selected func
tion'), 'largeicon-visibility'); |
| 36 this.focusButton.setEnabled(false); | 36 this.focusButton.setEnabled(false); |
| 37 this.focusButton.addEventListener(UI.ToolbarButton.Events.Click, this._focus
Clicked, this); | 37 this.focusButton.addEventListener(UI.ToolbarButton.Events.Click, this._focus
Clicked, this); |
| 38 | 38 |
| 39 this.excludeButton = new UI.ToolbarButton(Common.UIString('Exclude selected
function'), 'largeicon-delete'); | 39 this.excludeButton = new UI.ToolbarButton(Common.UIString('Exclude selected
function'), 'largeicon-delete'); |
| 40 this.excludeButton.setEnabled(false); | 40 this.excludeButton.setEnabled(false); |
| 41 this.excludeButton.addEventListener(UI.ToolbarButton.Events.Click, this._exc
ludeClicked, this); | 41 this.excludeButton.addEventListener(UI.ToolbarButton.Events.Click, this._exc
ludeClicked, this); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 241 } |
| 242 | 242 |
| 243 /** | 243 /** |
| 244 * @return {!Components.Linkifier} | 244 * @return {!Components.Linkifier} |
| 245 */ | 245 */ |
| 246 linkifier() { | 246 linkifier() { |
| 247 return this._linkifier; | 247 return this._linkifier; |
| 248 } | 248 } |
| 249 | 249 |
| 250 /** | 250 /** |
| 251 * @return {!UI.FlameChartDataProvider} | 251 * @return {!Perf_UI.FlameChartDataProvider} |
| 252 */ | 252 */ |
| 253 createFlameChartDataProvider() { | 253 createFlameChartDataProvider() { |
| 254 throw 'Not implemented'; | 254 throw 'Not implemented'; |
| 255 } | 255 } |
| 256 | 256 |
| 257 _ensureFlameChartCreated() { | 257 _ensureFlameChartCreated() { |
| 258 if (this._flameChart) | 258 if (this._flameChart) |
| 259 return; | 259 return; |
| 260 this._dataProvider = this.createFlameChartDataProvider(); | 260 this._dataProvider = this.createFlameChartDataProvider(); |
| 261 this._flameChart = new Profiler.CPUProfileFlameChart(this._searchableView, t
his._dataProvider); | 261 this._flameChart = new Profiler.CPUProfileFlameChart(this._searchableView, t
his._dataProvider); |
| 262 this._flameChart.addEventListener(UI.FlameChart.Events.EntrySelected, this._
onEntrySelected.bind(this)); | 262 this._flameChart.addEventListener(Perf_UI.FlameChart.Events.EntrySelected, t
his._onEntrySelected.bind(this)); |
| 263 } | 263 } |
| 264 | 264 |
| 265 /** | 265 /** |
| 266 * @param {!Common.Event} event | 266 * @param {!Common.Event} event |
| 267 */ | 267 */ |
| 268 _onEntrySelected(event) { | 268 _onEntrySelected(event) { |
| 269 var entryIndex = event.data; | 269 var entryIndex = event.data; |
| 270 var node = this._dataProvider._entryNodes[entryIndex]; | 270 var node = this._dataProvider._entryNodes[entryIndex]; |
| 271 var debuggerModel = this._profileHeader._debuggerModel; | 271 var debuggerModel = this._profileHeader._debuggerModel; |
| 272 if (!node || !node.scriptId || !debuggerModel) | 272 if (!node || !node.scriptId || !debuggerModel) |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 tempFile.write([serializedData], didWriteToTempFile.bind(this)); | 584 tempFile.write([serializedData], didWriteToTempFile.bind(this)); |
| 585 } | 585 } |
| 586 | 586 |
| 587 _notifyTempFileReady() { | 587 _notifyTempFileReady() { |
| 588 if (this._onTempFileReady) { | 588 if (this._onTempFileReady) { |
| 589 this._onTempFileReady(); | 589 this._onTempFileReady(); |
| 590 this._onTempFileReady = null; | 590 this._onTempFileReady = null; |
| 591 } | 591 } |
| 592 } | 592 } |
| 593 }; | 593 }; |
| OLD | NEW |