| 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')); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 this.dataGrid = new UI.DataGrid(columns); | 28 this.dataGrid = new UI.DataGrid(columns); |
| 29 this.dataGrid.addEventListener(UI.DataGrid.Events.SortingChanged, this._sort
Profile, this); | 29 this.dataGrid.addEventListener(UI.DataGrid.Events.SortingChanged, this._sort
Profile, this); |
| 30 this.dataGrid.addEventListener(UI.DataGrid.Events.SelectedNode, this._nodeSe
lected.bind(this, true)); | 30 this.dataGrid.addEventListener(UI.DataGrid.Events.SelectedNode, this._nodeSe
lected.bind(this, true)); |
| 31 this.dataGrid.addEventListener(UI.DataGrid.Events.DeselectedNode, this._node
Selected.bind(this, false)); | 31 this.dataGrid.addEventListener(UI.DataGrid.Events.DeselectedNode, this._node
Selected.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('click', this._focusClicked, 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('click', this._excludeClicked, this); |
| 42 | 42 |
| 43 this.resetButton = new UI.ToolbarButton(Common.UIString('Restore all functio
ns'), 'largeicon-refresh'); | 43 this.resetButton = new UI.ToolbarButton(Common.UIString('Restore all functio
ns'), 'largeicon-refresh'); |
| 44 this.resetButton.setEnabled(false); | 44 this.resetButton.setEnabled(false); |
| 45 this.resetButton.addEventListener(UI.ToolbarButton.Events.Click, this._reset
Clicked, this); | 45 this.resetButton.addEventListener('click', this._resetClicked, this); |
| 46 | 46 |
| 47 this._linkifier = new Components.Linkifier(Profiler.ProfileView._maxLinkLeng
th); | 47 this._linkifier = new Components.Linkifier(Profiler.ProfileView._maxLinkLeng
th); |
| 48 } | 48 } |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * @param {!Array<!{title: string, value: string}>} entryInfo | 51 * @param {!Array<!{title: string, value: string}>} entryInfo |
| 52 * @return {!Element} | 52 * @return {!Element} |
| 53 */ | 53 */ |
| 54 static buildPopoverTable(entryInfo) { | 54 static buildPopoverTable(entryInfo) { |
| 55 var table = createElement('table'); | 55 var table = createElement('table'); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 318 } |
| 319 | 319 |
| 320 /** | 320 /** |
| 321 * @param {boolean} selected | 321 * @param {boolean} selected |
| 322 */ | 322 */ |
| 323 _nodeSelected(selected) { | 323 _nodeSelected(selected) { |
| 324 this.focusButton.setEnabled(selected); | 324 this.focusButton.setEnabled(selected); |
| 325 this.excludeButton.setEnabled(selected); | 325 this.excludeButton.setEnabled(selected); |
| 326 } | 326 } |
| 327 | 327 |
| 328 /** | |
| 329 * @param {!Common.Event} event | |
| 330 */ | |
| 331 _focusClicked(event) { | 328 _focusClicked(event) { |
| 332 if (!this.dataGrid.selectedNode) | 329 if (!this.dataGrid.selectedNode) |
| 333 return; | 330 return; |
| 334 | 331 |
| 335 this.resetButton.setEnabled(true); | 332 this.resetButton.setEnabled(true); |
| 336 this.profileDataGridTree.focus(this.dataGrid.selectedNode); | 333 this.profileDataGridTree.focus(this.dataGrid.selectedNode); |
| 337 this.refresh(); | 334 this.refresh(); |
| 338 this.refreshVisibleData(); | 335 this.refreshVisibleData(); |
| 339 } | 336 } |
| 340 | 337 |
| 341 /** | |
| 342 * @param {!Common.Event} event | |
| 343 */ | |
| 344 _excludeClicked(event) { | 338 _excludeClicked(event) { |
| 345 var selectedNode = this.dataGrid.selectedNode; | 339 var selectedNode = this.dataGrid.selectedNode; |
| 346 | 340 |
| 347 if (!selectedNode) | 341 if (!selectedNode) |
| 348 return; | 342 return; |
| 349 | 343 |
| 350 selectedNode.deselect(); | 344 selectedNode.deselect(); |
| 351 | 345 |
| 352 this.resetButton.setEnabled(true); | 346 this.resetButton.setEnabled(true); |
| 353 this.profileDataGridTree.exclude(selectedNode); | 347 this.profileDataGridTree.exclude(selectedNode); |
| 354 this.refresh(); | 348 this.refresh(); |
| 355 this.refreshVisibleData(); | 349 this.refreshVisibleData(); |
| 356 } | 350 } |
| 357 | 351 |
| 358 /** | |
| 359 * @param {!Common.Event} event | |
| 360 */ | |
| 361 _resetClicked(event) { | 352 _resetClicked(event) { |
| 362 this.resetButton.setEnabled(false); | 353 this.resetButton.setEnabled(false); |
| 363 this.profileDataGridTree.restore(); | 354 this.profileDataGridTree.restore(); |
| 364 this._linkifier.reset(); | 355 this._linkifier.reset(); |
| 365 this.refresh(); | 356 this.refresh(); |
| 366 this.refreshVisibleData(); | 357 this.refreshVisibleData(); |
| 367 } | 358 } |
| 368 | 359 |
| 369 _sortProfile() { | 360 _sortProfile() { |
| 370 var sortAscending = this.dataGrid.isSortOrderAscending(); | 361 var sortAscending = this.dataGrid.isSortOrderAscending(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 tempFile.write([serializedData], didWriteToTempFile.bind(this)); | 575 tempFile.write([serializedData], didWriteToTempFile.bind(this)); |
| 585 } | 576 } |
| 586 | 577 |
| 587 _notifyTempFileReady() { | 578 _notifyTempFileReady() { |
| 588 if (this._onTempFileReady) { | 579 if (this._onTempFileReady) { |
| 589 this._onTempFileReady(); | 580 this._onTempFileReady(); |
| 590 this._onTempFileReady = null; | 581 this._onTempFileReady = null; |
| 591 } | 582 } |
| 592 } | 583 } |
| 593 }; | 584 }; |
| OLD | NEW |