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('click', this._focusClicked, 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('click', this._excludeClicked, this); | 41 this.excludeButton.addEventListener(UI.ToolbarButton.Events.Click, this._exc
ludeClicked, 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('click', this._resetClicked, this); | 45 this.resetButton.addEventListener(UI.ToolbarButton.Events.Click, this._reset
Clicked, 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 */ |
328 _focusClicked(event) { | 331 _focusClicked(event) { |
329 if (!this.dataGrid.selectedNode) | 332 if (!this.dataGrid.selectedNode) |
330 return; | 333 return; |
331 | 334 |
332 this.resetButton.setEnabled(true); | 335 this.resetButton.setEnabled(true); |
333 this.profileDataGridTree.focus(this.dataGrid.selectedNode); | 336 this.profileDataGridTree.focus(this.dataGrid.selectedNode); |
334 this.refresh(); | 337 this.refresh(); |
335 this.refreshVisibleData(); | 338 this.refreshVisibleData(); |
336 } | 339 } |
337 | 340 |
| 341 /** |
| 342 * @param {!Common.Event} event |
| 343 */ |
338 _excludeClicked(event) { | 344 _excludeClicked(event) { |
339 var selectedNode = this.dataGrid.selectedNode; | 345 var selectedNode = this.dataGrid.selectedNode; |
340 | 346 |
341 if (!selectedNode) | 347 if (!selectedNode) |
342 return; | 348 return; |
343 | 349 |
344 selectedNode.deselect(); | 350 selectedNode.deselect(); |
345 | 351 |
346 this.resetButton.setEnabled(true); | 352 this.resetButton.setEnabled(true); |
347 this.profileDataGridTree.exclude(selectedNode); | 353 this.profileDataGridTree.exclude(selectedNode); |
348 this.refresh(); | 354 this.refresh(); |
349 this.refreshVisibleData(); | 355 this.refreshVisibleData(); |
350 } | 356 } |
351 | 357 |
| 358 /** |
| 359 * @param {!Common.Event} event |
| 360 */ |
352 _resetClicked(event) { | 361 _resetClicked(event) { |
353 this.resetButton.setEnabled(false); | 362 this.resetButton.setEnabled(false); |
354 this.profileDataGridTree.restore(); | 363 this.profileDataGridTree.restore(); |
355 this._linkifier.reset(); | 364 this._linkifier.reset(); |
356 this.refresh(); | 365 this.refresh(); |
357 this.refreshVisibleData(); | 366 this.refreshVisibleData(); |
358 } | 367 } |
359 | 368 |
360 _sortProfile() { | 369 _sortProfile() { |
361 var sortAscending = this.dataGrid.isSortOrderAscending(); | 370 var sortAscending = this.dataGrid.isSortOrderAscending(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 tempFile.write([serializedData], didWriteToTempFile.bind(this)); | 584 tempFile.write([serializedData], didWriteToTempFile.bind(this)); |
576 } | 585 } |
577 | 586 |
578 _notifyTempFileReady() { | 587 _notifyTempFileReady() { |
579 if (this._onTempFileReady) { | 588 if (this._onTempFileReady) { |
580 this._onTempFileReady(); | 589 this._onTempFileReady(); |
581 this._onTempFileReady = null; | 590 this._onTempFileReady = null; |
582 } | 591 } |
583 } | 592 } |
584 }; | 593 }; |
OLD | NEW |