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

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: 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._objectPopoverHelper = new ObjectUI.ObjectPopoverHelper();
161 this.element.addEventListener('scroll', this._popoverHelper.hidePopover.bind (this._popoverHelper), true);
158 162
159 this._currentPerspectiveIndex = 0; 163 this._currentPerspectiveIndex = 0;
160 this._currentPerspective = this._perspectives[0]; 164 this._currentPerspective = this._perspectives[0];
161 this._currentPerspective.activate(this); 165 this._currentPerspective.activate(this);
162 this._dataGrid = this._currentPerspective.masterGrid(this); 166 this._dataGrid = this._currentPerspective.masterGrid(this);
163 167
164 this._populate(); 168 this._populate();
165 this._searchThrottler = new Common.Throttler(0); 169 this._searchThrottler = new Common.Throttler(0);
166 } 170 }
167 171
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 var span = target.enclosingNodeOrSelfWithNodeName('span'); 612 var span = target.enclosingNodeOrSelfWithNodeName('span');
609 if (!span) 613 if (!span)
610 return; 614 return;
611 var row = target.enclosingNodeOrSelfWithNodeName('tr'); 615 var row = target.enclosingNodeOrSelfWithNodeName('tr');
612 if (!row) 616 if (!row)
613 return; 617 return;
614 span.node = row._dataGridNode; 618 span.node = row._dataGridNode;
615 return span; 619 return span;
616 } 620 }
617 621
618 _resolveObjectForPopover(element, showCallback, objectGroupName) { 622 /**
619 if (!this._profile.target()) 623 * @param {!Element|!AnchorBox} element
620 return; 624 * @param {!UI.GlassPane} popover
621 if (!element.node) 625 * @return {!Promise<boolean>}
622 return; 626 */
623 element.node.queryObjectContent(this._profile.target(), showCallback, object GroupName); 627 _showObjectPopover(element, popover) {
628 if (!this._profile.target() || !element.node)
629 return Promise.resolve(false);
630
631 var fulfill;
632 var promise = new Promise(x => fulfill = x);
633 element.node.queryObjectContent(this._profile.target(), onObjectResolved.bin d(this), 'popover');
634 return promise;
635
636 /**
637 * @param {?SDK.RemoteObject} result
638 * @this {Profiler.HeapSnapshotView}
639 */
640 function onObjectResolved(result) {
641 if (result)
642 this._objectPopoverHelper.buildObjectPopover(result, popover).then(fulfi ll);
643 else
644 fulfill(false);
645 }
646 }
647
648 _onHidePopover() {
649 this._objectPopoverHelper.dispose();
650 this._profile.target().runtimeModel.releaseObjectGroup('popover');
624 } 651 }
625 652
626 _updatePerspectiveOptions() { 653 _updatePerspectiveOptions() {
627 const multipleSnapshots = this._profiles().length > 1; 654 const multipleSnapshots = this._profiles().length > 1;
628 this._perspectiveSelect.removeOptions(); 655 this._perspectiveSelect.removeOptions();
629 this._perspectives.forEach((perspective, index) => { 656 this._perspectives.forEach((perspective, index) => {
630 if (multipleSnapshots || perspective !== this._comparisonPerspective) 657 if (multipleSnapshots || perspective !== this._comparisonPerspective)
631 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex)); 658 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex));
632 }); 659 });
633 } 660 }
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 var name = frameDiv.createChild('div'); 2124 var name = frameDiv.createChild('div');
2098 name.textContent = UI.beautifyFunctionName(frame.functionName); 2125 name.textContent = UI.beautifyFunctionName(frame.functionName);
2099 if (frame.scriptId) { 2126 if (frame.scriptId) {
2100 var urlElement = this._linkifier.linkifyScriptLocation( 2127 var urlElement = this._linkifier.linkifyScriptLocation(
2101 this._target, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1); 2128 this._target, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1);
2102 frameDiv.appendChild(urlElement); 2129 frameDiv.appendChild(urlElement);
2103 } 2130 }
2104 } 2131 }
2105 } 2132 }
2106 }; 2133 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698