Migrates profiler/ to ESM internally
Bug: 1006759
Change-Id: Ic455b75d0b7f8288c3f009b98f05b2aa9c3ac9ce
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1997345
Commit-Queue: Paul Lewis <[email protected]>
Reviewed-by: Tim van der Lippe <[email protected]>
diff --git a/front_end/profiler/BottomUpProfileDataGrid.js b/front_end/profiler/BottomUpProfileDataGrid.js
index 92bcb55..9e70a28 100644
--- a/front_end/profiler/BottomUpProfileDataGrid.js
+++ b/front_end/profiler/BottomUpProfileDataGrid.js
@@ -28,13 +28,16 @@
// each child still represent the root node. We have to be particularly careful of recursion with this mode
// because a root node can represent itself AND an ancestor.
+import {Formatter, ProfileDataGridNode, ProfileDataGridTree} from './ProfileDataGrid.js'; // eslint-disable-line no-unused-vars
+import {TopDownProfileDataGridTree} from './TopDownProfileDataGrid.js'; // eslint-disable-line no-unused-vars
+
/**
* @unrestricted
*/
-export class BottomUpProfileDataGridNode extends Profiler.ProfileDataGridNode {
+export class BottomUpProfileDataGridNode extends ProfileDataGridNode {
/**
* @param {!SDK.ProfileNode} profileNode
- * @param {!Profiler.TopDownProfileDataGridTree} owningTree
+ * @param {!TopDownProfileDataGridTree} owningTree
*/
constructor(profileNode, owningTree) {
super(profileNode, owningTree, !!profileNode.parent && !!profileNode.parent.parent);
@@ -66,8 +69,7 @@
} else {
// If not, add it as a true ancestor.
// In heavy mode, we take our visual identity from ancestor node...
- child = new BottomUpProfileDataGridNode(
- ancestor, /** @type {!Profiler.TopDownProfileDataGridTree} */ (container.tree));
+ child = new BottomUpProfileDataGridNode(ancestor, /** @type {!TopDownProfileDataGridTree} */ (container.tree));
if (ancestor !== focusNode) {
// But the actual statistics from the "root" node (bottom of the callstack).
@@ -89,7 +91,7 @@
}
/**
- * @param {!Profiler.ProfileDataGridNode} profileDataGridNode
+ * @param {!ProfileDataGridNode} profileDataGridNode
*/
_takePropertiesFromProfileDataGridNode(profileDataGridNode) {
this.save();
@@ -99,7 +101,7 @@
/**
* When focusing, we keep just the members of the callstack.
- * @param {!Profiler.ProfileDataGridNode} child
+ * @param {!ProfileDataGridNode} child
*/
_keepOnlyChild(child) {
this.save();
@@ -145,7 +147,7 @@
/**
* @override
- * @param {!Profiler.ProfileDataGridNode} child
+ * @param {!ProfileDataGridNode} child
* @param {boolean} shouldAbsorb
*/
merge(child, shouldAbsorb) {
@@ -170,9 +172,9 @@
/**
* @unrestricted
*/
-export class BottomUpProfileDataGridTree extends Profiler.ProfileDataGridTree {
+export class BottomUpProfileDataGridTree extends ProfileDataGridTree {
/**
- * @param {!Profiler.ProfileDataGridNode.Formatter} formatter
+ * @param {!Formatter} formatter
* @param {!UI.SearchableView} searchableView
* @param {!SDK.ProfileNode} rootProfileNode
* @param {number} total
@@ -236,14 +238,14 @@
}
// Populate the top level nodes.
- Profiler.ProfileDataGridNode.populate(this);
+ ProfileDataGridNode.populate(this);
return this;
}
/**
* When focusing, we keep the entire callstack up to this ancestor.
- * @param {!Profiler.ProfileDataGridNode} profileDataGridNode
+ * @param {!ProfileDataGridNode} profileDataGridNode
*/
focus(profileDataGridNode) {
if (!profileDataGridNode) {
@@ -255,13 +257,13 @@
let currentNode = profileDataGridNode;
let focusNode = profileDataGridNode;
- while (currentNode.parent && (currentNode instanceof Profiler.ProfileDataGridNode)) {
+ while (currentNode.parent && (currentNode instanceof ProfileDataGridNode)) {
currentNode._takePropertiesFromProfileDataGridNode(profileDataGridNode);
focusNode = currentNode;
currentNode = currentNode.parent;
- if (currentNode instanceof Profiler.ProfileDataGridNode) {
+ if (currentNode instanceof ProfileDataGridNode) {
currentNode._keepOnlyChild(focusNode);
}
}
@@ -271,7 +273,7 @@
}
/**
- * @param {!Profiler.ProfileDataGridNode} profileDataGridNode
+ * @param {!ProfileDataGridNode} profileDataGridNode
*/
exclude(profileDataGridNode) {
if (!profileDataGridNode) {
@@ -308,15 +310,3 @@
BottomUpProfileDataGridNode._sharedPopulate(this);
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.BottomUpProfileDataGridNode = BottomUpProfileDataGridNode;
-
-/** @constructor */
-Profiler.BottomUpProfileDataGridTree = BottomUpProfileDataGridTree;
diff --git a/front_end/profiler/CPUProfileFlameChart.js b/front_end/profiler/CPUProfileFlameChart.js
index a9546f6..4e46c36 100644
--- a/front_end/profiler/CPUProfileFlameChart.js
+++ b/front_end/profiler/CPUProfileFlameChart.js
@@ -195,7 +195,7 @@
* @implements {UI.Searchable}
* @unrestricted
*/
-export default class CPUProfileFlameChart extends UI.VBox {
+export class CPUProfileFlameChart extends UI.VBox {
/**
* @param {!UI.SearchableView} searchableView
* @param {!ProfileFlameChartDataProvider} dataProvider
@@ -590,21 +590,3 @@
this._overviewCanvas.style.height = height + 'px';
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.CPUProfileFlameChart = CPUProfileFlameChart;
-
-/** @constructor */
-Profiler.CPUProfileFlameChart.OverviewCalculator = OverviewCalculator;
-
-/** @constructor */
-Profiler.CPUProfileFlameChart.OverviewPane = OverviewPane;
-
-/** @constructor */
-Profiler.ProfileFlameChartDataProvider = ProfileFlameChartDataProvider;
diff --git a/front_end/profiler/CPUProfileView.js b/front_end/profiler/CPUProfileView.js
index dc5560a..f760bc2 100644
--- a/front_end/profiler/CPUProfileView.js
+++ b/front_end/profiler/CPUProfileView.js
@@ -23,11 +23,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import {ProfileFlameChartDataProvider} from './CPUProfileFlameChart.js';
+import {Formatter, ProfileDataGridNode} from './ProfileDataGrid.js'; // eslint-disable-line no-unused-vars
+import {ProfileEvents, ProfileHeader, ProfileType} from './ProfileHeader.js'; // eslint-disable-line no-unused-vars
+import {ProfileView, WritableProfileHeader} from './ProfileView.js';
+
/**
* @implements {UI.Searchable}
* @unrestricted
*/
-export default class CPUProfileView extends Profiler.ProfileView {
+export class CPUProfileView extends ProfileView {
/**
* @param {!CPUProfileHeader} profileHeader
*/
@@ -68,7 +73,7 @@
/**
* @override
- * @return {!Profiler.ProfileFlameChartDataProvider}
+ * @return {!ProfileFlameChartDataProvider}
*/
createFlameChartDataProvider() {
return new CPUFlameChartDataProvider(this._profileHeader.profileModel(), this._profileHeader._cpuProfilerModel);
@@ -78,7 +83,7 @@
/**
* @unrestricted
*/
-export class CPUProfileType extends Profiler.ProfileType {
+export class CPUProfileType extends ProfileType {
constructor() {
super(CPUProfileType.TypeId, Common.UIString('Record JavaScript CPU Profile'));
this._recording = false;
@@ -189,13 +194,13 @@
}
await SDK.targetManager.resumeAllTargets();
- this.dispatchEventToListeners(Profiler.ProfileType.Events.ProfileComplete, recordedProfile);
+ this.dispatchEventToListeners(ProfileEvents.ProfileComplete, recordedProfile);
}
/**
* @override
* @param {string} title
- * @return {!Profiler.ProfileHeader}
+ * @return {!ProfileHeader}
*/
createProfileLoadedFromFile(title) {
return new CPUProfileHeader(null, this, title);
@@ -214,7 +219,7 @@
/**
* @unrestricted
*/
-export class CPUProfileHeader extends Profiler.WritableProfileHeader {
+export class CPUProfileHeader extends WritableProfileHeader {
/**
* @param {?SDK.CPUProfilerModel} cpuProfilerModel
* @param {!CPUProfileType} type
@@ -227,7 +232,7 @@
/**
* @override
- * @return {!Profiler.ProfileView}
+ * @return {!ProfileView}
*/
createView() {
return new CPUProfileView(this);
@@ -258,7 +263,7 @@
}
/**
- * @implements {Profiler.ProfileDataGridNode.Formatter}
+ * @implements {Formatter}
* @unrestricted
*/
export class NodeFormatter {
@@ -290,7 +295,7 @@
/**
* @override
* @param {number} value
- * @param {!Profiler.ProfileDataGridNode} node
+ * @param {!ProfileDataGridNode} node
* @return {string}
*/
formatPercent(value, node) {
@@ -299,7 +304,7 @@
/**
* @override
- * @param {!Profiler.ProfileDataGridNode} node
+ * @param {!ProfileDataGridNode} node
* @return {?Element}
*/
linkifyNode(node) {
@@ -313,7 +318,7 @@
/**
* @unrestricted
*/
-export class CPUFlameChartDataProvider extends Profiler.ProfileFlameChartDataProvider {
+export class CPUFlameChartDataProvider extends ProfileFlameChartDataProvider {
/**
* @param {!SDK.CPUProfileDataModel} cpuProfile
* @param {?SDK.CPUProfilerModel} cpuProfilerModel
@@ -434,7 +439,7 @@
pushEntryInfoRow(ls`Not optimized`, node.deoptReason);
}
- return Profiler.ProfileView.buildPopoverTable(entryInfo);
+ return ProfileView.buildPopoverTable(entryInfo);
}
}
@@ -457,24 +462,3 @@
this.node = node;
}
};
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.CPUProfileView = CPUProfileView;
-
-/** @constructor */
-Profiler.CPUProfileView.NodeFormatter = NodeFormatter;
-
-/** @constructor */
-Profiler.CPUProfileType = CPUProfileType;
-
-/** @constructor */
-Profiler.CPUProfileHeader = CPUProfileHeader;
-
-/** @constructor */
-Profiler.CPUFlameChartDataProvider = CPUFlameChartDataProvider;
diff --git a/front_end/profiler/ChildrenProvider.js b/front_end/profiler/ChildrenProvider.js
new file mode 100644
index 0000000..307dcbd
--- /dev/null
+++ b/front_end/profiler/ChildrenProvider.js
@@ -0,0 +1,39 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @interface
+ */
+export class ChildrenProvider {
+ dispose() {
+ }
+
+ /**
+ * @param {number} snapshotObjectId
+ * @return {!Promise<number>}
+ */
+ nodePosition(snapshotObjectId) {
+ }
+
+ /**
+ * @return {!Promise<boolean>}
+ */
+ isEmpty() {
+ }
+
+ /**
+ * @param {number} startPosition
+ * @param {number} endPosition
+ * @return {!Promise<!HeapSnapshotModel.ItemsRange>}
+ */
+ serializeItemsRange(startPosition, endPosition) {
+ }
+
+ /**
+ * @param {!HeapSnapshotModel.ComparatorConfig} comparator
+ * @return {!Promise<?>}
+ */
+ sortAndRewind(comparator) {
+ }
+}
diff --git a/front_end/profiler/HeapProfileView.js b/front_end/profiler/HeapProfileView.js
index d15be65..01261cc 100644
--- a/front_end/profiler/HeapProfileView.js
+++ b/front_end/profiler/HeapProfileView.js
@@ -2,11 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import {ProfileFlameChartDataProvider} from './CPUProfileFlameChart.js';
+import {HeapTimelineOverview, IdsRangeChanged, Samples} from './HeapTimelineOverview.js'; // eslint-disable-line no-unused-vars
+import {Formatter, ProfileDataGridNode} from './ProfileDataGrid.js'; // eslint-disable-line no-unused-vars
+import {ProfileEvents, ProfileHeader, ProfileType} from './ProfileHeader.js'; // eslint-disable-line no-unused-vars
+import {ProfileView, ViewTypes, WritableProfileHeader} from './ProfileView.js';
+
/**
* @implements {UI.Searchable}
* @unrestricted
*/
-export default class HeapProfileView extends Profiler.ProfileView {
+export class HeapProfileView extends ProfileView {
/**
* @param {!SamplingHeapProfileHeader} profileHeader
*/
@@ -15,14 +21,12 @@
this._profileHeader = profileHeader;
this._profileType = profileHeader.profileType();
- const views = [
- Profiler.ProfileView.ViewTypes.Flame, Profiler.ProfileView.ViewTypes.Heavy, Profiler.ProfileView.ViewTypes.Tree
- ];
+ const views = [ViewTypes.Flame, ViewTypes.Heavy, ViewTypes.Tree];
const isNativeProfile = this._profileType.id === SamplingNativeHeapProfileType.TypeId ||
this._profileType.id === SamplingNativeHeapSnapshotType.TypeId;
if (isNativeProfile) {
- views.push(Profiler.ProfileView.ViewTypes.Text);
+ views.push(ViewTypes.Text);
}
this.initialize(new NodeFormatter(this), views);
@@ -33,14 +37,13 @@
this._selectedSizeText = new UI.ToolbarText();
if (Root.Runtime.experiments.isEnabled('samplingHeapProfilerTimeline')) {
- this._timelineOverview = new Profiler.HeapTimelineOverview();
- this._timelineOverview.addEventListener(
- Profiler.HeapTimelineOverview.IdsRangeChanged, this._onIdsRangeChanged.bind(this));
+ this._timelineOverview = new HeapTimelineOverview();
+ this._timelineOverview.addEventListener(IdsRangeChanged, this._onIdsRangeChanged.bind(this));
this._timelineOverview.show(this.element, this.element.firstChild);
this._timelineOverview.start();
this._profileType.addEventListener(SamplingHeapProfileType.Events.StatsUpdate, this._onStatsUpdate, this);
- this._profileType.once(Profiler.ProfileType.Events.ProfileComplete).then(() => {
+ this._profileType.once(ProfileEvents.ProfileComplete).then(() => {
this._profileType.removeEventListener(SamplingHeapProfileType.Events.StatsUpdate, this._onStatsUpdate, this);
this._timelineOverview.stop();
this._timelineOverview.updateGrid();
@@ -107,7 +110,7 @@
this._totalTime *= 2;
}
- const samples = /** @type {!Profiler.HeapTimelineOverview.Samples} */ ({
+ const samples = /** @type {!Samples} */ ({
sizes: this._sizes,
max: this._max,
ids: this._ordinals,
@@ -135,7 +138,7 @@
/**
* @override
- * @return {!Profiler.ProfileFlameChartDataProvider}
+ * @return {!ProfileFlameChartDataProvider}
*/
createFlameChartDataProvider() {
return new HeapFlameChartDataProvider(
@@ -219,7 +222,7 @@
/**
* @unrestricted
*/
-export class SamplingHeapProfileTypeBase extends Profiler.ProfileType {
+export class SamplingHeapProfileTypeBase extends ProfileType {
/**
* @param {string} typeId
* @param {string} description
@@ -307,13 +310,13 @@
this.setProfileBeingRecorded(null);
}
UI.inspectorView.setPanelIcon('heap_profiler', null);
- this.dispatchEventToListeners(Profiler.ProfileType.Events.ProfileComplete, recordedProfile);
+ this.dispatchEventToListeners(ProfileEvents.ProfileComplete, recordedProfile);
}
/**
* @override
* @param {string} title
- * @return {!Profiler.ProfileHeader}
+ * @return {!ProfileHeader}
*/
createProfileLoadedFromFile(title) {
return new SamplingHeapProfileHeader(null, this, title);
@@ -522,7 +525,7 @@
this.setProfileBeingRecorded(null);
}
- this.dispatchEventToListeners(Profiler.ProfileType.Events.ProfileComplete, recordedProfile);
+ this.dispatchEventToListeners(ProfileEvents.ProfileComplete, recordedProfile);
}
/**
@@ -571,7 +574,7 @@
/**
* @unrestricted
*/
-export class SamplingHeapProfileHeader extends Profiler.WritableProfileHeader {
+export class SamplingHeapProfileHeader extends WritableProfileHeader {
/**
* @param {?SDK.HeapProfilerModel} heapProfilerModel
* @param {!SamplingHeapProfileTypeBase} type
@@ -588,10 +591,10 @@
/**
* @override
- * @return {!Profiler.ProfileView}
+ * @return {!ProfileView}
*/
createView() {
- return new Profiler.HeapProfileView(this);
+ return new HeapProfileView(this);
}
/**
@@ -697,12 +700,12 @@
}
/**
- * @implements {Profiler.ProfileDataGridNode.Formatter}
+ * @implements {Formatter}
* @unrestricted
*/
export class NodeFormatter {
/**
- * @param {!Profiler.HeapProfileView} profileView
+ * @param {!HeapProfileView} profileView
*/
constructor(profileView) {
this._profileView = profileView;
@@ -729,7 +732,7 @@
/**
* @override
* @param {number} value
- * @param {!Profiler.ProfileDataGridNode} node
+ * @param {!ProfileDataGridNode} node
* @return {string}
*/
formatPercent(value, node) {
@@ -738,7 +741,7 @@
/**
* @override
- * @param {!Profiler.ProfileDataGridNode} node
+ * @param {!ProfileDataGridNode} node
* @return {?Element}
*/
linkifyNode(node) {
@@ -752,7 +755,7 @@
/**
* @unrestricted
*/
-export class HeapFlameChartDataProvider extends Profiler.ProfileFlameChartDataProvider {
+export class HeapFlameChartDataProvider extends ProfileFlameChartDataProvider {
/**
* @param {!SDK.ProfileTreeModel} profile
* @param {?SDK.HeapProfilerModel} heapProfilerModel
@@ -865,48 +868,6 @@
pushEntryInfoRow(ls`URL`, link.textContent);
}
linkifier.dispose();
- return Profiler.ProfileView.buildPopoverTable(entryInfo);
+ return ProfileView.buildPopoverTable(entryInfo);
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.HeapProfileView = HeapProfileView;
-
-/** @constructor */
-Profiler.HeapProfileView.NodeFormatter = NodeFormatter;
-
-/** @constructor */
-Profiler.SamplingHeapProfileTypeBase = SamplingHeapProfileTypeBase;
-
-/** @constructor */
-Profiler.SamplingHeapProfileType = SamplingHeapProfileType;
-
-/** @constructor */
-Profiler.SamplingNativeHeapProfileType = SamplingNativeHeapProfileType;
-
-/** @constructor */
-Profiler.SamplingNativeHeapSnapshotType = SamplingNativeHeapSnapshotType;
-
-/** @constructor */
-Profiler.SamplingNativeHeapSnapshotBrowserType = SamplingNativeHeapSnapshotBrowserType;
-
-/** @constructor */
-Profiler.SamplingNativeHeapSnapshotRendererType = SamplingNativeHeapSnapshotRendererType;
-
-/** @constructor */
-Profiler.SamplingHeapProfileHeader = SamplingHeapProfileHeader;
-
-/** @constructor */
-Profiler.SamplingHeapProfileNode = SamplingHeapProfileNode;
-
-/** @constructor */
-Profiler.SamplingHeapProfileModel = SamplingHeapProfileModel;
-
-/** @constructor */
-Profiler.HeapFlameChartDataProvider = HeapFlameChartDataProvider;
diff --git a/front_end/profiler/HeapProfilerPanel.js b/front_end/profiler/HeapProfilerPanel.js
index 0b1244e..dd3a89b 100644
--- a/front_end/profiler/HeapProfilerPanel.js
+++ b/front_end/profiler/HeapProfilerPanel.js
@@ -2,13 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import {ProfilesPanel} from './ProfilesPanel.js';
+import {instance} from './ProfileTypeRegistry.js';
+
/**
* @implements {UI.ContextMenu.Provider}
* @implements {UI.ActionDelegate}
*/
-export default class HeapProfilerPanel extends Profiler.ProfilesPanel {
+export class HeapProfilerPanel extends ProfilesPanel {
constructor() {
- const registry = Profiler.ProfileTypeRegistry.instance;
+ const registry = instance;
const profileTypes =
[registry.heapSnapshotProfileType, registry.trackingHeapSnapshotProfileType, registry.samplingHeapProfileType];
if (Root.Runtime.experiments.isEnabled('nativeHeapProfiler')) {
@@ -40,7 +43,7 @@
}
const objectId = /** @type {string} */ (object.objectId);
- const heapProfiles = Profiler.ProfileTypeRegistry.instance.heapSnapshotProfileType.getProfiles();
+ const heapProfiles = instance.heapSnapshotProfileType.getProfiles();
if (!heapProfiles.length) {
return;
}
@@ -52,7 +55,7 @@
/**
* @param {string} viewName
- * @this {Profiler.ProfilesPanel}
+ * @this {ProfilesPanel}
*/
function revealInView(viewName) {
heapProfilerModel.snapshotObjectIdForObjectId(objectId).then(result => {
@@ -99,7 +102,7 @@
* @param {string} perspectiveName
*/
showObject(snapshotObjectId, perspectiveName) {
- const registry = Profiler.ProfileTypeRegistry.instance;
+ const registry = instance;
const heapProfiles = registry.heapSnapshotProfileType.getProfiles();
for (let i = 0; i < heapProfiles.length; i++) {
const profile = heapProfiles[i];
@@ -113,12 +116,3 @@
}
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.HeapProfilerPanel = HeapProfilerPanel;
diff --git a/front_end/profiler/HeapSnapshotDataGrids.js b/front_end/profiler/HeapSnapshotDataGrids.js
index be1a07d..67212f0 100644
--- a/front_end/profiler/HeapSnapshotDataGrids.js
+++ b/front_end/profiler/HeapSnapshotDataGrids.js
@@ -28,13 +28,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import {AllocationGridNode, HeapSnapshotConstructorNode, HeapSnapshotDiffNode, HeapSnapshotGridNode, HeapSnapshotObjectNode, HeapSnapshotRetainingObjectNode,} from './HeapSnapshotGridNodes.js'; // eslint-disable-line no-unused-vars
+import {HeapSnapshotProxy} from './HeapSnapshotProxy.js'; // eslint-disable-line no-unused-vars
+import {DataDisplayDelegate} from './ProfileHeader.js'; // eslint-disable-line no-unused-vars
+
/**
* @unrestricted
*/
export class HeapSnapshotSortableDataGrid extends DataGrid.DataGrid {
/**
* @param {?SDK.HeapProfilerModel} heapProfilerModel
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
* @param {!DataGrid.Parameters} dataGridParameters
*/
constructor(heapProfilerModel, dataDisplayDelegate, dataGridParameters) {
@@ -58,7 +62,7 @@
*/
this._recursiveSortingDepth = 0;
/**
- * @type {?Profiler.HeapSnapshotGridNode}
+ * @type {?HeapSnapshotGridNode}
*/
this._highlightedNode = null;
/**
@@ -83,7 +87,7 @@
}
/**
- * @return {!Profiler.ProfileType.DataDisplayDelegate}
+ * @return {!DataDisplayDelegate}
*/
dataDisplayDelegate() {
return this._dataDisplayDelegate;
@@ -151,7 +155,7 @@
* @param {!DataGrid.DataGridNode} gridNode
*/
_populateContextMenu(contextMenu, gridNode) {
- const node = /** @type {!Profiler.HeapSnapshotGridNode} */ (gridNode);
+ const node = /** @type {!HeapSnapshotGridNode} */ (gridNode);
node.populateContextMenu(contextMenu, this._dataDisplayDelegate, this.heapProfilerModel());
if (gridNode.linkElement && !contextMenu.containsTarget(gridNode.linkElement)) {
@@ -165,7 +169,7 @@
}
/**
- * @return {!Array<!Profiler.HeapSnapshotGridNode>}
+ * @return {!Array<!HeapSnapshotGridNode>}
*/
topLevelNodes() {
return this.rootNode().children;
@@ -173,14 +177,14 @@
/**
* @param {!Protocol.HeapProfiler.HeapSnapshotObjectId} heapSnapshotObjectId
- * @return {!Promise<?Profiler.HeapSnapshotGridNode>}
+ * @return {!Promise<?HeapSnapshotGridNode>}
*/
revealObjectByHeapSnapshotId(heapSnapshotObjectId) {
- return Promise.resolve(/** @type {?Profiler.HeapSnapshotGridNode} */ (null));
+ return Promise.resolve(/** @type {?HeapSnapshotGridNode} */ (null));
}
/**
- * @param {!Profiler.HeapSnapshotGridNode} node
+ * @param {!HeapSnapshotGridNode} node
*/
highlightNode(node) {
this._clearCurrentHighlight();
@@ -292,7 +296,7 @@
/**
* @param {!DataGrid.DataGridNode} parent
- * @return {!Array.<!Profiler.HeapSnapshotGridNode>}
+ * @return {!Array.<!HeapSnapshotGridNode>}
*/
allChildren(parent) {
return parent.children;
@@ -308,7 +312,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotGridNode} parent
+ * @param {!HeapSnapshotGridNode} parent
* @param {number} index
*/
removeChildByIndex(parent, index) {
@@ -316,7 +320,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotGridNode} parent
+ * @param {!HeapSnapshotGridNode} parent
*/
removeAllChildren(parent) {
parent.removeChildren();
@@ -335,7 +339,7 @@
export class HeapSnapshotViewportDataGrid extends HeapSnapshotSortableDataGrid {
/**
* @param {?SDK.HeapProfilerModel} heapProfilerModel
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
* @param {!DataGrid.Parameters} dataGridParameters
*/
constructor(heapProfilerModel, dataDisplayDelegate, dataGridParameters) {
@@ -347,7 +351,7 @@
/**
* @override
- * @return {!Array.<!Profiler.HeapSnapshotGridNode>}
+ * @return {!Array.<!HeapSnapshotGridNode>}
*/
topLevelNodes() {
return this.allChildren(this.rootNode());
@@ -460,7 +464,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotGridNode} node
+ * @param {!HeapSnapshotGridNode} node
* @return {boolean}
*/
_isFilteredOut(node) {
@@ -473,7 +477,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotGridNode} node
+ * @param {!HeapSnapshotGridNode} node
* @return {number}
*/
_nodeHeight(node) {
@@ -489,12 +493,12 @@
}
/**
- * @param {!Array<!Profiler.HeapSnapshotGridNode>} pathToReveal
+ * @param {!Array<!HeapSnapshotGridNode>} pathToReveal
* @return {!Promise<!Profiler.HeapSnapshotGridNode>}
*/
revealTreeNode(pathToReveal) {
const height = this._calculateOffset(pathToReveal);
- const node = /** @type {!Profiler.HeapSnapshotGridNode} */ (pathToReveal.peekLast());
+ const node = /** @type {!HeapSnapshotGridNode} */ (pathToReveal.peekLast());
const scrollTop = this.scrollContainer.scrollTop;
const scrollBottom = scrollTop + this.scrollContainer.offsetHeight;
if (height >= scrollTop && height < scrollBottom) {
@@ -518,7 +522,7 @@
}
/**
- * @param {!Array.<!Profiler.HeapSnapshotGridNode>} pathToReveal
+ * @param {!Array.<!HeapSnapshotGridNode>} pathToReveal
* @return {number}
*/
_calculateOffset(pathToReveal) {
@@ -543,7 +547,7 @@
/**
* @override
* @param {!DataGrid.DataGridNode} parent
- * @return {!Array.<!Profiler.HeapSnapshotGridNode>}
+ * @return {!Array.<!HeapSnapshotGridNode>}
*/
allChildren(parent) {
return parent._allChildren || (parent._allChildren = []);
@@ -551,7 +555,7 @@
/**
* @param {!DataGrid.DataGridNode} parent
- * @param {!Profiler.HeapSnapshotGridNode} node
+ * @param {!HeapSnapshotGridNode} node
*/
appendNode(parent, node) {
this.allChildren(parent).push(node);
@@ -564,7 +568,7 @@
* @param {number} index
*/
insertChild(parent, node, index) {
- this.allChildren(parent).splice(index, 0, /** @type {!Profiler.HeapSnapshotGridNode} */ (node));
+ this.allChildren(parent).splice(index, 0, /** @type {!HeapSnapshotGridNode} */ (node));
}
/**
@@ -626,7 +630,7 @@
export class HeapSnapshotContainmentDataGrid extends HeapSnapshotSortableDataGrid {
/**
* @param {?SDK.HeapProfilerModel} heapProfilerModel
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
* @param {string} displayName
* @param {!Array.<!DataGrid.ColumnDescriptor>=} columns
*/
@@ -648,7 +652,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotProxy} snapshot
+ * @param {!HeapSnapshotProxy} snapshot
* @param {number} nodeIndex
*/
setDataSource(snapshot, nodeIndex) {
@@ -660,7 +664,7 @@
}
_createRootNode(snapshot, fakeEdge) {
- return new Profiler.HeapSnapshotObjectNode(this, snapshot, fakeEdge, null);
+ return new HeapSnapshotObjectNode(this, snapshot, fakeEdge, null);
}
/**
@@ -680,7 +684,7 @@
export class HeapSnapshotRetainmentDataGrid extends HeapSnapshotContainmentDataGrid {
/**
* @param {?SDK.HeapProfilerModel} heapProfilerModel
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
*/
constructor(heapProfilerModel, dataDisplayDelegate) {
const columns = /** @type {!Array<!DataGrid.ColumnDescriptor>} */ ([
@@ -702,7 +706,7 @@
* @override
*/
_createRootNode(snapshot, fakeEdge) {
- return new Profiler.HeapSnapshotRetainingObjectNode(this, snapshot, fakeEdge, null);
+ return new HeapSnapshotRetainingObjectNode(this, snapshot, fakeEdge, null);
}
_sortFields(sortColumn, sortAscending) {
@@ -722,7 +726,7 @@
/**
* @override
- * @param {!Profiler.HeapSnapshotProxy} snapshot
+ * @param {!HeapSnapshotProxy} snapshot
* @param {number} nodeIndex
*/
setDataSource(snapshot, nodeIndex) {
@@ -742,7 +746,7 @@
export class HeapSnapshotConstructorsDataGrid extends HeapSnapshotViewportDataGrid {
/**
* @param {?SDK.HeapProfilerModel} heapProfilerModel
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
*/
constructor(heapProfilerModel, dataDisplayDelegate) {
const columns = /** @type {!Array<!DataGrid.ColumnDescriptor>} */ ([
@@ -779,7 +783,7 @@
/**
* @override
* @param {!Protocol.HeapProfiler.HeapSnapshotObjectId} id
- * @return {!Promise<?Profiler.HeapSnapshotGridNode>}
+ * @return {!Promise<?HeapSnapshotGridNode>}
*/
async revealObjectByHeapSnapshotId(id) {
if (!this.snapshot) {
@@ -808,7 +812,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotProxy} snapshot
+ * @param {!HeapSnapshotProxy} snapshot
*/
setDataSource(snapshot) {
this.snapshot = snapshot;
@@ -856,8 +860,7 @@
this.resetSortingCache();
for (const constructor in aggregates) {
this.appendNode(
- this.rootNode(),
- new Profiler.HeapSnapshotConstructorNode(this, constructor, aggregates[constructor], nodeFilter));
+ this.rootNode(), new HeapSnapshotConstructorNode(this, constructor, aggregates[constructor], nodeFilter));
}
this.sortingChanged();
this._lastFilter = nodeFilter;
@@ -901,7 +904,7 @@
export class HeapSnapshotDiffDataGrid extends HeapSnapshotViewportDataGrid {
/**
* @param {?SDK.HeapProfilerModel} heapProfilerModel
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
*/
constructor(heapProfilerModel, dataDisplayDelegate) {
const columns = /** @type {!Array<!DataGrid.ColumnDescriptor>} */ ([
@@ -947,7 +950,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotProxy} baseSnapshot
+ * @param {!HeapSnapshotProxy} baseSnapshot
*/
setBaseDataSource(baseSnapshot) {
this.baseSnapshot = baseSnapshot;
@@ -969,7 +972,7 @@
for (const className in diffByClassName) {
const diff = diffByClassName[className];
- this.appendNode(this.rootNode(), new Profiler.HeapSnapshotDiffNode(this, className, diff));
+ this.appendNode(this.rootNode(), new HeapSnapshotDiffNode(this, className, diff));
}
this.sortingChanged();
}
@@ -981,7 +984,7 @@
export class AllocationDataGrid extends HeapSnapshotViewportDataGrid {
/**
* @param {?SDK.HeapProfilerModel} heapProfilerModel
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
*/
constructor(heapProfilerModel, dataDisplayDelegate) {
const columns = /** @type {!Array<!DataGrid.ColumnDescriptor>} */ ([
@@ -1007,7 +1010,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotProxy} snapshot
+ * @param {!HeapSnapshotProxy} snapshot
*/
async setDataSource(snapshot) {
this.snapshot = snapshot;
@@ -1020,7 +1023,7 @@
const root = this.rootNode();
const tops = this._topNodes;
for (const top of tops) {
- this.appendNode(root, new Profiler.AllocationGridNode(this, top));
+ this.appendNode(root, new AllocationGridNode(this, top));
}
this.updateVisibleNodes(true);
}
@@ -1057,30 +1060,3 @@
return compare;
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.HeapSnapshotSortableDataGrid = HeapSnapshotSortableDataGrid;
-
-/** @constructor */
-Profiler.HeapSnapshotViewportDataGrid = HeapSnapshotViewportDataGrid;
-
-/** @constructor */
-Profiler.HeapSnapshotContainmentDataGrid = HeapSnapshotContainmentDataGrid;
-
-/** @constructor */
-Profiler.HeapSnapshotRetainmentDataGrid = HeapSnapshotRetainmentDataGrid;
-
-/** @constructor */
-Profiler.HeapSnapshotConstructorsDataGrid = HeapSnapshotConstructorsDataGrid;
-
-/** @constructor */
-Profiler.HeapSnapshotDiffDataGrid = HeapSnapshotDiffDataGrid;
-
-/** @constructor */
-Profiler.AllocationDataGrid = AllocationDataGrid;
diff --git a/front_end/profiler/HeapSnapshotGridNodes.js b/front_end/profiler/HeapSnapshotGridNodes.js
index 0ec540d..787b7b0 100644
--- a/front_end/profiler/HeapSnapshotGridNodes.js
+++ b/front_end/profiler/HeapSnapshotGridNodes.js
@@ -28,12 +28,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import {ChildrenProvider} from './ChildrenProvider.js'; // eslint-disable-line no-unused-vars
+import {AllocationDataGrid, HeapSnapshotConstructorsDataGrid, HeapSnapshotDiffDataGrid, HeapSnapshotRetainmentDataGrid, HeapSnapshotSortableDataGrid,} from './HeapSnapshotDataGrids.js'; // eslint-disable-line no-unused-vars
+import {HeapSnapshotProviderProxy, HeapSnapshotProxy} from './HeapSnapshotProxy.js'; // eslint-disable-line no-unused-vars
+import {DataDisplayDelegate} from './ProfileHeader.js'; // eslint-disable-line no-unused-vars
+
/**
* @unrestricted
*/
export class HeapSnapshotGridNode extends DataGrid.DataGridNode {
/**
- * @param {!Profiler.HeapSnapshotSortableDataGrid} tree
+ * @param {!HeapSnapshotSortableDataGrid} tree
* @param {boolean} hasChildren
*/
constructor(tree, hasChildren) {
@@ -65,7 +70,7 @@
}
/**
- * @return {!Profiler.HeapSnapshotSortableDataGrid}
+ * @return {!HeapSnapshotSortableDataGrid}
*/
heapSnapshotDataGrid() {
return this._dataGrid;
@@ -79,7 +84,7 @@
}
/**
- * @return {?{snapshot:!Profiler.HeapSnapshotProxy, snapshotNodeIndex:number}}
+ * @return {?{snapshot:!HeapSnapshotProxy, snapshotNodeIndex:number}}
*/
retainersDataSource() {
return null;
@@ -153,7 +158,7 @@
/**
* @param {!UI.ContextMenu} contextMenu
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
* @param {?SDK.HeapProfilerModel} heapProfilerModel
*/
populateContextMenu(contextMenu, dataDisplayDelegate, heapProfilerModel) {
@@ -452,46 +457,11 @@
};
/**
- * @interface
- */
-export class ChildrenProvider {
- dispose() {
- }
-
- /**
- * @param {number} snapshotObjectId
- * @return {!Promise<number>}
- */
- nodePosition(snapshotObjectId) {
- }
-
- /**
- * @return {!Promise<boolean>}
- */
- isEmpty() {
- }
-
- /**
- * @param {number} startPosition
- * @param {number} endPosition
- * @return {!Promise<!HeapSnapshotModel.ItemsRange>}
- */
- serializeItemsRange(startPosition, endPosition) {
- }
-
- /**
- * @param {!HeapSnapshotModel.ComparatorConfig} comparator
- * @return {!Promise<?>}
- */
- sortAndRewind(comparator) {}
-}
-
-/**
* @unrestricted
*/
export class HeapSnapshotGenericObjectNode extends HeapSnapshotGridNode {
/**
- * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid
+ * @param {!HeapSnapshotSortableDataGrid} dataGrid
* @param {!HeapSnapshotModel.Node} node
*/
constructor(dataGrid, node) {
@@ -533,7 +503,7 @@
/**
* @override
- * @return {?{snapshot:!Profiler.HeapSnapshotProxy, snapshotNodeIndex:number}}
+ * @return {?{snapshot:!HeapSnapshotProxy, snapshotNodeIndex:number}}
*/
retainersDataSource() {
return {snapshot: this._dataGrid.snapshot, snapshotNodeIndex: this.snapshotNodeIndex};
@@ -692,7 +662,7 @@
/**
* @override
* @param {!UI.ContextMenu} contextMenu
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
* @param {?SDK.HeapProfilerModel} heapProfilerModel
*/
populateContextMenu(contextMenu, dataDisplayDelegate, heapProfilerModel) {
@@ -729,8 +699,8 @@
*/
export class HeapSnapshotObjectNode extends HeapSnapshotGenericObjectNode {
/**
- * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid
- * @param {!Profiler.HeapSnapshotProxy} snapshot
+ * @param {!HeapSnapshotSortableDataGrid} dataGrid
+ * @param {!HeapSnapshotProxy} snapshot
* @param {!HeapSnapshotModel.Edge} edge
* @param {?HeapSnapshotObjectNode} parentObjectNode
*/
@@ -759,7 +729,7 @@
/**
* @override
- * @return {?{snapshot:!Profiler.HeapSnapshotProxy, snapshotNodeIndex:number}}
+ * @return {?{snapshot:!HeapSnapshotProxy, snapshotNodeIndex:number}}
*/
retainersDataSource() {
return {snapshot: this._snapshot, snapshotNodeIndex: this.snapshotNodeIndex};
@@ -767,7 +737,7 @@
/**
* @override
- * @return {!Profiler.HeapSnapshotProviderProxy}
+ * @return {!HeapSnapshotProviderProxy}
*/
createProvider() {
return this._snapshot.createEdgesProvider(this.snapshotNodeIndex);
@@ -865,8 +835,8 @@
*/
export class HeapSnapshotRetainingObjectNode extends HeapSnapshotObjectNode {
/**
- * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid
- * @param {!Profiler.HeapSnapshotProxy} snapshot
+ * @param {!HeapSnapshotSortableDataGrid} dataGrid
+ * @param {!HeapSnapshotProxy} snapshot
* @param {!HeapSnapshotModel.Edge} edge
* @param {?HeapSnapshotRetainingObjectNode} parentRetainingObjectNode
*/
@@ -876,7 +846,7 @@
/**
* @override
- * @return {!Profiler.HeapSnapshotProviderProxy}
+ * @return {!HeapSnapshotProviderProxy}
*/
createProvider() {
return this._snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex);
@@ -923,7 +893,7 @@
return;
}
}
- this._dataGrid.dispatchEventToListeners(Profiler.HeapSnapshotRetainmentDataGrid.Events.ExpandRetainersComplete);
+ this._dataGrid.dispatchEventToListeners(HeapSnapshotRetainmentDataGrid.Events.ExpandRetainersComplete);
}
}
@@ -932,8 +902,8 @@
*/
export class HeapSnapshotInstanceNode extends HeapSnapshotGenericObjectNode {
/**
- * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid
- * @param {!Profiler.HeapSnapshotProxy} snapshot
+ * @param {!HeapSnapshotSortableDataGrid} dataGrid
+ * @param {!HeapSnapshotProxy} snapshot
* @param {!HeapSnapshotModel.Node} node
* @param {boolean} isDeletedNode
*/
@@ -962,7 +932,7 @@
/**
* @override
- * @return {?{snapshot:!Profiler.HeapSnapshotProxy, snapshotNodeIndex:number}}
+ * @return {?{snapshot:!HeapSnapshotProxy, snapshotNodeIndex:number}}
*/
retainersDataSource() {
return {snapshot: this._baseSnapshotOrSnapshot, snapshotNodeIndex: this.snapshotNodeIndex};
@@ -970,7 +940,7 @@
/**
* @override
- * @return {!Profiler.HeapSnapshotProviderProxy}
+ * @return {!HeapSnapshotProviderProxy}
*/
createProvider() {
return this._baseSnapshotOrSnapshot.createEdgesProvider(this.snapshotNodeIndex);
@@ -1025,7 +995,7 @@
*/
export class HeapSnapshotConstructorNode extends HeapSnapshotGridNode {
/**
- * @param {!Profiler.HeapSnapshotConstructorsDataGrid} dataGrid
+ * @param {!HeapSnapshotConstructorsDataGrid} dataGrid
* @param {string} className
* @param {!HeapSnapshotModel.Aggregate} aggregate
* @param {!HeapSnapshotModel.NodeFilter} nodeFilter
@@ -1055,7 +1025,7 @@
/**
* @override
- * @return {!Profiler.HeapSnapshotProviderProxy}
+ * @return {!HeapSnapshotProviderProxy}
*/
createProvider() {
return this._dataGrid.snapshot.createNodesProviderForClass(this._name, this._nodeFilter);
@@ -1151,7 +1121,7 @@
*/
export class HeapSnapshotDiffNodesProvider {
/**
- * @param {!Profiler.HeapSnapshotProviderProxy} addedNodesProvider
+ * @param {!HeapSnapshotProviderProxy} addedNodesProvider
* @param {!Profiler.HeapSnapshotProviderProxy} deletedNodesProvider
* @param {number} addedCount
* @param {number} removedCount
@@ -1245,7 +1215,7 @@
*/
export class HeapSnapshotDiffNode extends HeapSnapshotGridNode {
/**
- * @param {!Profiler.HeapSnapshotDiffDataGrid} dataGrid
+ * @param {!HeapSnapshotDiffDataGrid} dataGrid
* @param {string} className
* @param {!HeapSnapshotModel.DiffForClass} diffForClass
*/
@@ -1365,7 +1335,7 @@
*/
export class AllocationGridNode extends HeapSnapshotGridNode {
/**
- * @param {!Profiler.AllocationDataGrid} dataGrid
+ * @param {!AllocationDataGrid} dataGrid
* @param {!HeapSnapshotModel.SerializedAllocationNode} data
*/
constructor(dataGrid, data) {
@@ -1398,7 +1368,7 @@
const callersChain = callers.nodesWithSingleCaller;
let parentNode = this;
- const dataGrid = /** @type {!Profiler.AllocationDataGrid} */ (this._dataGrid);
+ const dataGrid = /** @type {!AllocationDataGrid} */ (this._dataGrid);
for (const caller of callersChain) {
const child = new AllocationGridNode(dataGrid, caller);
dataGrid.appendNode(parentNode, child);
@@ -1458,39 +1428,3 @@
return this._allocationNode.id;
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.HeapSnapshotGridNode = HeapSnapshotGridNode;
-
-/** @interface */
-Profiler.HeapSnapshotGridNode.ChildrenProvider = ChildrenProvider;
-
-/** @constructor */
-Profiler.HeapSnapshotGenericObjectNode = HeapSnapshotGenericObjectNode;
-
-/** @constructor */
-Profiler.HeapSnapshotObjectNode = HeapSnapshotObjectNode;
-
-/** @constructor */
-Profiler.HeapSnapshotRetainingObjectNode = HeapSnapshotRetainingObjectNode;
-
-/** @constructor */
-Profiler.HeapSnapshotInstanceNode = HeapSnapshotInstanceNode;
-
-/** @constructor */
-Profiler.HeapSnapshotConstructorNode = HeapSnapshotConstructorNode;
-
-/** @constructor */
-Profiler.HeapSnapshotDiffNodesProvider = HeapSnapshotDiffNodesProvider;
-
-/** @constructor */
-Profiler.HeapSnapshotDiffNode = HeapSnapshotDiffNode;
-
-/** @constructor */
-Profiler.AllocationGridNode = AllocationGridNode;
diff --git a/front_end/profiler/HeapSnapshotProxy.js b/front_end/profiler/HeapSnapshotProxy.js
index 8f6df5c..b1ce195 100644
--- a/front_end/profiler/HeapSnapshotProxy.js
+++ b/front_end/profiler/HeapSnapshotProxy.js
@@ -28,6 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import {ChildrenProvider} from './ChildrenProvider.js'; // eslint-disable-line no-unused-vars
+
/**
* @unrestricted
*/
@@ -301,7 +303,7 @@
/**
* @unrestricted
*/
-export default class HeapSnapshotProxy extends HeapSnapshotProxyObject {
+export class HeapSnapshotProxy extends HeapSnapshotProxyObject {
/**
* @param {!HeapSnapshotWorkerProxy} worker
* @param {number} objectId
@@ -493,7 +495,7 @@
}
/**
- * @implements {Profiler.HeapSnapshotGridNode.ChildrenProvider}
+ * @implements {ChildrenProvider}
* @unrestricted
*/
export class HeapSnapshotProviderProxy extends HeapSnapshotProxyObject {
@@ -541,24 +543,3 @@
return this._callMethodPromise('sortAndRewind', comparator);
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.HeapSnapshotProxy = HeapSnapshotProxy;
-
-/** @constructor */
-Profiler.HeapSnapshotWorkerProxy = HeapSnapshotWorkerProxy;
-
-/** @constructor */
-Profiler.HeapSnapshotProxyObject = HeapSnapshotProxyObject;
-
-/** @constructor */
-Profiler.HeapSnapshotLoaderProxy = HeapSnapshotLoaderProxy;
-
-/** @constructor */
-Profiler.HeapSnapshotProviderProxy = HeapSnapshotProviderProxy;
diff --git a/front_end/profiler/HeapSnapshotView.js b/front_end/profiler/HeapSnapshotView.js
index f031c36..c7c4ec9 100644
--- a/front_end/profiler/HeapSnapshotView.js
+++ b/front_end/profiler/HeapSnapshotView.js
@@ -28,14 +28,22 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import {AllocationDataGrid, HeapSnapshotConstructorsDataGrid, HeapSnapshotContainmentDataGrid, HeapSnapshotDiffDataGrid, HeapSnapshotRetainmentDataGrid, HeapSnapshotSortableDataGrid,} from './HeapSnapshotDataGrids.js';
+import {HeapSnapshotGenericObjectNode, HeapSnapshotGridNode} from './HeapSnapshotGridNodes.js'; // eslint-disable-line no-unused-vars
+import {HeapSnapshotProxy, HeapSnapshotWorkerProxy} from './HeapSnapshotProxy.js'; // eslint-disable-line no-unused-vars
+import {HeapTimelineOverview, IdsRangeChanged, Samples} from './HeapTimelineOverview.js';
+import {DataDisplayDelegate, Events as ProfileHeaderEvents, ProfileEvents as ProfileTypeEvents, ProfileHeader, ProfileType} from './ProfileHeader.js'; // eslint-disable-line no-unused-vars
+import {ProfileSidebarTreeElement} from './ProfileSidebarTreeElement.js';
+import {instance} from './ProfileTypeRegistry.js';
+
/**
- * @implements {Profiler.ProfileType.DataDisplayDelegate}
+ * @implements {DataDisplayDelegate}
* @implements {UI.Searchable}
* @unrestricted
*/
-export default class HeapSnapshotView extends UI.SimpleView {
+export class HeapSnapshotView extends UI.SimpleView {
/**
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
* @param {!HeapProfileHeader} profile
*/
constructor(dataDisplayDelegate, profile) {
@@ -47,7 +55,7 @@
const profileType = profile.profileType();
profileType.addEventListener(HeapSnapshotProfileType.SnapshotReceived, this._onReceiveSnapshot, this);
- profileType.addEventListener(Profiler.ProfileType.Events.RemoveProfileHeader, this._onProfileHeaderRemoved, this);
+ profileType.addEventListener(ProfileTypeEvents.RemoveProfileHeader, this._onProfileHeaderRemoved, this);
const isHeapTimeline = profileType.id === TrackingHeapSnapshotProfileType.TypeId;
if (isHeapTimeline) {
@@ -64,25 +72,25 @@
const heapProfilerModel = profile.heapProfilerModel();
this._containmentDataGrid =
- new Profiler.HeapSnapshotContainmentDataGrid(heapProfilerModel, this, /* displayName */ ls`Containment`);
+ new HeapSnapshotContainmentDataGrid(heapProfilerModel, this, /* displayName */ ls`Containment`);
this._containmentDataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this._selectionChanged, this);
this._containmentWidget = this._containmentDataGrid.asWidget();
this._containmentWidget.setMinimumSize(50, 25);
this._statisticsView = new HeapSnapshotStatisticsView();
- this._constructorsDataGrid = new Profiler.HeapSnapshotConstructorsDataGrid(heapProfilerModel, this);
+ this._constructorsDataGrid = new HeapSnapshotConstructorsDataGrid(heapProfilerModel, this);
this._constructorsDataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this._selectionChanged, this);
this._constructorsWidget = this._constructorsDataGrid.asWidget();
this._constructorsWidget.setMinimumSize(50, 25);
- this._diffDataGrid = new Profiler.HeapSnapshotDiffDataGrid(heapProfilerModel, this);
+ this._diffDataGrid = new HeapSnapshotDiffDataGrid(heapProfilerModel, this);
this._diffDataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this._selectionChanged, this);
this._diffWidget = this._diffDataGrid.asWidget();
this._diffWidget.setMinimumSize(50, 25);
if (isHeapTimeline) {
- this._allocationDataGrid = new Profiler.AllocationDataGrid(heapProfilerModel, this);
+ this._allocationDataGrid = new AllocationDataGrid(heapProfilerModel, this);
this._allocationDataGrid.addEventListener(
DataGrid.DataGrid.Events.SelectedNode, this._onSelectAllocationNode, this);
this._allocationWidget = this._allocationDataGrid.asWidget();
@@ -94,7 +102,7 @@
this._tabbedPane = new UI.TabbedPane();
}
- this._retainmentDataGrid = new Profiler.HeapSnapshotRetainmentDataGrid(heapProfilerModel, this);
+ this._retainmentDataGrid = new HeapSnapshotRetainmentDataGrid(heapProfilerModel, this);
this._retainmentWidget = this._retainmentDataGrid.asWidget();
this._retainmentWidget.setMinimumSize(50, 21);
this._retainmentWidget.element.classList.add('retaining-paths-view');
@@ -129,7 +137,7 @@
this._perspectives = [];
this._comparisonPerspective = new ComparisonPerspective();
this._perspectives.push(new SummaryPerspective());
- if (profile.profileType() !== Profiler.ProfileTypeRegistry.instance.trackingHeapSnapshotProfileType) {
+ if (profile.profileType() !== instance.trackingHeapSnapshotProfileType) {
this._perspectives.push(this._comparisonPerspective);
}
this._perspectives.push(new ContainmentPerspective());
@@ -170,15 +178,14 @@
this._searchThrottler = new Common.Throttler(0);
for (const existingProfile of this._profiles()) {
- existingProfile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this);
+ existingProfile.addEventListener(ProfileHeaderEvents.ProfileTitleChanged, this._updateControls, this);
}
}
_createOverview() {
const profileType = this._profile.profileType();
- this._trackingOverviewGrid = new Profiler.HeapTimelineOverview();
- this._trackingOverviewGrid.addEventListener(
- Profiler.HeapTimelineOverview.IdsRangeChanged, this._onIdsRangeChanged.bind(this));
+ this._trackingOverviewGrid = new HeapTimelineOverview();
+ this._trackingOverviewGrid.addEventListener(IdsRangeChanged, this._onIdsRangeChanged.bind(this));
if (!this._profile.fromFile() && profileType.profileBeingRecorded() === this._profile) {
profileType.addEventListener(TrackingHeapSnapshotProfileType.HeapStatsUpdate, this._onHeapStatsUpdate, this);
profileType.addEventListener(TrackingHeapSnapshotProfileType.TrackingStopped, this._onStopTracking, this);
@@ -215,7 +222,7 @@
/**
* @override
- * @param {?Profiler.ProfileHeader} profile
+ * @param {?ProfileHeader} profile
* @return {?UI.Widget}
*/
showProfile(profile) {
@@ -270,7 +277,7 @@
const samples = await heapSnapshotProxy.getSamples();
if (samples) {
console.assert(samples.timestamps.length);
- const profileSamples = new Profiler.HeapTimelineOverview.Samples();
+ const profileSamples = new Samples();
profileSamples.sizes = samples.sizes;
profileSamples.ids = samples.lastAssignedIds;
profileSamples.timestamps = samples.timestamps;
@@ -289,7 +296,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotProxy} heapSnapshotProxy
+ * @param {!HeapSnapshotProxy} heapSnapshotProxy
* @return {!Promise<!HeapSnapshotModel.Statistics>}
*/
async _retrieveStatistics(heapSnapshotProxy) {
@@ -321,7 +328,7 @@
*/
syncToolbarItems() {
const result = [this._perspectiveSelect, this._classNameFilter];
- if (this._profile.profileType() !== Profiler.ProfileTypeRegistry.instance.trackingHeapSnapshotProfileType) {
+ if (this._profile.profileType() !== instance.trackingHeapSnapshotProfileType) {
result.push(this._baseSelect, this._filterSelect);
}
result.push(this._selectedSizeText);
@@ -361,7 +368,7 @@
}
/**
- * @param {?Profiler.HeapSnapshotGridNode} node
+ * @param {?HeapSnapshotGridNode} node
*/
_selectRevealedNode(node) {
if (node) {
@@ -474,7 +481,7 @@
}
this._baseProfile = this._profiles()[this._baseSelect.selectedIndex()];
- const dataGrid = /** @type {!Profiler.HeapSnapshotDiffDataGrid} */ (this._dataGrid);
+ const dataGrid = /** @type {!HeapSnapshotDiffDataGrid} */ (this._dataGrid);
// Change set base data source only if main data source is already set.
if (dataGrid.snapshot) {
this._baseProfile._loadPromise.then(dataGrid.setBaseDataSource.bind(dataGrid));
@@ -505,7 +512,7 @@
}
/**
- * @return {!Array.<!Profiler.ProfileHeader>}
+ * @return {!Array.<!ProfileHeader>}
*/
_profiles() {
return this._profile.profileType().getProfiles();
@@ -515,7 +522,7 @@
* @param {!Common.Event} event
*/
_selectionChanged(event) {
- const selectedNode = /** @type {!Profiler.HeapSnapshotGridNode} */ (event.data);
+ const selectedNode = /** @type {!HeapSnapshotGridNode} */ (event.data);
this._setSelectedNodeForDetailsView(selectedNode);
this._inspectedObjectChanged(event);
}
@@ -535,13 +542,13 @@
_inspectedObjectChanged(event) {
const selectedNode = /** @type {!DataGrid.DataGridNode} */ (event.data);
const heapProfilerModel = this._profile.heapProfilerModel();
- if (heapProfilerModel && selectedNode instanceof Profiler.HeapSnapshotGenericObjectNode) {
+ if (heapProfilerModel && selectedNode instanceof HeapSnapshotGenericObjectNode) {
heapProfilerModel.addInspectedHeapObject(String(selectedNode.snapshotNodeId));
}
}
/**
- * @param {?Profiler.HeapSnapshotGridNode} nodeItem
+ * @param {?HeapSnapshotGridNode} nodeItem
*/
_setSelectedNodeForDetailsView(nodeItem) {
const dataSource = nodeItem && nodeItem.retainersDataSource();
@@ -568,8 +575,8 @@
return Promise.resolve();
}
- const promise = this._perspectives[perspectiveIndex].masterGrid(this).once(
- Profiler.HeapSnapshotSortableDataGrid.Events.ContentShown);
+ const promise =
+ this._perspectives[perspectiveIndex].masterGrid(this).once(HeapSnapshotSortableDataGrid.Events.ContentShown);
const option = this._perspectiveSelect.options().find(option => option.value === String(perspectiveIndex));
this._perspectiveSelect.select(/** @type {!Element} */ (option));
@@ -750,7 +757,7 @@
_onReceiveSnapshot(event) {
this._updateControls();
const profile = event.data;
- profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this);
+ profile.addEventListener(ProfileHeaderEvents.ProfileTitleChanged, this._updateControls, this);
}
/**
@@ -758,14 +765,14 @@
*/
_onProfileHeaderRemoved(event) {
const profile = event.data;
- profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this);
+ profile.removeEventListener(ProfileHeaderEvents.ProfileTitleChanged, this._updateControls, this);
if (this._profile === profile) {
this.detach();
this._profile.profileType().removeEventListener(
HeapSnapshotProfileType.SnapshotReceived, this._onReceiveSnapshot, this);
this._profile.profileType().removeEventListener(
- Profiler.ProfileType.Events.RemoveProfileHeader, this._onProfileHeaderRemoved, this);
+ ProfileTypeEvents.RemoveProfileHeader, this._onProfileHeaderRemoved, this);
this.dispose();
} else {
this._updateControls();
@@ -781,8 +788,7 @@
}
this._onStopTracking();
if (this._trackingOverviewGrid) {
- this._trackingOverviewGrid.removeEventListener(
- Profiler.HeapTimelineOverview.IdsRangeChanged, this._onIdsRangeChanged.bind(this));
+ this._trackingOverviewGrid.removeEventListener(IdsRangeChanged, this._onIdsRangeChanged.bind(this));
}
}
}
@@ -1046,7 +1052,7 @@
* @implements {SDK.SDKModelObserver<!SDK.HeapProfilerModel>}
* @unrestricted
*/
-export class HeapSnapshotProfileType extends Profiler.ProfileType {
+export class HeapSnapshotProfileType extends ProfileType {
/**
* @param {string=} id
* @param {string=} title
@@ -1161,7 +1167,7 @@
/**
* @override
* @param {string} title
- * @return {!Profiler.ProfileHeader}
+ * @return {!ProfileHeader}
*/
createProfileLoadedFromFile(title) {
return new HeapProfileHeader(null, this, title);
@@ -1187,7 +1193,7 @@
profile.title = Common.UIString('Snapshot %d', profile.uid);
profile._finishLoad();
this.setProfileBeingRecorded(null);
- this.dispatchEventToListeners(Profiler.ProfileType.Events.ProfileComplete, profile);
+ this.dispatchEventToListeners(ProfileTypeEvents.ProfileComplete, profile);
}
/**
@@ -1382,10 +1388,10 @@
return null;
}
this.setProfileBeingRecorded(new HeapProfileHeader(heapProfilerModel, this, undefined));
- this._profileSamples = new Profiler.HeapTimelineOverview.Samples();
+ this._profileSamples = new Samples();
this.profileBeingRecorded()._profileSamples = this._profileSamples;
this._recording = true;
- this.addProfile(/** @type {!Profiler.ProfileHeader} */ (this.profileBeingRecorded()));
+ this.addProfile(/** @type {!ProfileHeader} */ (this.profileBeingRecorded()));
this.profileBeingRecorded().updateStatus(Common.UIString('Recording\u2026'));
this.dispatchEventToListeners(TrackingHeapSnapshotProfileType.TrackingStarted);
return heapProfilerModel;
@@ -1405,7 +1411,7 @@
profile._finishLoad();
this._profileSamples = null;
this.setProfileBeingRecorded(null);
- this.dispatchEventToListeners(Profiler.ProfileType.Events.ProfileComplete, profile);
+ this.dispatchEventToListeners(ProfileTypeEvents.ProfileComplete, profile);
}
_toggleRecording() {
@@ -1477,7 +1483,7 @@
/**
* @unrestricted
*/
-export class HeapProfileHeader extends Profiler.ProfileHeader {
+export class HeapProfileHeader extends ProfileHeader {
/**
* @param {?SDK.HeapProfilerModel} heapProfilerModel
* @param {!HeapSnapshotProfileType} type
@@ -1487,13 +1493,13 @@
super(type, title || Common.UIString('Snapshot %d', type.nextProfileUid()));
this._heapProfilerModel = heapProfilerModel;
this.maxJSObjectId = -1;
- /** @type {?Profiler.HeapSnapshotWorkerProxy} */
+ /** @type {?HeapSnapshotWorkerProxy} */
this._workerProxy = null;
/** @type {?Common.OutputStream} */
this._receiver = null;
- /** @type {?Profiler.HeapSnapshotProxy} */
+ /** @type {?HeapSnapshotProxy} */
this._snapshotProxy = null;
- /** @type {!Promise<!Profiler.HeapSnapshotProxy>} */
+ /** @type {!Promise<!HeapSnapshotProxy>} */
this._loadPromise = new Promise(resolve => this._fulfillLoad = resolve);
this._totalNumberOfChunks = 0;
this._bufferedWriter = null;
@@ -1518,16 +1524,16 @@
/**
* @override
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
- * @return {!Profiler.ProfileSidebarTreeElement}
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
+ * @return {!ProfileSidebarTreeElement}
*/
createSidebarTreeElement(dataDisplayDelegate) {
- return new Profiler.ProfileSidebarTreeElement(dataDisplayDelegate, this, 'heap-snapshot-sidebar-tree-item');
+ return new ProfileSidebarTreeElement(dataDisplayDelegate, this, 'heap-snapshot-sidebar-tree-item');
}
/**
* @override
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
* @return {!HeapSnapshotView}
*/
createView(dataDisplayDelegate) {
@@ -1578,8 +1584,8 @@
this.updateStatus(null, event.data);
}
console.assert(!this._workerProxy, 'HeapSnapshotWorkerProxy already exists');
- this._workerProxy = new Profiler.HeapSnapshotWorkerProxy(this._handleWorkerEvent.bind(this));
- this._workerProxy.addEventListener(Profiler.HeapSnapshotWorkerProxy.Events.Wait, setProfileWait, this);
+ this._workerProxy = new HeapSnapshotWorkerProxy(this._handleWorkerEvent.bind(this));
+ this._workerProxy.addEventListener(HeapSnapshotWorkerProxy.Events.Wait, setProfileWait, this);
this._receiver = this._workerProxy.createLoader(this.uid, this._snapshotReceived.bind(this));
}
@@ -1649,7 +1655,7 @@
this._fulfillLoad(this._snapshotProxy);
this.profileType()._snapshotReceived(this);
if (this.canSaveToFile()) {
- this.dispatchEventToListeners(Profiler.ProfileHeader.Events.ProfileReceived);
+ this.dispatchEventToListeners(ProfileHeaderEvents.ProfileReceived);
}
}
@@ -1840,7 +1846,7 @@
}
/**
- * @param {!Profiler.HeapSnapshotProxy} snapshot
+ * @param {!HeapSnapshotProxy} snapshot
* @param {number} snapshotNodeIndex
*/
async setAllocatedObject(snapshot, snapshotNodeIndex) {
@@ -1882,45 +1888,3 @@
this._linkifier.reset();
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.HeapSnapshotView = HeapSnapshotView;
-
-/** @constructor */
-Profiler.HeapSnapshotView.Perspective = Perspective;
-
-/** @constructor */
-Profiler.HeapSnapshotView.SummaryPerspective = SummaryPerspective;
-
-/** @constructor */
-Profiler.HeapSnapshotView.ComparisonPerspective = ComparisonPerspective;
-
-/** @constructor */
-Profiler.HeapSnapshotView.ContainmentPerspective = ContainmentPerspective;
-
-/** @constructor */
-Profiler.HeapSnapshotView.AllocationPerspective = AllocationPerspective;
-
-/** @constructor */
-Profiler.HeapSnapshotView.StatisticsPerspective = StatisticsPerspective;
-
-/** @constructor */
-Profiler.HeapSnapshotProfileType = HeapSnapshotProfileType;
-
-/** @constructor */
-Profiler.TrackingHeapSnapshotProfileType = TrackingHeapSnapshotProfileType;
-
-/** @constructor */
-Profiler.HeapProfileHeader = HeapProfileHeader;
-
-/** @constructor */
-Profiler.HeapSnapshotStatisticsView = HeapSnapshotStatisticsView;
-
-/** @constructor */
-Profiler.HeapAllocationStackView = HeapAllocationStackView;
diff --git a/front_end/profiler/HeapTimelineOverview.js b/front_end/profiler/HeapTimelineOverview.js
index 33cb64c..065e8e1 100644
--- a/front_end/profiler/HeapTimelineOverview.js
+++ b/front_end/profiler/HeapTimelineOverview.js
@@ -5,7 +5,7 @@
/**
* @unrestricted
*/
-export default class HeapTimelineOverview extends UI.VBox {
+export class HeapTimelineOverview extends UI.VBox {
constructor() {
super();
this.element.id = 'heap-recording-view';
@@ -362,23 +362,3 @@
return this._maximumBoundaries - this._minimumBoundaries;
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.HeapTimelineOverview = HeapTimelineOverview;
-
-Profiler.HeapTimelineOverview.IdsRangeChanged = IdsRangeChanged;
-
-/** @constructor */
-Profiler.HeapTimelineOverview.SmoothScale = SmoothScale;
-
-/** @constructor */
-Profiler.HeapTimelineOverview.Samples = Samples;
-
-/** @constructor */
-Profiler.HeapTimelineOverview.OverviewCalculator = OverviewCalculator;
diff --git a/front_end/profiler/IsolateSelector.js b/front_end/profiler/IsolateSelector.js
index 4ced5f5..3bfcb86 100644
--- a/front_end/profiler/IsolateSelector.js
+++ b/front_end/profiler/IsolateSelector.js
@@ -6,7 +6,7 @@
* @implements {UI.ListDelegate<!ListItem>}
* @implements {SDK.IsolateManager.Observer}
*/
-export default class IsolateSelector extends UI.VBox {
+export class IsolateSelector extends UI.VBox {
constructor() {
super(false);
@@ -268,15 +268,3 @@
}
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.IsolateSelector = IsolateSelector;
-
-/** @constructor */
-Profiler.IsolateSelector.ListItem = ListItem;
diff --git a/front_end/profiler/LiveHeapProfileView.js b/front_end/profiler/LiveHeapProfileView.js
index 7e1014f..16f495c 100644
--- a/front_end/profiler/LiveHeapProfileView.js
+++ b/front_end/profiler/LiveHeapProfileView.js
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import {SamplingHeapProfileNode} from './HeapProfileView.js'; // eslint-disable-line no-unused-vars
+
/**
* @extends {UI.VBox}
*/
-export default class LiveHeapProfileView extends UI.VBox {
+export class LiveHeapProfileView extends UI.VBox {
constructor() {
super(true);
/** @type {!Map<string, !GridNode>} */
@@ -344,18 +346,3 @@
}
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.LiveHeapProfileView = LiveHeapProfileView;
-
-/** @constructor */
-Profiler.LiveHeapProfileView.GridNode = GridNode;
-
-/** @constructor */
-Profiler.LiveHeapProfileView.ActionDelegate = ActionDelegate;
diff --git a/front_end/profiler/ProfileDataGrid.js b/front_end/profiler/ProfileDataGrid.js
index 1094729..865d9b0 100644
--- a/front_end/profiler/ProfileDataGrid.js
+++ b/front_end/profiler/ProfileDataGrid.js
@@ -715,18 +715,3 @@
*/
linkifyNode(node) {}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.ProfileDataGridNode = ProfileDataGridNode;
-
-/** @constructor */
-Profiler.ProfileDataGridTree = ProfileDataGridTree;
-
-/** @interface */
-Profiler.ProfileDataGridNode.Formatter = Formatter;
diff --git a/front_end/profiler/ProfileHeader.js b/front_end/profiler/ProfileHeader.js
index 0b13834..0bed9aa 100644
--- a/front_end/profiler/ProfileHeader.js
+++ b/front_end/profiler/ProfileHeader.js
@@ -5,9 +5,9 @@
/**
* @unrestricted
*/
-export default class ProfileHeader extends Common.Object {
+export class ProfileHeader extends Common.Object {
/**
- * @param {!Profiler.ProfileType} profileType
+ * @param {!ProfileType} profileType
* @param {string} title
*/
constructor(profileType, title) {
@@ -27,7 +27,7 @@
}
/**
- * @return {!Profiler.ProfileType}
+ * @return {!ProfileType}
*/
profileType() {
return this._profileType;
@@ -43,15 +43,15 @@
/**
* Must be implemented by subclasses.
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
- * @return {!Profiler.ProfileSidebarTreeElement}
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
+ * @return {!UI.TreeElement}
*/
createSidebarTreeElement(dataDisplayDelegate) {
throw new Error('Not implemented.');
}
/**
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
* @return {!UI.Widget}
*/
createView(dataDisplayDelegate) {
@@ -127,17 +127,266 @@
ProfileTitleChanged: Symbol('ProfileTitleChanged')
};
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
+/**
+ * @unrestricted
+ */
+export class ProfileType extends Common.Object {
+ /**
+ * @param {string} id
+ * @param {string} name
+ * @suppressGlobalPropertiesCheck
+ */
+ constructor(id, name) {
+ super();
+ this._id = id;
+ this._name = name;
+ /** @type {!Array.<!ProfileHeader>} */
+ this._profiles = [];
+ /** @type {?ProfileHeader} */
+ this._profileBeingRecorded = null;
+ this._nextProfileUid = 1;
-/* Legacy exported object */
-Profiler = Profiler || {};
+ if (!window.opener) {
+ window.addEventListener('unload', this._clearTempStorage.bind(this), false);
+ }
+ }
-/** @constructor */
-Profiler.ProfileHeader = ProfileHeader;
+ /**
+ * @return {string}
+ */
+ typeName() {
+ return '';
+ }
-/** @constructor */
-Profiler.ProfileHeader.StatusUpdate = StatusUpdate;
+ /**
+ * @return {number}
+ */
+ nextProfileUid() {
+ return this._nextProfileUid;
+ }
+
+ /**
+ * @return {number}
+ */
+ incrementProfileUid() {
+ return this._nextProfileUid++;
+ }
+
+ /**
+ * @return {boolean}
+ */
+ hasTemporaryView() {
+ return false;
+ }
+
+ /**
+ * @return {?string}
+ */
+ fileExtension() {
+ return null;
+ }
+
+ get buttonTooltip() {
+ return '';
+ }
+
+ get id() {
+ return this._id;
+ }
+
+ get treeItemTitle() {
+ return this._name;
+ }
+
+ get name() {
+ return this._name;
+ }
+
+ /**
+ * @return {boolean}
+ */
+ buttonClicked() {
+ return false;
+ }
+
+ get description() {
+ return '';
+ }
+
+ /**
+ * @return {boolean}
+ */
+ isInstantProfile() {
+ return false;
+ }
+
+ /**
+ * @return {boolean}
+ */
+ isEnabled() {
+ return true;
+ }
+
+ /**
+ * @return {!Array.<!ProfileHeader>}
+ */
+ getProfiles() {
+ /**
+ * @param {!ProfileHeader} profile
+ * @return {boolean}
+ * @this {ProfileType}
+ */
+ function isFinished(profile) {
+ return this._profileBeingRecorded !== profile;
+ }
+ return this._profiles.filter(isFinished.bind(this));
+ }
+
+ /**
+ * @return {?Element}
+ */
+ customContent() {
+ return null;
+ }
+
+ /**
+ * @param {boolean} enable
+ */
+ setCustomContentEnabled(enable) {
+ }
+
+ /**
+ * @param {number} uid
+ * @return {?ProfileHeader}
+ */
+ getProfile(uid) {
+ for (let i = 0; i < this._profiles.length; ++i) {
+ if (this._profiles[i].uid === uid) {
+ return this._profiles[i];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param {!File} file
+ * @return {!Promise<?Error|?FileError>}
+ */
+ loadFromFile(file) {
+ let name = file.name;
+ const fileExtension = this.fileExtension();
+ if (fileExtension && name.endsWith(fileExtension)) {
+ name = name.substr(0, name.length - fileExtension.length);
+ }
+ const profile = this.createProfileLoadedFromFile(name);
+ profile.setFromFile();
+ this.setProfileBeingRecorded(profile);
+ this.addProfile(profile);
+ return profile.loadFromFile(file);
+ }
+
+ /**
+ * @param {string} title
+ * @return {!ProfileHeader}
+ */
+ createProfileLoadedFromFile(title) {
+ throw new Error('Needs implemented.');
+ }
+
+ /**
+ * @param {!ProfileHeader} profile
+ */
+ addProfile(profile) {
+ this._profiles.push(profile);
+ this.dispatchEventToListeners(ProfileEvents.AddProfileHeader, profile);
+ }
+
+ /**
+ * @param {!ProfileHeader} profile
+ */
+ removeProfile(profile) {
+ const index = this._profiles.indexOf(profile);
+ if (index === -1) {
+ return;
+ }
+ this._profiles.splice(index, 1);
+ this._disposeProfile(profile);
+ }
+
+ _clearTempStorage() {
+ for (let i = 0; i < this._profiles.length; ++i) {
+ this._profiles[i].removeTempFile();
+ }
+ }
+
+ /**
+ * @return {?ProfileHeader}
+ */
+ profileBeingRecorded() {
+ return this._profileBeingRecorded;
+ }
+
+ /**
+ * @param {?ProfileHeader} profile
+ */
+ setProfileBeingRecorded(profile) {
+ this._profileBeingRecorded = profile;
+ }
+
+ profileBeingRecordedRemoved() {
+ }
+
+ reset() {
+ for (const profile of this._profiles.slice()) {
+ this._disposeProfile(profile);
+ }
+ this._profiles = [];
+ this._nextProfileUid = 1;
+ }
+
+ /**
+ * @param {!ProfileHeader} profile
+ */
+ _disposeProfile(profile) {
+ this.dispatchEventToListeners(ProfileEvents.RemoveProfileHeader, profile);
+ profile.dispose();
+ if (this._profileBeingRecorded === profile) {
+ this.profileBeingRecordedRemoved();
+ this.setProfileBeingRecorded(null);
+ }
+ }
+}
/** @enum {symbol} */
-Profiler.ProfileHeader.Events = Events;
+export const ProfileEvents = {
+ AddProfileHeader: Symbol('add-profile-header'),
+ ProfileComplete: Symbol('profile-complete'),
+ RemoveProfileHeader: Symbol('remove-profile-header'),
+ ViewUpdated: Symbol('view-updated')
+};
+
+/**
+ * @interface
+ */
+export class DataDisplayDelegate {
+ /**
+ * @param {?ProfileHeader} profile
+ * @return {?UI.Widget}
+ */
+ showProfile(profile) {
+ }
+
+ /**
+ * @param {!Protocol.HeapProfiler.HeapSnapshotObjectId} snapshotObjectId
+ * @param {string} perspectiveName
+ */
+ showObject(snapshotObjectId, perspectiveName) {
+ }
+
+ /**
+ * @param {number} nodeIndex
+ * @return {!Promise<?Element>}
+ */
+ async linkifyObject(nodeIndex) {
+ }
+}
diff --git a/front_end/profiler/ProfileLauncherView.js b/front_end/profiler/ProfileLauncherView.js
index 537769e..ff67767 100644
--- a/front_end/profiler/ProfileLauncherView.js
+++ b/front_end/profiler/ProfileLauncherView.js
@@ -28,12 +28,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import {IsolateSelector} from './IsolateSelector.js';
+import {ProfileType} from './ProfileHeader.js'; // eslint-disable-line no-unused-vars
+
/**
* @unrestricted
*/
-export default class ProfileLauncherView extends UI.VBox {
+export class ProfileLauncherView extends UI.VBox {
/**
- * @param {!Profiler.ProfilesPanel} profilesPanel
+ * @param {!UI.PanelWithSidebar} profilesPanel
*/
constructor(profilesPanel) {
super();
@@ -51,7 +54,7 @@
const isolateSelectorElement = this._contentElement.createChild('div', 'vbox profile-isolate-selector-block');
isolateSelectorElement.createChild('h1').textContent = ls`Select JavaScript VM instance`;
- const isolateSelector = new Profiler.IsolateSelector();
+ const isolateSelector = new IsolateSelector();
isolateSelector.show(isolateSelectorElement.createChild('div', 'vbox profile-launcher-target-list'));
isolateSelectorElement.appendChild(isolateSelector.totalMemoryElement());
@@ -106,7 +109,7 @@
}
/**
- * @param {!Profiler.ProfileType} profileType
+ * @param {!ProfileType} profileType
* @param {boolean} recordButtonEnabled
*/
updateProfileType(profileType, recordButtonEnabled) {
@@ -117,7 +120,7 @@
}
/**
- * @param {!Profiler.ProfileType} profileType
+ * @param {!ProfileType} profileType
*/
addProfileType(profileType) {
const labelElement = UI.createRadioLabel('profile-type', profileType.name);
@@ -160,7 +163,7 @@
}
/**
- * @param {!Profiler.ProfileType} profileType
+ * @param {!ProfileType} profileType
*/
_profileTypeChanged(profileType) {
const typeId = this._selectedProfileTypeSetting.get();
@@ -179,15 +182,3 @@
export const Events = {
ProfileTypeSelected: Symbol('ProfileTypeSelected')
};
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.ProfileLauncherView = ProfileLauncherView;
-
-/** @enum {symbol} */
-Profiler.ProfileLauncherView.Events = Events;
diff --git a/front_end/profiler/ProfileSidebarTreeElement.js b/front_end/profiler/ProfileSidebarTreeElement.js
new file mode 100644
index 0000000..05b715d
--- /dev/null
+++ b/front_end/profiler/ProfileSidebarTreeElement.js
@@ -0,0 +1,174 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import {DataDisplayDelegate, Events as ProfileHeaderEvents, ProfileHeader} from './ProfileHeader.js'; // eslint-disable-line no-unused-vars
+
+/**
+ * @unrestricted
+ */
+export class ProfileSidebarTreeElement extends UI.TreeElement {
+ /**
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
+ * @param {!ProfileHeader} profile
+ * @param {string} className
+ */
+ constructor(dataDisplayDelegate, profile, className) {
+ super('', false);
+ this._iconElement = createElementWithClass('div', 'icon');
+ this._titlesElement = createElementWithClass('div', 'titles no-subtitle');
+ this._titleContainer = this._titlesElement.createChild('span', 'title-container');
+ this.titleElement = this._titleContainer.createChild('span', 'title');
+ this._subtitleElement = this._titlesElement.createChild('span', 'subtitle');
+
+ this.titleElement.textContent = profile.title;
+ this._className = className;
+ this._small = false;
+ this._dataDisplayDelegate = dataDisplayDelegate;
+ this.profile = profile;
+ profile.addEventListener(ProfileHeaderEvents.UpdateStatus, this._updateStatus, this);
+ if (profile.canSaveToFile()) {
+ this._createSaveLink();
+ } else {
+ profile.addEventListener(ProfileHeaderEvents.ProfileReceived, this._onProfileReceived, this);
+ }
+ }
+
+ _createSaveLink() {
+ this._saveLinkElement = this._titleContainer.createChild('span', 'save-link');
+ this._saveLinkElement.textContent = Common.UIString('Save');
+ this._saveLinkElement.addEventListener('click', this._saveProfile.bind(this), false);
+ }
+
+ _onProfileReceived(event) {
+ this._createSaveLink();
+ }
+
+ /**
+ * @param {!Common.Event} event
+ */
+ _updateStatus(event) {
+ const statusUpdate = event.data;
+ if (statusUpdate.subtitle !== null) {
+ this._subtitleElement.textContent = statusUpdate.subtitle || '';
+ this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle);
+ }
+ if (typeof statusUpdate.wait === 'boolean' && this.listItemElement) {
+ this.listItemElement.classList.toggle('wait', statusUpdate.wait);
+ }
+ }
+
+ /**
+ * @override
+ * @param {!Event} event
+ * @return {boolean}
+ */
+ ondblclick(event) {
+ if (!this._editing) {
+ this._startEditing(/** @type {!Element} */ (event.target));
+ }
+ return false;
+ }
+
+ /**
+ * @param {!Element} eventTarget
+ */
+ _startEditing(eventTarget) {
+ const container = eventTarget.enclosingNodeOrSelfWithClass('title');
+ if (!container) {
+ return;
+ }
+ const config = new UI.InplaceEditor.Config(this._editingCommitted.bind(this), this._editingCancelled.bind(this));
+ this._editing = UI.InplaceEditor.startEditing(container, config);
+ }
+
+ /**
+ * @param {!Element} container
+ * @param {string} newTitle
+ */
+ _editingCommitted(container, newTitle) {
+ delete this._editing;
+ this.profile.setTitle(newTitle);
+ }
+
+ _editingCancelled() {
+ delete this._editing;
+ }
+
+ dispose() {
+ this.profile.removeEventListener(ProfileHeaderEvents.UpdateStatus, this._updateStatus, this);
+ this.profile.removeEventListener(ProfileHeaderEvents.ProfileReceived, this._onProfileReceived, this);
+ }
+
+ /**
+ * @override
+ * @return {boolean}
+ */
+ onselect() {
+ this._dataDisplayDelegate.showProfile(this.profile);
+ return true;
+ }
+
+ /**
+ * @override
+ * @return {boolean}
+ */
+ ondelete() {
+ this.profile.profileType().removeProfile(this.profile);
+ return true;
+ }
+
+ /**
+ * @override
+ */
+ onattach() {
+ if (this._className) {
+ this.listItemElement.classList.add(this._className);
+ }
+ if (this._small) {
+ this.listItemElement.classList.add('small');
+ }
+ this.listItemElement.appendChildren(this._iconElement, this._titlesElement);
+ this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
+
+ UI.ARIAUtils.setDescription(this.listItemElement, ls`${this.profile.profileType().name}`);
+ }
+
+ /**
+ * @param {!Event} event
+ */
+ _handleContextMenuEvent(event) {
+ const profile = this.profile;
+ const contextMenu = new UI.ContextMenu(event);
+ // FIXME: use context menu provider
+ contextMenu.headerSection().appendItem(
+ Common.UIString('Load\u2026'),
+ self.Profiler.ProfilesPanel._fileSelectorElement.click.bind(self.Profiler.ProfilesPanel._fileSelectorElement));
+ if (profile.canSaveToFile()) {
+ contextMenu.saveSection().appendItem(Common.UIString('Save\u2026'), profile.saveToFile.bind(profile));
+ }
+ contextMenu.footerSection().appendItem(Common.UIString('Delete'), this.ondelete.bind(this));
+ contextMenu.show();
+ }
+
+ _saveProfile(event) {
+ this.profile.saveToFile();
+ }
+
+ /**
+ * @param {boolean} small
+ */
+ setSmall(small) {
+ this._small = small;
+ if (this.listItemElement) {
+ this.listItemElement.classList.toggle('small', this._small);
+ }
+ }
+
+ /**
+ * @param {string} title
+ */
+ setMainTitle(title) {
+ this.titleElement.textContent = title;
+ }
+}
diff --git a/front_end/profiler/ProfileType.js b/front_end/profiler/ProfileType.js
deleted file mode 100644
index 47ecc18..0000000
--- a/front_end/profiler/ProfileType.js
+++ /dev/null
@@ -1,281 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @unrestricted
- */
-export default class ProfileType extends Common.Object {
- /**
- * @param {string} id
- * @param {string} name
- * @suppressGlobalPropertiesCheck
- */
- constructor(id, name) {
- super();
- this._id = id;
- this._name = name;
- /** @type {!Array.<!Profiler.ProfileHeader>} */
- this._profiles = [];
- /** @type {?Profiler.ProfileHeader} */
- this._profileBeingRecorded = null;
- this._nextProfileUid = 1;
-
- if (!window.opener) {
- window.addEventListener('unload', this._clearTempStorage.bind(this), false);
- }
- }
-
- /**
- * @return {string}
- */
- typeName() {
- return '';
- }
-
- /**
- * @return {number}
- */
- nextProfileUid() {
- return this._nextProfileUid;
- }
-
- /**
- * @return {number}
- */
- incrementProfileUid() {
- return this._nextProfileUid++;
- }
-
- /**
- * @return {boolean}
- */
- hasTemporaryView() {
- return false;
- }
-
- /**
- * @return {?string}
- */
- fileExtension() {
- return null;
- }
-
- get buttonTooltip() {
- return '';
- }
-
- get id() {
- return this._id;
- }
-
- get treeItemTitle() {
- return this._name;
- }
-
- get name() {
- return this._name;
- }
-
- /**
- * @return {boolean}
- */
- buttonClicked() {
- return false;
- }
-
- get description() {
- return '';
- }
-
- /**
- * @return {boolean}
- */
- isInstantProfile() {
- return false;
- }
-
- /**
- * @return {boolean}
- */
- isEnabled() {
- return true;
- }
-
- /**
- * @return {!Array.<!Profiler.ProfileHeader>}
- */
- getProfiles() {
- /**
- * @param {!Profiler.ProfileHeader} profile
- * @return {boolean}
- * @this {ProfileType}
- */
- function isFinished(profile) {
- return this._profileBeingRecorded !== profile;
- }
- return this._profiles.filter(isFinished.bind(this));
- }
-
- /**
- * @return {?Element}
- */
- customContent() {
- return null;
- }
-
- /**
- * @param {boolean} enable
- */
- setCustomContentEnabled(enable) {
- }
-
- /**
- * @param {number} uid
- * @return {?Profiler.ProfileHeader}
- */
- getProfile(uid) {
- for (let i = 0; i < this._profiles.length; ++i) {
- if (this._profiles[i].uid === uid) {
- return this._profiles[i];
- }
- }
- return null;
- }
-
- /**
- * @param {!File} file
- * @return {!Promise<?Error|?FileError>}
- */
- loadFromFile(file) {
- let name = file.name;
- const fileExtension = this.fileExtension();
- if (fileExtension && name.endsWith(fileExtension)) {
- name = name.substr(0, name.length - fileExtension.length);
- }
- const profile = this.createProfileLoadedFromFile(name);
- profile.setFromFile();
- this.setProfileBeingRecorded(profile);
- this.addProfile(profile);
- return profile.loadFromFile(file);
- }
-
- /**
- * @param {string} title
- * @return {!Profiler.ProfileHeader}
- */
- createProfileLoadedFromFile(title) {
- throw new Error('Needs implemented.');
- }
-
- /**
- * @param {!Profiler.ProfileHeader} profile
- */
- addProfile(profile) {
- this._profiles.push(profile);
- this.dispatchEventToListeners(Events.AddProfileHeader, profile);
- }
-
- /**
- * @param {!Profiler.ProfileHeader} profile
- */
- removeProfile(profile) {
- const index = this._profiles.indexOf(profile);
- if (index === -1) {
- return;
- }
- this._profiles.splice(index, 1);
- this._disposeProfile(profile);
- }
-
- _clearTempStorage() {
- for (let i = 0; i < this._profiles.length; ++i) {
- this._profiles[i].removeTempFile();
- }
- }
-
- /**
- * @return {?Profiler.ProfileHeader}
- */
- profileBeingRecorded() {
- return this._profileBeingRecorded;
- }
-
- /**
- * @param {?Profiler.ProfileHeader} profile
- */
- setProfileBeingRecorded(profile) {
- this._profileBeingRecorded = profile;
- }
-
- profileBeingRecordedRemoved() {
- }
-
- reset() {
- for (const profile of this._profiles.slice()) {
- this._disposeProfile(profile);
- }
- this._profiles = [];
- this._nextProfileUid = 1;
- }
-
- /**
- * @param {!Profiler.ProfileHeader} profile
- */
- _disposeProfile(profile) {
- this.dispatchEventToListeners(Events.RemoveProfileHeader, profile);
- profile.dispose();
- if (this._profileBeingRecorded === profile) {
- this.profileBeingRecordedRemoved();
- this.setProfileBeingRecorded(null);
- }
- }
-}
-
-/** @enum {symbol} */
-export const Events = {
- AddProfileHeader: Symbol('add-profile-header'),
- ProfileComplete: Symbol('profile-complete'),
- RemoveProfileHeader: Symbol('remove-profile-header'),
- ViewUpdated: Symbol('view-updated')
-};
-
-/**
- * @interface
- */
-export class DataDisplayDelegate {
- /**
- * @param {?Profiler.ProfileHeader} profile
- * @return {?UI.Widget}
- */
- showProfile(profile) {
- }
-
- /**
- * @param {!Protocol.HeapProfiler.HeapSnapshotObjectId} snapshotObjectId
- * @param {string} perspectiveName
- */
- showObject(snapshotObjectId, perspectiveName) {
- }
-
- /**
- * @param {number} nodeIndex
- * @return {!Promise<?Element>}
- */
- async linkifyObject(nodeIndex) {}
-}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.ProfileType = ProfileType;
-
-/** @enum {symbol} */
-Profiler.ProfileType.Events = Events;
-
-/** @interface */
-Profiler.ProfileType.DataDisplayDelegate = DataDisplayDelegate;
diff --git a/front_end/profiler/ProfileTypeRegistry.js b/front_end/profiler/ProfileTypeRegistry.js
index 359f208..512e021 100644
--- a/front_end/profiler/ProfileTypeRegistry.js
+++ b/front_end/profiler/ProfileTypeRegistry.js
@@ -1,30 +1,24 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+import {CPUProfileType} from './CPUProfileView.js';
+import {SamplingHeapProfileType, SamplingNativeHeapProfileType, SamplingNativeHeapSnapshotBrowserType, SamplingNativeHeapSnapshotRendererType,} from './HeapProfileView.js';
+import {HeapSnapshotProfileType, TrackingHeapSnapshotProfileType} from './HeapSnapshotView.js';
+
/**
* @unrestricted
*/
-export default class ProfileTypeRegistry {
+export class ProfileTypeRegistry {
constructor() {
- this.cpuProfileType = new Profiler.CPUProfileType();
- this.heapSnapshotProfileType = new Profiler.HeapSnapshotProfileType();
- this.samplingHeapProfileType = new Profiler.SamplingHeapProfileType();
- this.samplingNativeHeapProfileType = new Profiler.SamplingNativeHeapProfileType();
- this.samplingNativeHeapSnapshotBrowserType = new Profiler.SamplingNativeHeapSnapshotBrowserType();
- this.samplingNativeHeapSnapshotRendererType = new Profiler.SamplingNativeHeapSnapshotRendererType();
- this.trackingHeapSnapshotProfileType = new Profiler.TrackingHeapSnapshotProfileType();
+ this.cpuProfileType = new CPUProfileType();
+ this.heapSnapshotProfileType = new HeapSnapshotProfileType();
+ this.samplingHeapProfileType = new SamplingHeapProfileType();
+ this.samplingNativeHeapProfileType = new SamplingNativeHeapProfileType();
+ this.samplingNativeHeapSnapshotBrowserType = new SamplingNativeHeapSnapshotBrowserType();
+ this.samplingNativeHeapSnapshotRendererType = new SamplingNativeHeapSnapshotRendererType();
+ this.trackingHeapSnapshotProfileType = new TrackingHeapSnapshotProfileType();
}
}
export const instance = new ProfileTypeRegistry();
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.ProfileTypeRegistry = ProfileTypeRegistry;
-
-Profiler.ProfileTypeRegistry.instance = instance;
diff --git a/front_end/profiler/ProfileView.js b/front_end/profiler/ProfileView.js
index 0dd9cc8..74598d8 100644
--- a/front_end/profiler/ProfileView.js
+++ b/front_end/profiler/ProfileView.js
@@ -2,11 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import {BottomUpProfileDataGridTree} from './BottomUpProfileDataGrid.js';
+import {CPUProfileFlameChart, ProfileFlameChartDataProvider} from './CPUProfileFlameChart.js'; // eslint-disable-line no-unused-vars
+import {Formatter, ProfileDataGridNode, ProfileDataGridTree} from './ProfileDataGrid.js'; // eslint-disable-line no-unused-vars
+import {DataDisplayDelegate, Events, ProfileHeader, ProfileType} from './ProfileHeader.js'; // eslint-disable-line no-unused-vars
+import {ProfileSidebarTreeElement} from './ProfileSidebarTreeElement.js';
+import {TopDownProfileDataGridTree} from './TopDownProfileDataGrid.js';
+
/**
* @implements {UI.Searchable}
* @unrestricted
*/
-export default class ProfileView extends UI.SimpleView {
+export class ProfileView extends UI.SimpleView {
constructor() {
super(Common.UIString('Profile'));
@@ -48,7 +55,7 @@
this.resetButton.setEnabled(false);
this.resetButton.addEventListener(UI.ToolbarButton.Events.Click, this._resetClicked, this);
- this._linkifier = new Components.Linkifier(_maxLinkLength);
+ this._linkifier = new Components.Linkifier(maxLinkLength);
}
/**
@@ -84,7 +91,7 @@
}
/**
- * @param {!Profiler.ProfileDataGridNode.Formatter} nodeFormatter
+ * @param {!Formatter} nodeFormatter
* @param {!Array<string>=} viewTypes
* @protected
*/
@@ -152,22 +159,22 @@
}
/**
- * @return {!Profiler.ProfileDataGridTree}
+ * @return {!ProfileDataGridTree}
*/
_getBottomUpProfileDataGridTree() {
if (!this._bottomUpProfileDataGridTree) {
- this._bottomUpProfileDataGridTree = new Profiler.BottomUpProfileDataGridTree(
+ this._bottomUpProfileDataGridTree = new BottomUpProfileDataGridTree(
this._nodeFormatter, this._searchableView, this._profile.root, this.adjustedTotal);
}
return this._bottomUpProfileDataGridTree;
}
/**
- * @return {!Profiler.ProfileDataGridTree}
+ * @return {!ProfileDataGridTree}
*/
_getTopDownProfileDataGridTree() {
if (!this._topDownProfileDataGridTree) {
- this._topDownProfileDataGridTree = new Profiler.TopDownProfileDataGridTree(
+ this._topDownProfileDataGridTree = new TopDownProfileDataGridTree(
this._nodeFormatter, this._searchableView, this._profile.root, this.adjustedTotal);
}
return this._topDownProfileDataGridTree;
@@ -178,7 +185,7 @@
* @param {!DataGrid.DataGridNode} gridNode
*/
_populateContextMenu(contextMenu, gridNode) {
- const node = /** @type {!Profiler.ProfileDataGridNode} */ (gridNode);
+ const node = /** @type {!ProfileDataGridNode} */ (gridNode);
if (node.linkElement && !contextMenu.containsTarget(node.linkElement)) {
contextMenu.appendApplicableItems(node.linkElement);
}
@@ -296,7 +303,7 @@
}
/**
- * @return {!Profiler.ProfileFlameChartDataProvider}
+ * @return {!ProfileFlameChartDataProvider}
*/
createFlameChartDataProvider() {
throw 'Not implemented';
@@ -307,7 +314,7 @@
return;
}
this._dataProvider = this.createFlameChartDataProvider();
- this._flameChart = new Profiler.CPUProfileFlameChart(this._searchableView, this._dataProvider);
+ this._flameChart = new CPUProfileFlameChart(this._searchableView, this._dataProvider);
this._flameChart.addEventListener(PerfUI.FlameChart.Events.EntryInvoked, this._onEntryInvoked.bind(this));
}
@@ -432,13 +439,13 @@
const sortAscending = this.dataGrid.isSortOrderAscending();
const sortColumnId = this.dataGrid.sortColumnId();
const sortProperty = sortColumnId === 'function' ? 'functionName' : sortColumnId || '';
- this.profileDataGridTree.sort(Profiler.ProfileDataGridTree.propertyComparator(sortProperty, sortAscending));
+ this.profileDataGridTree.sort(ProfileDataGridTree.propertyComparator(sortProperty, sortAscending));
this.refresh();
}
}
-export const _maxLinkLength = 30;
+export const maxLinkLength = 30;
/** @enum {string} */
export const ViewTypes = {
@@ -452,10 +459,10 @@
* @implements {Common.OutputStream}
* @unrestricted
*/
-export class WritableProfileHeader extends Profiler.ProfileHeader {
+export class WritableProfileHeader extends ProfileHeader {
/**
* @param {?SDK.DebuggerModel} debuggerModel
- * @param {!Profiler.ProfileType} type
+ * @param {!ProfileType} type
* @param {string=} title
*/
constructor(debuggerModel, type, title) {
@@ -502,11 +509,11 @@
/**
* @override
- * @param {!Profiler.ProfileType.DataDisplayDelegate} panel
- * @return {!Profiler.ProfileSidebarTreeElement}
+ * @param {!DataDisplayDelegate} panel
+ * @return {!ProfileSidebarTreeElement}
*/
createSidebarTreeElement(panel) {
- return new Profiler.ProfileSidebarTreeElement(panel, this, 'profile-sidebar-tree-item');
+ return new ProfileSidebarTreeElement(panel, this, 'profile-sidebar-tree-item');
}
/**
@@ -578,24 +585,7 @@
this._tempFile = new Bindings.TempFile();
this._tempFile.write([JSON.stringify(profile)]);
if (this.canSaveToFile()) {
- this.dispatchEventToListeners(Profiler.ProfileHeader.Events.ProfileReceived);
+ this.dispatchEventToListeners(Events.ProfileReceived);
}
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.ProfileView = ProfileView;
-
-Profiler.ProfileView._maxLinkLength = _maxLinkLength;
-
-/** @enum {string} */
-Profiler.ProfileView.ViewTypes = ViewTypes;
-
-/** @constructor */
-Profiler.WritableProfileHeader = WritableProfileHeader;
diff --git a/front_end/profiler/ProfilesPanel.js b/front_end/profiler/ProfilesPanel.js
index 2dddc65..858ef1a 100644
--- a/front_end/profiler/ProfilesPanel.js
+++ b/front_end/profiler/ProfilesPanel.js
@@ -23,14 +23,19 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import {DataDisplayDelegate, Events as ProfileHeaderEvents, ProfileEvents as ProfileTypeEvents, ProfileHeader, ProfileType} from './ProfileHeader.js'; // eslint-disable-line no-unused-vars
+import {Events as ProfileLauncherEvents, ProfileLauncherView} from './ProfileLauncherView.js';
+import {ProfileSidebarTreeElement} from './ProfileSidebarTreeElement.js'; // eslint-disable-line no-unused-vars
+import {instance} from './ProfileTypeRegistry.js';
+
/**
- * @implements {Profiler.ProfileType.DataDisplayDelegate}
+ * @implements {DataDisplayDelegate}
* @unrestricted
*/
-export default class ProfilesPanel extends UI.PanelWithSidebar {
+export class ProfilesPanel extends UI.PanelWithSidebar {
/**
* @param {string} name
- * @param {!Array.<!Profiler.ProfileType>} profileTypes
+ * @param {!Array.<!ProfileType>} profileTypes
* @param {string} recordingActionId
*/
constructor(name, profileTypes, recordingActionId) {
@@ -81,9 +86,8 @@
this._profileViewToolbar = new UI.Toolbar('', this._toolbarElement);
this._profileGroups = {};
- this._launcherView = new Profiler.ProfileLauncherView(this);
- this._launcherView.addEventListener(
- Profiler.ProfileLauncherView.Events.ProfileTypeSelected, this._onProfileTypeSelected, this);
+ this._launcherView = new ProfileLauncherView(this);
+ this._launcherView.addEventListener(ProfileLauncherEvents.ProfileTypeSelected, this._onProfileTypeSelected, this);
this._profileToView = [];
this._typeIdToSidebarSection = {};
@@ -137,7 +141,7 @@
/**
* @param {string} fileName
- * @return {?Profiler.ProfileType}
+ * @return {?ProfileType}
*/
_findProfileTypeByExtension(fileName) {
return this._profileTypes.find(type => !!type.fileExtension() && fileName.endsWith(type.fileExtension() || '')) ||
@@ -225,7 +229,7 @@
* @param {!Common.Event} event
*/
_onProfileTypeSelected(event) {
- this._selectedProfileType = /** @type {!Profiler.ProfileType} */ (event.data);
+ this._selectedProfileType = /** @type {!ProfileType} */ (event.data);
this._updateProfileTypeSpecificUI();
}
@@ -262,7 +266,7 @@
}
/**
- * @param {!Profiler.ProfileType} profileType
+ * @param {!ProfileType} profileType
*/
_registerProfileType(profileType) {
this._launcherView.addProfileType(profileType);
@@ -277,7 +281,7 @@
* @this {ProfilesPanel}
*/
function onAddProfileHeader(event) {
- this._addProfileHeader(/** @type {!Profiler.ProfileHeader} */ (event.data));
+ this._addProfileHeader(/** @type {!ProfileHeader} */ (event.data));
}
/**
@@ -285,7 +289,7 @@
* @this {ProfilesPanel}
*/
function onRemoveProfileHeader(event) {
- this._removeProfileHeader(/** @type {!Profiler.ProfileHeader} */ (event.data));
+ this._removeProfileHeader(/** @type {!ProfileHeader} */ (event.data));
}
/**
@@ -293,13 +297,13 @@
* @this {ProfilesPanel}
*/
function profileComplete(event) {
- this.showProfile(/** @type {!Profiler.ProfileHeader} */ (event.data));
+ this.showProfile(/** @type {!ProfileHeader} */ (event.data));
}
- profileType.addEventListener(Profiler.ProfileType.Events.ViewUpdated, this._updateProfileTypeSpecificUI, this);
- profileType.addEventListener(Profiler.ProfileType.Events.AddProfileHeader, onAddProfileHeader, this);
- profileType.addEventListener(Profiler.ProfileType.Events.RemoveProfileHeader, onRemoveProfileHeader, this);
- profileType.addEventListener(Profiler.ProfileType.Events.ProfileComplete, profileComplete, this);
+ profileType.addEventListener(ProfileTypeEvents.ViewUpdated, this._updateProfileTypeSpecificUI, this);
+ profileType.addEventListener(ProfileTypeEvents.AddProfileHeader, onAddProfileHeader, this);
+ profileType.addEventListener(ProfileTypeEvents.RemoveProfileHeader, onRemoveProfileHeader, this);
+ profileType.addEventListener(ProfileTypeEvents.ProfileComplete, profileComplete, this);
const profiles = profileType.getProfiles();
for (let i = 0; i < profiles.length; i++) {
@@ -324,7 +328,7 @@
}
/**
- * @param {!Profiler.ProfileHeader} profile
+ * @param {!ProfileHeader} profile
*/
_addProfileHeader(profile) {
const profileType = profile.profileType();
@@ -336,7 +340,7 @@
}
/**
- * @param {!Profiler.ProfileHeader} profile
+ * @param {!ProfileHeader} profile
*/
_removeProfileHeader(profile) {
if (profile.profileType().profileBeingRecorded() === profile) {
@@ -361,7 +365,7 @@
/**
* @override
- * @param {?Profiler.ProfileHeader} profile
+ * @param {?ProfileHeader} profile
* @return {?UI.Widget}
*/
showProfile(profile) {
@@ -413,7 +417,7 @@
}
/**
- * @param {!Profiler.ProfileHeader} profile
+ * @param {!ProfileHeader} profile
* @return {!UI.Widget}
*/
viewForProfile(profile) {
@@ -428,7 +432,7 @@
}
/**
- * @param {!Profiler.ProfileHeader} profile
+ * @param {!ProfileHeader} profile
* @return {number}
*/
_indexOfViewForProfile(profile) {
@@ -455,8 +459,8 @@
*/
export class ProfileTypeSidebarSection extends UI.TreeElement {
/**
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
- * @param {!Profiler.ProfileType} profileType
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
+ * @param {!ProfileType} profileType
*/
constructor(dataDisplayDelegate, profileType) {
super(profileType.treeItemTitle.escapeHTML(), true);
@@ -472,13 +476,14 @@
}
/**
- * @param {!Profiler.ProfileHeader} profile
+ * @param {!ProfileHeader} profile
*/
addProfileHeader(profile) {
this.hidden = false;
const profileType = profile.profileType();
let sidebarParent = this;
- const profileTreeElement = profile.createSidebarTreeElement(this._dataDisplayDelegate);
+ const profileTreeElement =
+ /** @type {!ProfileSidebarTreeElement} */ (profile.createSidebarTreeElement(this._dataDisplayDelegate));
this._profileTreeElements.push(profileTreeElement);
if (!profile.fromFile() && profileType.profileBeingRecorded() !== profile) {
@@ -525,7 +530,7 @@
}
/**
- * @param {!Profiler.ProfileHeader} profile
+ * @param {!ProfileHeader} profile
* @return {boolean}
*/
removeProfileHeader(profile) {
@@ -566,7 +571,7 @@
}
/**
- * @param {!Profiler.ProfileHeader} profile
+ * @param {!ProfileHeader} profile
* @return {?ProfileSidebarTreeElement}
*/
sidebarElementForProfile(profile) {
@@ -575,7 +580,7 @@
}
/**
- * @param {!Profiler.ProfileHeader} profile
+ * @param {!ProfileHeader} profile
* @return {number}
*/
_sidebarElementIndex(profile) {
@@ -611,178 +616,9 @@
/**
* @unrestricted
*/
-export class ProfileSidebarTreeElement extends UI.TreeElement {
- /**
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
- * @param {!Profiler.ProfileHeader} profile
- * @param {string} className
- */
- constructor(dataDisplayDelegate, profile, className) {
- super('', false);
- this._iconElement = createElementWithClass('div', 'icon');
- this._titlesElement = createElementWithClass('div', 'titles no-subtitle');
- this._titleContainer = this._titlesElement.createChild('span', 'title-container');
- this.titleElement = this._titleContainer.createChild('span', 'title');
- this._subtitleElement = this._titlesElement.createChild('span', 'subtitle');
-
- this.titleElement.textContent = profile.title;
- this._className = className;
- this._small = false;
- this._dataDisplayDelegate = dataDisplayDelegate;
- this.profile = profile;
- profile.addEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this);
- if (profile.canSaveToFile()) {
- this._createSaveLink();
- } else {
- profile.addEventListener(Profiler.ProfileHeader.Events.ProfileReceived, this._onProfileReceived, this);
- }
- }
-
- _createSaveLink() {
- this._saveLinkElement = this._titleContainer.createChild('span', 'save-link');
- this._saveLinkElement.textContent = Common.UIString('Save');
- this._saveLinkElement.addEventListener('click', this._saveProfile.bind(this), false);
- }
-
- _onProfileReceived(event) {
- this._createSaveLink();
- }
-
- /**
- * @param {!Common.Event} event
- */
- _updateStatus(event) {
- const statusUpdate = event.data;
- if (statusUpdate.subtitle !== null) {
- this._subtitleElement.textContent = statusUpdate.subtitle || '';
- this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle);
- }
- if (typeof statusUpdate.wait === 'boolean' && this.listItemElement) {
- this.listItemElement.classList.toggle('wait', statusUpdate.wait);
- }
- }
-
- /**
- * @override
- * @param {!Event} event
- * @return {boolean}
- */
- ondblclick(event) {
- if (!this._editing) {
- this._startEditing(/** @type {!Element} */ (event.target));
- }
- return false;
- }
-
- /**
- * @param {!Element} eventTarget
- */
- _startEditing(eventTarget) {
- const container = eventTarget.enclosingNodeOrSelfWithClass('title');
- if (!container) {
- return;
- }
- const config = new UI.InplaceEditor.Config(this._editingCommitted.bind(this), this._editingCancelled.bind(this));
- this._editing = UI.InplaceEditor.startEditing(container, config);
- }
-
- /**
- * @param {!Element} container
- * @param {string} newTitle
- */
- _editingCommitted(container, newTitle) {
- delete this._editing;
- this.profile.setTitle(newTitle);
- }
-
- _editingCancelled() {
- delete this._editing;
- }
-
- dispose() {
- this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this);
- this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceived, this._onProfileReceived, this);
- }
-
- /**
- * @override
- * @return {boolean}
- */
- onselect() {
- this._dataDisplayDelegate.showProfile(this.profile);
- return true;
- }
-
- /**
- * @override
- * @return {boolean}
- */
- ondelete() {
- this.profile.profileType().removeProfile(this.profile);
- return true;
- }
-
- /**
- * @override
- */
- onattach() {
- if (this._className) {
- this.listItemElement.classList.add(this._className);
- }
- if (this._small) {
- this.listItemElement.classList.add('small');
- }
- this.listItemElement.appendChildren(this._iconElement, this._titlesElement);
- this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
-
- UI.ARIAUtils.setDescription(this.listItemElement, ls`${this.profile.profileType().name}`);
- }
-
- /**
- * @param {!Event} event
- */
- _handleContextMenuEvent(event) {
- const profile = this.profile;
- const contextMenu = new UI.ContextMenu(event);
- // FIXME: use context menu provider
- contextMenu.headerSection().appendItem(
- Common.UIString('Load\u2026'),
- ProfilesPanel._fileSelectorElement.click.bind(ProfilesPanel._fileSelectorElement));
- if (profile.canSaveToFile()) {
- contextMenu.saveSection().appendItem(Common.UIString('Save\u2026'), profile.saveToFile.bind(profile));
- }
- contextMenu.footerSection().appendItem(Common.UIString('Delete'), this.ondelete.bind(this));
- contextMenu.show();
- }
-
- _saveProfile(event) {
- this.profile.saveToFile();
- }
-
- /**
- * @param {boolean} small
- */
- setSmall(small) {
- this._small = small;
- if (this.listItemElement) {
- this.listItemElement.classList.toggle('small', this._small);
- }
- }
-
- /**
- * @param {string} title
- */
- setMainTitle(title) {
- this.titleElement.textContent = title;
- }
-}
-
-/**
- * @unrestricted
- */
export class ProfileGroupSidebarTreeElement extends UI.TreeElement {
/**
- * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
+ * @param {!DataDisplayDelegate} dataDisplayDelegate
* @param {string} title
*/
constructor(dataDisplayDelegate, title) {
@@ -856,7 +692,7 @@
*/
export class JSProfilerPanel extends ProfilesPanel {
constructor() {
- const registry = Profiler.ProfileTypeRegistry.instance;
+ const registry = instance;
super('js_profiler', [registry.cpuProfileType], 'profiler.js-toggle-recording');
}
@@ -887,30 +723,3 @@
return true;
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.ProfilesPanel = ProfilesPanel;
-
-/** @constructor */
-Profiler.ProfileTypeSidebarSection = ProfileTypeSidebarSection;
-
-/** @constructor */
-Profiler.ProfileTypeSidebarSection.ProfileGroup = ProfileGroup;
-
-/** @constructor */
-Profiler.ProfileSidebarTreeElement = ProfileSidebarTreeElement;
-
-/** @constructor */
-Profiler.ProfileGroupSidebarTreeElement = ProfileGroupSidebarTreeElement;
-
-/** @constructor */
-Profiler.ProfilesSidebarTreeElement = ProfilesSidebarTreeElement;
-
-/** @constructor */
-Profiler.JSProfilerPanel = JSProfilerPanel;
diff --git a/front_end/profiler/TopDownProfileDataGrid.js b/front_end/profiler/TopDownProfileDataGrid.js
index b85a845..3fddcdc 100644
--- a/front_end/profiler/TopDownProfileDataGrid.js
+++ b/front_end/profiler/TopDownProfileDataGrid.js
@@ -23,10 +23,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import {Formatter, ProfileDataGridNode, ProfileDataGridTree} from './ProfileDataGrid.js'; // eslint-disable-line no-unused-vars
+
/**
* @unrestricted
*/
-export class TopDownProfileDataGridNode extends Profiler.ProfileDataGridNode {
+export class TopDownProfileDataGridNode extends ProfileDataGridNode {
/**
* @param {!SDK.ProfileNode} profileNode
* @param {!TopDownProfileDataGridTree} owningTree
@@ -75,7 +77,7 @@
const child = container.childrenByCallUID.get(aCallUID);
if (child) {
- Profiler.ProfileDataGridNode.merge(container, child, true);
+ ProfileDataGridNode.merge(container, child, true);
}
}
@@ -90,9 +92,9 @@
/**
* @unrestricted
*/
-export class TopDownProfileDataGridTree extends Profiler.ProfileDataGridTree {
+export class TopDownProfileDataGridTree extends ProfileDataGridTree {
/**
- * @param {!Profiler.ProfileDataGridNode.Formatter} formatter
+ * @param {!Formatter} formatter
* @param {!UI.SearchableView} searchableView
* @param {!SDK.ProfileNode} rootProfileNode
* @param {number} total
@@ -100,11 +102,11 @@
constructor(formatter, searchableView, rootProfileNode, total) {
super(formatter, searchableView, total);
this._remainingChildren = rootProfileNode.children;
- Profiler.ProfileDataGridNode.populate(this);
+ ProfileDataGridNode.populate(this);
}
/**
- * @param {!Profiler.ProfileDataGridNode} profileDataGridNode
+ * @param {!ProfileDataGridNode} profileDataGridNode
*/
focus(profileDataGridNode) {
if (!profileDataGridNode) {
@@ -119,7 +121,7 @@
}
/**
- * @param {!Profiler.ProfileDataGridNode} profileDataGridNode
+ * @param {!ProfileDataGridNode} profileDataGridNode
*/
exclude(profileDataGridNode) {
if (!profileDataGridNode) {
@@ -155,15 +157,3 @@
TopDownProfileDataGridNode._sharedPopulate(this);
}
}
-
-/* Legacy exported object */
-self.Profiler = self.Profiler || {};
-
-/* Legacy exported object */
-Profiler = Profiler || {};
-
-/** @constructor */
-Profiler.TopDownProfileDataGridNode = TopDownProfileDataGridNode;
-
-/** @constructor */
-Profiler.TopDownProfileDataGridTree = TopDownProfileDataGridTree;
diff --git a/front_end/profiler/module.json b/front_end/profiler/module.json
index d6a208c..f73f405 100644
--- a/front_end/profiler/module.json
+++ b/front_end/profiler/module.json
@@ -124,13 +124,15 @@
"scripts": [],
"modules": [
"profiler.js",
- "ProfileType.js",
+ "profiler-legacy.js",
"ProfileHeader.js",
"ProfilesPanel.js",
"ProfileView.js",
"ProfileDataGrid.js",
+ "ProfileSidebarTreeElement.js",
"BottomUpProfileDataGrid.js",
"TopDownProfileDataGrid.js",
+ "ChildrenProvider.js",
"CPUProfileFlameChart.js",
"CPUProfileView.js",
"HeapProfileView.js",
diff --git a/front_end/profiler/profiler-legacy.js b/front_end/profiler/profiler-legacy.js
new file mode 100644
index 0000000..4873758
--- /dev/null
+++ b/front_end/profiler/profiler-legacy.js
@@ -0,0 +1,287 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import * as ProfilerModule from './profiler.js';
+
+self.Profiler = self.Profiler || {};
+Profiler = Profiler || {};
+
+/** @constructor */
+Profiler.BottomUpProfileDataGridNode = ProfilerModule.BottomUpProfileDataGrid.BottomUpProfileDataGridNode;
+
+/** @constructor */
+Profiler.BottomUpProfileDataGridTree = ProfilerModule.BottomUpProfileDataGrid.BottomUpProfileDataGridTree;
+
+/** @constructor */
+Profiler.CPUProfileFlameChart = ProfilerModule.CPUProfileFlameChart.CPUProfileFlameChart;
+
+/** @constructor */
+Profiler.CPUProfileFlameChart.OverviewCalculator = ProfilerModule.CPUProfileFlameChart.OverviewCalculator;
+
+/** @constructor */
+Profiler.CPUProfileFlameChart.OverviewPane = ProfilerModule.CPUProfileFlameChart.OverviewPane;
+
+/** @constructor */
+Profiler.ProfileFlameChartDataProvider = ProfilerModule.CPUProfileFlameChart.ProfileFlameChartDataProvider;
+
+/** @constructor */
+Profiler.CPUProfileView = ProfilerModule.CPUProfileView.CPUProfileView;
+
+/** @constructor */
+Profiler.CPUProfileView.NodeFormatter = ProfilerModule.CPUProfileView.NodeFormatter;
+
+/** @constructor */
+Profiler.CPUProfileType = ProfilerModule.CPUProfileView.CPUProfileType;
+
+/** @constructor */
+Profiler.CPUProfileHeader = ProfilerModule.CPUProfileView.CPUProfileHeader;
+
+/** @constructor */
+Profiler.CPUFlameChartDataProvider = ProfilerModule.CPUProfileView.CPUFlameChartDataProvider;
+
+/** @constructor */
+Profiler.HeapProfileView = ProfilerModule.HeapProfileView.HeapProfileView;
+
+/** @constructor */
+Profiler.HeapProfileView.NodeFormatter = ProfilerModule.HeapProfileView.NodeFormatter;
+
+/** @constructor */
+Profiler.SamplingHeapProfileTypeBase = ProfilerModule.HeapProfileView.SamplingHeapProfileTypeBase;
+
+/** @constructor */
+Profiler.SamplingHeapProfileType = ProfilerModule.HeapProfileView.SamplingHeapProfileType;
+
+/** @constructor */
+Profiler.SamplingNativeHeapProfileType = ProfilerModule.HeapProfileView.SamplingNativeHeapProfileType;
+
+/** @constructor */
+Profiler.SamplingNativeHeapSnapshotType = ProfilerModule.HeapProfileView.SamplingNativeHeapSnapshotType;
+
+/** @constructor */
+Profiler.SamplingNativeHeapSnapshotBrowserType = ProfilerModule.HeapProfileView.SamplingNativeHeapSnapshotBrowserType;
+
+/** @constructor */
+Profiler.SamplingNativeHeapSnapshotRendererType = ProfilerModule.HeapProfileView.SamplingNativeHeapSnapshotRendererType;
+
+/** @constructor */
+Profiler.SamplingHeapProfileHeader = ProfilerModule.HeapProfileView.SamplingHeapProfileHeader;
+
+/** @constructor */
+Profiler.SamplingHeapProfileNode = ProfilerModule.HeapProfileView.SamplingHeapProfileNode;
+
+/** @constructor */
+Profiler.SamplingHeapProfileModel = ProfilerModule.HeapProfileView.SamplingHeapProfileModel;
+
+/** @constructor */
+Profiler.HeapFlameChartDataProvider = ProfilerModule.HeapProfileView.HeapFlameChartDataProvider;
+
+/** @constructor */
+Profiler.HeapProfilerPanel = ProfilerModule.HeapProfilerPanel.HeapProfilerPanel;
+
+/** @constructor */
+Profiler.HeapSnapshotSortableDataGrid = ProfilerModule.HeapSnapshotDataGrids.HeapSnapshotSortableDataGrid;
+
+/** @constructor */
+Profiler.HeapSnapshotViewportDataGrid = ProfilerModule.HeapSnapshotDataGrids.HeapSnapshotViewportDataGrid;
+
+/** @constructor */
+Profiler.HeapSnapshotContainmentDataGrid = ProfilerModule.HeapSnapshotDataGrids.HeapSnapshotContainmentDataGrid;
+
+/** @constructor */
+Profiler.HeapSnapshotRetainmentDataGrid = ProfilerModule.HeapSnapshotDataGrids.HeapSnapshotRetainmentDataGrid;
+
+/** @constructor */
+Profiler.HeapSnapshotConstructorsDataGrid = ProfilerModule.HeapSnapshotDataGrids.HeapSnapshotConstructorsDataGrid;
+
+/** @constructor */
+Profiler.HeapSnapshotDiffDataGrid = ProfilerModule.HeapSnapshotDataGrids.HeapSnapshotDiffDataGrid;
+
+/** @constructor */
+Profiler.AllocationDataGrid = ProfilerModule.HeapSnapshotDataGrids.AllocationDataGrid;
+
+/** @constructor */
+Profiler.HeapSnapshotGridNode = ProfilerModule.HeapSnapshotGridNodes.HeapSnapshotGridNode;
+
+/** @interface */
+Profiler.HeapSnapshotGridNode.ChildrenProvider = ProfilerModule.ChildrenProvider.ChildrenProvider;
+
+/** @constructor */
+Profiler.HeapSnapshotGenericObjectNode = ProfilerModule.HeapSnapshotGridNodes.HeapSnapshotGenericObjectNode;
+
+/** @constructor */
+Profiler.HeapSnapshotObjectNode = ProfilerModule.HeapSnapshotGridNodes.HeapSnapshotObjectNode;
+
+/** @constructor */
+Profiler.HeapSnapshotRetainingObjectNode = ProfilerModule.HeapSnapshotGridNodes.HeapSnapshotRetainingObjectNode;
+
+/** @constructor */
+Profiler.HeapSnapshotInstanceNode = ProfilerModule.HeapSnapshotGridNodes.HeapSnapshotInstanceNode;
+
+/** @constructor */
+Profiler.HeapSnapshotConstructorNode = ProfilerModule.HeapSnapshotGridNodes.HeapSnapshotConstructorNode;
+
+/** @constructor */
+Profiler.HeapSnapshotDiffNodesProvider = ProfilerModule.HeapSnapshotGridNodes.HeapSnapshotDiffNodesProvider;
+
+/** @constructor */
+Profiler.HeapSnapshotDiffNode = ProfilerModule.HeapSnapshotGridNodes.HeapSnapshotDiffNode;
+
+/** @constructor */
+Profiler.AllocationGridNode = ProfilerModule.HeapSnapshotGridNodes.AllocationGridNode;
+
+/** @constructor */
+Profiler.HeapSnapshotProxy = ProfilerModule.HeapSnapshotProxy.HeapSnapshotProxy;
+
+/** @constructor */
+Profiler.HeapSnapshotWorkerProxy = ProfilerModule.HeapSnapshotProxy.HeapSnapshotWorkerProxy;
+
+/** @constructor */
+Profiler.HeapSnapshotProxyObject = ProfilerModule.HeapSnapshotProxy.HeapSnapshotProxyObject;
+
+/** @constructor */
+Profiler.HeapSnapshotLoaderProxy = ProfilerModule.HeapSnapshotProxy.HeapSnapshotLoaderProxy;
+
+/** @constructor */
+Profiler.HeapSnapshotProviderProxy = ProfilerModule.HeapSnapshotProxy.HeapSnapshotProviderProxy;
+
+/** @constructor */
+Profiler.HeapSnapshotView = ProfilerModule.HeapSnapshotView.HeapSnapshotView;
+
+/** @constructor */
+Profiler.HeapSnapshotView.Perspective = ProfilerModule.HeapSnapshotView.Perspective;
+
+/** @constructor */
+Profiler.HeapSnapshotView.SummaryPerspective = ProfilerModule.HeapSnapshotView.SummaryPerspective;
+
+/** @constructor */
+Profiler.HeapSnapshotView.ComparisonPerspective = ProfilerModule.HeapSnapshotView.ComparisonPerspective;
+
+/** @constructor */
+Profiler.HeapSnapshotView.ContainmentPerspective = ProfilerModule.HeapSnapshotView.ContainmentPerspective;
+
+/** @constructor */
+Profiler.HeapSnapshotView.AllocationPerspective = ProfilerModule.HeapSnapshotView.AllocationPerspective;
+
+/** @constructor */
+Profiler.HeapSnapshotView.StatisticsPerspective = ProfilerModule.HeapSnapshotView.StatisticsPerspective;
+
+/** @constructor */
+Profiler.HeapSnapshotProfileType = ProfilerModule.HeapSnapshotView.HeapSnapshotProfileType;
+
+/** @constructor */
+Profiler.TrackingHeapSnapshotProfileType = ProfilerModule.HeapSnapshotView.TrackingHeapSnapshotProfileType;
+
+/** @constructor */
+Profiler.HeapProfileHeader = ProfilerModule.HeapSnapshotView.HeapProfileHeader;
+
+/** @constructor */
+Profiler.HeapSnapshotStatisticsView = ProfilerModule.HeapSnapshotView.HeapSnapshotStatisticsView;
+
+/** @constructor */
+Profiler.HeapAllocationStackView = ProfilerModule.HeapSnapshotView.HeapAllocationStackView;
+
+/** @constructor */
+Profiler.HeapTimelineOverview = ProfilerModule.HeapTimelineOverview.HeapTimelineOverview;
+
+Profiler.HeapTimelineOverview.IdsRangeChanged = ProfilerModule.HeapTimelineOverview.IdsRangeChanged;
+
+/** @constructor */
+Profiler.HeapTimelineOverview.SmoothScale = ProfilerModule.HeapTimelineOverview.SmoothScale;
+
+/** @constructor */
+Profiler.HeapTimelineOverview.Samples = ProfilerModule.HeapTimelineOverview.Samples;
+
+/** @constructor */
+Profiler.HeapTimelineOverview.OverviewCalculator = ProfilerModule.HeapTimelineOverview.OverviewCalculator;
+
+/** @constructor */
+Profiler.IsolateSelector = ProfilerModule.IsolateSelector.IsolateSelector;
+
+/** @constructor */
+Profiler.IsolateSelector.ListItem = ProfilerModule.IsolateSelector.ListItem;
+
+/** @constructor */
+Profiler.LiveHeapProfileView = ProfilerModule.LiveHeapProfileView.LiveHeapProfileView;
+
+/** @constructor */
+Profiler.LiveHeapProfileView.GridNode = ProfilerModule.LiveHeapProfileView.GridNode;
+
+/** @constructor */
+Profiler.LiveHeapProfileView.ActionDelegate = ProfilerModule.LiveHeapProfileView.ActionDelegate;
+
+/** @constructor */
+Profiler.ProfileDataGridNode = ProfilerModule.ProfileDataGrid.ProfileDataGridNode;
+
+/** @constructor */
+Profiler.ProfileDataGridTree = ProfilerModule.ProfileDataGrid.ProfileDataGridTree;
+
+/** @interface */
+Profiler.ProfileDataGridNode.Formatter = ProfilerModule.ProfileDataGrid.Formatter;
+
+/** @constructor */
+Profiler.ProfileHeader = ProfilerModule.ProfileHeader.ProfileHeader;
+
+/** @constructor */
+Profiler.ProfileHeader.StatusUpdate = ProfilerModule.ProfileHeader.StatusUpdate;
+
+/** @enum {symbol} */
+Profiler.ProfileHeader.Events = ProfilerModule.ProfileHeader.Events;
+
+/** @constructor */
+Profiler.ProfileLauncherView = ProfilerModule.ProfileLauncherView.ProfileLauncherView;
+
+/** @enum {symbol} */
+Profiler.ProfileLauncherView.Events = ProfilerModule.ProfileLauncherView.Events;
+
+/** @constructor */
+Profiler.ProfileType = ProfilerModule.ProfileHeader.ProfileType;
+
+/** @enum {symbol} */
+Profiler.ProfileType.Events = ProfilerModule.ProfileHeader.Events;
+
+/** @interface */
+Profiler.ProfileType.DataDisplayDelegate = ProfilerModule.ProfileHeader.DataDisplayDelegate;
+
+/** @constructor */
+Profiler.ProfileTypeRegistry = ProfilerModule.ProfileTypeRegistry.ProfileTypeRegistry;
+
+Profiler.ProfileTypeRegistry.instance = ProfilerModule.ProfileTypeRegistry.instance;
+
+/** @constructor */
+Profiler.ProfileView = ProfilerModule.ProfileView.ProfileView;
+
+Profiler.ProfileView._maxLinkLength = ProfilerModule.ProfileView.maxLinkLength;
+
+/** @enum {string} */
+Profiler.ProfileView.ViewTypes = ProfilerModule.ProfileView.ViewTypes;
+
+/** @constructor */
+Profiler.WritableProfileHeader = ProfilerModule.ProfileView.WritableProfileHeader;
+
+/** @constructor */
+Profiler.ProfilesPanel = ProfilerModule.ProfilesPanel.ProfilesPanel;
+
+/** @constructor */
+Profiler.ProfileTypeSidebarSection = ProfilerModule.ProfilesPanel.ProfileTypeSidebarSection;
+
+/** @constructor */
+Profiler.ProfileTypeSidebarSection.ProfileGroup = ProfilerModule.ProfilesPanel.ProfileGroup;
+
+/** @constructor */
+Profiler.ProfileSidebarTreeElement = ProfilerModule.ProfileSidebarTreeElement.ProfileSidebarTreeElement;
+
+/** @constructor */
+Profiler.ProfileGroupSidebarTreeElement = ProfilerModule.ProfilesPanel.ProfileGroupSidebarTreeElement;
+
+/** @constructor */
+Profiler.ProfilesSidebarTreeElement = ProfilerModule.ProfilesPanel.ProfilesSidebarTreeElement;
+
+/** @constructor */
+Profiler.JSProfilerPanel = ProfilerModule.ProfilesPanel.JSProfilerPanel;
+
+/** @constructor */
+Profiler.TopDownProfileDataGridNode = ProfilerModule.TopDownProfileDataGrid.TopDownProfileDataGridNode;
+
+/** @constructor */
+Profiler.TopDownProfileDataGridTree = ProfilerModule.TopDownProfileDataGrid.TopDownProfileDataGridTree;
diff --git a/front_end/profiler/profiler.js b/front_end/profiler/profiler.js
index 6bdf46a..4720315 100644
--- a/front_end/profiler/profiler.js
+++ b/front_end/profiler/profiler.js
@@ -2,28 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import './ProfileType.js';
-import './ProfileHeader.js';
-import './ProfilesPanel.js';
-import './ProfileView.js';
-import './ProfileDataGrid.js';
-import './BottomUpProfileDataGrid.js';
-import './TopDownProfileDataGrid.js';
-import './CPUProfileFlameChart.js';
-import './CPUProfileView.js';
-import './HeapProfileView.js';
-import './HeapProfilerPanel.js';
-import './HeapSnapshotProxy.js';
-import './HeapSnapshotDataGrids.js';
-import './HeapSnapshotGridNodes.js';
-import './HeapSnapshotView.js';
-import './HeapTimelineOverview.js';
-import './IsolateSelector.js';
-import './LiveHeapProfileView.js';
-import './ProfileLauncherView.js';
-import './ProfileTypeRegistry.js';
-
import * as BottomUpProfileDataGrid from './BottomUpProfileDataGrid.js';
+import * as ChildrenProvider from './ChildrenProvider.js';
import * as CPUProfileFlameChart from './CPUProfileFlameChart.js';
import * as CPUProfileView from './CPUProfileView.js';
import * as HeapProfilerPanel from './HeapProfilerPanel.js';
@@ -38,14 +18,15 @@
import * as ProfileDataGrid from './ProfileDataGrid.js';
import * as ProfileHeader from './ProfileHeader.js';
import * as ProfileLauncherView from './ProfileLauncherView.js';
+import * as ProfileSidebarTreeElement from './ProfileSidebarTreeElement.js';
import * as ProfilesPanel from './ProfilesPanel.js';
-import * as ProfileType from './ProfileType.js';
import * as ProfileTypeRegistry from './ProfileTypeRegistry.js';
import * as ProfileView from './ProfileView.js';
import * as TopDownProfileDataGrid from './TopDownProfileDataGrid.js';
export {
BottomUpProfileDataGrid,
+ ChildrenProvider,
CPUProfileFlameChart,
CPUProfileView,
HeapProfilerPanel,
@@ -60,8 +41,8 @@
ProfileDataGrid,
ProfileHeader,
ProfileLauncherView,
+ ProfileSidebarTreeElement,
ProfilesPanel,
- ProfileType,
ProfileTypeRegistry,
ProfileView,
TopDownProfileDataGrid,