| 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, this._getPopoverReq
uest.bind(this)); |
| 157 this._popoverHelper.initializeCallbacks( | 157 this._popoverHelper.setDisableOnClick(true); |
| 158 this._getHoverAnchor.bind(this), this._showObjectPopover.bind(this), thi
s._onHidePopover.bind(this)); | |
| 159 this._popoverHelper.setHasPadding(true); | 158 this._popoverHelper.setHasPadding(true); |
| 160 this.element.addEventListener('scroll', this._popoverHelper.hidePopover.bind
(this._popoverHelper), true); | 159 this.element.addEventListener('scroll', this._popoverHelper.hidePopover.bind
(this._popoverHelper), true); |
| 161 | 160 |
| 162 this._currentPerspectiveIndex = 0; | 161 this._currentPerspectiveIndex = 0; |
| 163 this._currentPerspective = this._perspectives[0]; | 162 this._currentPerspective = this._perspectives[0]; |
| 164 this._currentPerspective.activate(this); | 163 this._currentPerspective.activate(this); |
| 165 this._dataGrid = this._currentPerspective.masterGrid(this); | 164 this._dataGrid = this._currentPerspective.masterGrid(this); |
| 166 | 165 |
| 167 this._populate(); | 166 this._populate(); |
| 168 this._searchThrottler = new Common.Throttler(0); | 167 this._searchThrottler = new Common.Throttler(0); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 * @param {?Profiler.HeapSnapshotGridNode} node | 599 * @param {?Profiler.HeapSnapshotGridNode} node |
| 601 */ | 600 */ |
| 602 function didRevealObject(node) { | 601 function didRevealObject(node) { |
| 603 if (node) | 602 if (node) |
| 604 node.select(); | 603 node.select(); |
| 605 else | 604 else |
| 606 Common.console.error('Cannot find corresponding heap snapshot node'); | 605 Common.console.error('Cannot find corresponding heap snapshot node'); |
| 607 } | 606 } |
| 608 } | 607 } |
| 609 | 608 |
| 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 /** | 609 /** |
| 622 * @param {!Element|!AnchorBox} element | 610 * @param {!Event} event |
| 623 * @param {!UI.GlassPane} popover | 611 * @return {?UI.PopoverRequest} |
| 624 * @return {!Promise<boolean>} | |
| 625 */ | 612 */ |
| 626 _showObjectPopover(element, popover) { | 613 _getPopoverRequest(event) { |
| 627 if (!this._profile.target() || !element.node) | 614 var span = event.target.enclosingNodeOrSelfWithNodeName('span'); |
| 628 return Promise.resolve(false); | 615 var row = event.target.enclosingNodeOrSelfWithNodeName('tr'); |
| 629 | 616 var target = this._profile.target(); |
| 630 var fulfill; | 617 if (!row || !span || !target) |
| 631 var promise = new Promise(x => fulfill = x); | 618 return null; |
| 632 element.node.queryObjectContent(this._profile.target(), onObjectResolved.bin
d(this), 'popover'); | 619 var node = row._dataGridNode; |
| 633 return promise; | 620 var objectPopoverHelper; |
| 634 | 621 return { |
| 635 /** | 622 box: span.boxInWindow(), |
| 636 * @param {?SDK.RemoteObject} result | 623 show: async popover => { |
| 637 * @this {Profiler.HeapSnapshotView} | 624 var remoteObject = await node.queryObjectContent(target, 'popover'); |
| 638 */ | 625 if (!remoteObject) |
| 639 function onObjectResolved(result) { | 626 return false; |
| 640 if (!result) { | 627 objectPopoverHelper = await ObjectUI.ObjectPopoverHelper.buildObjectPopo
ver(remoteObject, popover); |
| 641 fulfill(false); | 628 if (!objectPopoverHelper) { |
| 642 return; | 629 target.runtimeModel.releaseObjectGroup('popover'); |
| 630 return false; |
| 631 } |
| 632 return true; |
| 633 }, |
| 634 hide: () => { |
| 635 target.runtimeModel.releaseObjectGroup('popover'); |
| 636 objectPopoverHelper.dispose(); |
| 643 } | 637 } |
| 644 ObjectUI.ObjectPopoverHelper.buildObjectPopover(result, popover).then(obje
ctPopoverHelper => { | 638 }; |
| 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 } | 639 } |
| 663 | 640 |
| 664 _updatePerspectiveOptions() { | 641 _updatePerspectiveOptions() { |
| 665 const multipleSnapshots = this._profiles().length > 1; | 642 const multipleSnapshots = this._profiles().length > 1; |
| 666 this._perspectiveSelect.removeOptions(); | 643 this._perspectiveSelect.removeOptions(); |
| 667 this._perspectives.forEach((perspective, index) => { | 644 this._perspectives.forEach((perspective, index) => { |
| 668 if (multipleSnapshots || perspective !== this._comparisonPerspective) | 645 if (multipleSnapshots || perspective !== this._comparisonPerspective) |
| 669 this._perspectiveSelect.createOption(perspective.title(), '', String(ind
ex)); | 646 this._perspectiveSelect.createOption(perspective.title(), '', String(ind
ex)); |
| 670 }); | 647 }); |
| 671 } | 648 } |
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 var name = frameDiv.createChild('div'); | 2112 var name = frameDiv.createChild('div'); |
| 2136 name.textContent = UI.beautifyFunctionName(frame.functionName); | 2113 name.textContent = UI.beautifyFunctionName(frame.functionName); |
| 2137 if (frame.scriptId) { | 2114 if (frame.scriptId) { |
| 2138 var urlElement = this._linkifier.linkifyScriptLocation( | 2115 var urlElement = this._linkifier.linkifyScriptLocation( |
| 2139 this._target, String(frame.scriptId), frame.scriptName, frame.line -
1, frame.column - 1); | 2116 this._target, String(frame.scriptId), frame.scriptName, frame.line -
1, frame.column - 1); |
| 2140 frameDiv.appendChild(urlElement); | 2117 frameDiv.appendChild(urlElement); |
| 2141 } | 2118 } |
| 2142 } | 2119 } |
| 2143 } | 2120 } |
| 2144 }; | 2121 }; |
| OLD | NEW |