Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 this._filterSelect.setVisible(false); | 146 this._filterSelect.setVisible(false); |
| 147 this._updateFilterOptions(); | 147 this._updateFilterOptions(); |
| 148 | 148 |
| 149 this._classNameFilter = new UI.ToolbarInput('Class filter'); | 149 this._classNameFilter = new UI.ToolbarInput('Class filter'); |
| 150 this._classNameFilter.setVisible(false); | 150 this._classNameFilter.setVisible(false); |
| 151 this._constructorsDataGrid.setNameFilter(this._classNameFilter); | 151 this._constructorsDataGrid.setNameFilter(this._classNameFilter); |
| 152 this._diffDataGrid.setNameFilter(this._classNameFilter); | 152 this._diffDataGrid.setNameFilter(this._classNameFilter); |
| 153 | 153 |
| 154 this._selectedSizeText = new UI.ToolbarText(); | 154 this._selectedSizeText = new UI.ToolbarText(); |
| 155 | 155 |
| 156 this._popoverHelper = new UI.PopoverHelper(this.element, true); | 156 this._popoverHelper = new UI.PopoverHelper(this.element, true, this._getPopo verContent.bind(this)); |
| 157 this._popoverHelper.initializeCallbacks( | |
| 158 this._getHoverAnchor.bind(this), this._showObjectPopover.bind(this), thi s._onHidePopover.bind(this)); | |
| 159 this._popoverHelper.setHasPadding(true); | 157 this._popoverHelper.setHasPadding(true); |
| 160 this.element.addEventListener('scroll', this._popoverHelper.hidePopover.bind (this._popoverHelper), true); | 158 this.element.addEventListener('scroll', this._popoverHelper.hidePopover.bind (this._popoverHelper), true); |
| 161 | 159 |
| 162 this._currentPerspectiveIndex = 0; | 160 this._currentPerspectiveIndex = 0; |
| 163 this._currentPerspective = this._perspectives[0]; | 161 this._currentPerspective = this._perspectives[0]; |
| 164 this._currentPerspective.activate(this); | 162 this._currentPerspective.activate(this); |
| 165 this._dataGrid = this._currentPerspective.masterGrid(this); | 163 this._dataGrid = this._currentPerspective.masterGrid(this); |
| 166 | 164 |
| 167 this._populate(); | 165 this._populate(); |
| 168 this._searchThrottler = new Common.Throttler(0); | 166 this._searchThrottler = new Common.Throttler(0); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 600 * @param {?Profiler.HeapSnapshotGridNode} node | 598 * @param {?Profiler.HeapSnapshotGridNode} node |
| 601 */ | 599 */ |
| 602 function didRevealObject(node) { | 600 function didRevealObject(node) { |
| 603 if (node) | 601 if (node) |
| 604 node.select(); | 602 node.select(); |
| 605 else | 603 else |
| 606 Common.console.error('Cannot find corresponding heap snapshot node'); | 604 Common.console.error('Cannot find corresponding heap snapshot node'); |
| 607 } | 605 } |
| 608 } | 606 } |
| 609 | 607 |
| 610 _getHoverAnchor(target) { | |
| 611 var span = target.enclosingNodeOrSelfWithNodeName('span'); | |
| 612 if (!span) | |
| 613 return; | |
| 614 var row = target.enclosingNodeOrSelfWithNodeName('tr'); | |
| 615 if (!row) | |
| 616 return; | |
| 617 span.node = row._dataGridNode; | |
| 618 return span; | |
| 619 } | |
| 620 | |
| 621 /** | 608 /** |
| 622 * @param {!Element|!AnchorBox} element | 609 * @param {!Event} event |
| 623 * @param {!UI.GlassPane} popover | 610 * @return {?UI.PopoverContent} |
| 624 * @return {!Promise<boolean>} | |
| 625 */ | 611 */ |
| 626 _showObjectPopover(element, popover) { | 612 _getPopoverContent(event) { |
| 627 if (!this._profile.target() || !element.node) | 613 var span = event.target.enclosingNodeOrSelfWithNodeName('span'); |
| 628 return Promise.resolve(false); | 614 var row = event.target.enclosingNodeOrSelfWithNodeName('tr'); |
| 629 | 615 var target = this._profile.target(); |
| 630 var fulfill; | 616 if (!row || !span || !target) |
| 631 var promise = new Promise(x => fulfill = x); | 617 return null; |
| 632 element.node.queryObjectContent(this._profile.target(), onObjectResolved.bin d(this), 'popover'); | 618 var node = row._dataGridNode; |
| 633 return promise; | 619 var objectPopoverHelper; |
| 634 | 620 return { |
| 635 /** | 621 box: span.boxInWindow(), |
| 636 * @param {?SDK.RemoteObject} result | 622 show: async popover => { |
| 637 * @this {Profiler.HeapSnapshotView} | 623 var remoteObject = await node.queryObjectContent(target, 'popover'); |
| 638 */ | 624 if (!remoteObject) |
| 639 function onObjectResolved(result) { | 625 return false; |
| 640 if (!result) { | 626 objectPopoverHelper = await ObjectUI.ObjectPopoverHelper.buildObjectPopo ver(remoteObject, popover); |
| 641 fulfill(false); | 627 if (!objectPopoverHelper) { |
| 642 return; | 628 target.runtimeModel.releaseObjectGroup('popover'); |
|
lushnikov
2017/03/14 01:44:03
these partial clean-ups would be easy to forget. M
dgozman
2017/03/14 21:34:01
I think that would be a strange API and will not d
| |
| 629 return false; | |
| 630 } | |
| 631 return true; | |
| 632 }, | |
| 633 hide: () => { | |
| 634 target.runtimeModel.releaseObjectGroup('popover'); | |
| 635 objectPopoverHelper.dispose(); | |
| 643 } | 636 } |
| 644 ObjectUI.ObjectPopoverHelper.buildObjectPopover(result, popover).then(obje ctPopoverHelper => { | 637 }; |
| 645 if (!objectPopoverHelper) { | |
| 646 this._onHidePopover(); // Cleanup object resolving artifacts. | |
| 647 fulfill(false); | |
| 648 return; | |
| 649 } | |
| 650 this._objectPopoverHelper = objectPopoverHelper; | |
| 651 fulfill(true); | |
| 652 }); | |
| 653 } | |
| 654 } | |
| 655 | |
| 656 _onHidePopover() { | |
| 657 if (this._objectPopoverHelper) { | |
| 658 this._objectPopoverHelper.dispose(); | |
| 659 delete this._objectPopoverHelper; | |
| 660 } | |
| 661 this._profile.target().runtimeModel.releaseObjectGroup('popover'); | |
| 662 } | 638 } |
| 663 | 639 |
| 664 _updatePerspectiveOptions() { | 640 _updatePerspectiveOptions() { |
| 665 const multipleSnapshots = this._profiles().length > 1; | 641 const multipleSnapshots = this._profiles().length > 1; |
| 666 this._perspectiveSelect.removeOptions(); | 642 this._perspectiveSelect.removeOptions(); |
| 667 this._perspectives.forEach((perspective, index) => { | 643 this._perspectives.forEach((perspective, index) => { |
| 668 if (multipleSnapshots || perspective !== this._comparisonPerspective) | 644 if (multipleSnapshots || perspective !== this._comparisonPerspective) |
| 669 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex)); | 645 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex)); |
| 670 }); | 646 }); |
| 671 } | 647 } |
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2135 var name = frameDiv.createChild('div'); | 2111 var name = frameDiv.createChild('div'); |
| 2136 name.textContent = UI.beautifyFunctionName(frame.functionName); | 2112 name.textContent = UI.beautifyFunctionName(frame.functionName); |
| 2137 if (frame.scriptId) { | 2113 if (frame.scriptId) { |
| 2138 var urlElement = this._linkifier.linkifyScriptLocation( | 2114 var urlElement = this._linkifier.linkifyScriptLocation( |
| 2139 this._target, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1); | 2115 this._target, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1); |
| 2140 frameDiv.appendChild(urlElement); | 2116 frameDiv.appendChild(urlElement); |
| 2141 } | 2117 } |
| 2142 } | 2118 } |
| 2143 } | 2119 } |
| 2144 }; | 2120 }; |
| OLD | NEW |