Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js

Issue 2745903003: [DevTools] Do not inherit ObjectPopoverHelper from PopoverHelper. (Closed)
Patch Set: addressed review comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 ObjectUI.ObjectPopoverHelper( 156 this._popoverHelper = new UI.PopoverHelper(this.element, true);
157 this.element, this._getHoverAnchor.bind(this), this._resolveObjectForPop over.bind(this), undefined, true); 157 this._popoverHelper.initializeCallbacks(
158 this._getHoverAnchor.bind(this), this._showObjectPopover.bind(this), thi s._onHidePopover.bind(this));
159 this._popoverHelper.setHasPadding(true);
160 this.element.addEventListener('scroll', this._popoverHelper.hidePopover.bind (this._popoverHelper), true);
158 161
159 this._currentPerspectiveIndex = 0; 162 this._currentPerspectiveIndex = 0;
160 this._currentPerspective = this._perspectives[0]; 163 this._currentPerspective = this._perspectives[0];
161 this._currentPerspective.activate(this); 164 this._currentPerspective.activate(this);
162 this._dataGrid = this._currentPerspective.masterGrid(this); 165 this._dataGrid = this._currentPerspective.masterGrid(this);
163 166
164 this._populate(); 167 this._populate();
165 this._searchThrottler = new Common.Throttler(0); 168 this._searchThrottler = new Common.Throttler(0);
166 } 169 }
167 170
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 var span = target.enclosingNodeOrSelfWithNodeName('span'); 611 var span = target.enclosingNodeOrSelfWithNodeName('span');
609 if (!span) 612 if (!span)
610 return; 613 return;
611 var row = target.enclosingNodeOrSelfWithNodeName('tr'); 614 var row = target.enclosingNodeOrSelfWithNodeName('tr');
612 if (!row) 615 if (!row)
613 return; 616 return;
614 span.node = row._dataGridNode; 617 span.node = row._dataGridNode;
615 return span; 618 return span;
616 } 619 }
617 620
618 _resolveObjectForPopover(element, showCallback, objectGroupName) { 621 /**
619 if (!this._profile.target()) 622 * @param {!Element|!AnchorBox} element
620 return; 623 * @param {!UI.GlassPane} popover
621 if (!element.node) 624 * @return {!Promise<boolean>}
622 return; 625 */
623 element.node.queryObjectContent(this._profile.target(), showCallback, object GroupName); 626 _showObjectPopover(element, popover) {
627 if (!this._profile.target() || !element.node)
628 return Promise.resolve(false);
629
630 var fulfill;
631 var promise = new Promise(x => fulfill = x);
632 element.node.queryObjectContent(this._profile.target(), onObjectResolved.bin d(this), 'popover');
633 return promise;
634
635 /**
636 * @param {?SDK.RemoteObject} result
637 * @this {Profiler.HeapSnapshotView}
638 */
639 function onObjectResolved(result) {
640 if (!result) {
641 fulfill(false);
642 return;
643 }
644 ObjectUI.ObjectPopoverHelper.buildObjectPopover(result, popover).then(obje ctPopoverHelper => {
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');
624 } 662 }
625 663
626 _updatePerspectiveOptions() { 664 _updatePerspectiveOptions() {
627 const multipleSnapshots = this._profiles().length > 1; 665 const multipleSnapshots = this._profiles().length > 1;
628 this._perspectiveSelect.removeOptions(); 666 this._perspectiveSelect.removeOptions();
629 this._perspectives.forEach((perspective, index) => { 667 this._perspectives.forEach((perspective, index) => {
630 if (multipleSnapshots || perspective !== this._comparisonPerspective) 668 if (multipleSnapshots || perspective !== this._comparisonPerspective)
631 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex)); 669 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex));
632 }); 670 });
633 } 671 }
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 var name = frameDiv.createChild('div'); 2135 var name = frameDiv.createChild('div');
2098 name.textContent = UI.beautifyFunctionName(frame.functionName); 2136 name.textContent = UI.beautifyFunctionName(frame.functionName);
2099 if (frame.scriptId) { 2137 if (frame.scriptId) {
2100 var urlElement = this._linkifier.linkifyScriptLocation( 2138 var urlElement = this._linkifier.linkifyScriptLocation(
2101 this._target, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1); 2139 this._target, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1);
2102 frameDiv.appendChild(urlElement); 2140 frameDiv.appendChild(urlElement);
2103 } 2141 }
2104 } 2142 }
2105 } 2143 }
2106 }; 2144 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698