| 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) { | 608 /** |
| 611 var span = target.enclosingNodeOrSelfWithNodeName('span'); | 609 * @param {!Event} event |
| 612 if (!span) | 610 * @return {?UI.PopoverContent} |
| 613 return; | 611 */ |
| 614 var row = target.enclosingNodeOrSelfWithNodeName('tr'); | 612 _getPopoverContent(event) { |
| 615 if (!row) | 613 var span = event.target.enclosingNodeOrSelfWithNodeName('span'); |
| 616 return; | 614 var row = event.target.enclosingNodeOrSelfWithNodeName('tr'); |
| 617 span.node = row._dataGridNode; | 615 if (!row || !span) |
| 618 return span; | 616 return null; |
| 619 } | 617 var node = row._dataGridNode; |
| 618 var objectPopoverHelper; |
| 619 return { |
| 620 box: span.boxInWindow(), |
| 621 show: popover => { |
| 622 if (!this._profile.target()) |
| 623 return Promise.resolve(false); |
| 620 | 624 |
| 621 /** | 625 var fulfill; |
| 622 * @param {!Element|!AnchorBox} element | 626 var promise = new Promise(x => fulfill = x); |
| 623 * @param {!UI.GlassPane} popover | 627 node.queryObjectContent(this._profile.target(), onObjectResolved.bind(th
is), 'popover'); |
| 624 * @return {!Promise<boolean>} | 628 return promise; |
| 625 */ | |
| 626 _showObjectPopover(element, popover) { | |
| 627 if (!this._profile.target() || !element.node) | |
| 628 return Promise.resolve(false); | |
| 629 | 629 |
| 630 var fulfill; | 630 /** |
| 631 var promise = new Promise(x => fulfill = x); | 631 * @param {?SDK.RemoteObject} result |
| 632 element.node.queryObjectContent(this._profile.target(), onObjectResolved.bin
d(this), 'popover'); | 632 * @this {Profiler.HeapSnapshotView} |
| 633 return promise; | 633 */ |
| 634 | 634 function onObjectResolved(result) { |
| 635 /** | 635 if (!result) { |
| 636 * @param {?SDK.RemoteObject} result | 636 fulfill(false); |
| 637 * @this {Profiler.HeapSnapshotView} | 637 return; |
| 638 */ | 638 } |
| 639 function onObjectResolved(result) { | 639 ObjectUI.ObjectPopoverHelper.buildObjectPopover(result, popover).then(
helper => { |
| 640 if (!result) { | 640 if (!helper) { |
| 641 fulfill(false); | 641 this._profile.target().runtimeModel.releaseObjectGroup('popover'); |
| 642 return; | 642 fulfill(false); |
| 643 return; |
| 644 } |
| 645 objectPopoverHelper = helper; |
| 646 fulfill(true); |
| 647 }); |
| 648 } |
| 649 }, |
| 650 hide: () => { |
| 651 this._profile.target().runtimeModel.releaseObjectGroup('popover'); |
| 652 objectPopoverHelper.dispose(); |
| 643 } | 653 } |
| 644 ObjectUI.ObjectPopoverHelper.buildObjectPopover(result, popover).then(obje
ctPopoverHelper => { | 654 }; |
| 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 } | 655 } |
| 663 | 656 |
| 664 _updatePerspectiveOptions() { | 657 _updatePerspectiveOptions() { |
| 665 const multipleSnapshots = this._profiles().length > 1; | 658 const multipleSnapshots = this._profiles().length > 1; |
| 666 this._perspectiveSelect.removeOptions(); | 659 this._perspectiveSelect.removeOptions(); |
| 667 this._perspectives.forEach((perspective, index) => { | 660 this._perspectives.forEach((perspective, index) => { |
| 668 if (multipleSnapshots || perspective !== this._comparisonPerspective) | 661 if (multipleSnapshots || perspective !== this._comparisonPerspective) |
| 669 this._perspectiveSelect.createOption(perspective.title(), '', String(ind
ex)); | 662 this._perspectiveSelect.createOption(perspective.title(), '', String(ind
ex)); |
| 670 }); | 663 }); |
| 671 } | 664 } |
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 var name = frameDiv.createChild('div'); | 2128 var name = frameDiv.createChild('div'); |
| 2136 name.textContent = UI.beautifyFunctionName(frame.functionName); | 2129 name.textContent = UI.beautifyFunctionName(frame.functionName); |
| 2137 if (frame.scriptId) { | 2130 if (frame.scriptId) { |
| 2138 var urlElement = this._linkifier.linkifyScriptLocation( | 2131 var urlElement = this._linkifier.linkifyScriptLocation( |
| 2139 this._target, String(frame.scriptId), frame.scriptName, frame.line -
1, frame.column - 1); | 2132 this._target, String(frame.scriptId), frame.scriptName, frame.line -
1, frame.column - 1); |
| 2140 frameDiv.appendChild(urlElement); | 2133 frameDiv.appendChild(urlElement); |
| 2141 } | 2134 } |
| 2142 } | 2135 } |
| 2143 } | 2136 } |
| 2144 }; | 2137 }; |
| OLD | NEW |