Migrate profiler/ to ESM

Bug: 1006759
Change-Id: I7ae454c497fbfe3f68bdb18921ee20327324a577
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1981618
Reviewed-by: Paul Lewis <[email protected]>
Commit-Queue: Tim van der Lippe <[email protected]>
diff --git a/front_end/profiler/LiveHeapProfileView.js b/front_end/profiler/LiveHeapProfileView.js
index 7a5ba1a..7e1014f 100644
--- a/front_end/profiler/LiveHeapProfileView.js
+++ b/front_end/profiler/LiveHeapProfileView.js
@@ -5,10 +5,10 @@
 /**
  * @extends {UI.VBox}
  */
-Profiler.LiveHeapProfileView = class extends UI.VBox {
+export default class LiveHeapProfileView extends UI.VBox {
   constructor() {
     super(true);
-    /** @type {!Map<string, !Profiler.LiveHeapProfileView.GridNode>} */
+    /** @type {!Map<string, !GridNode>} */
     this._gridNodeByUrl = new Map();
     this.registerRequiredCSS('profiler/liveHeapProfile.css');
 
@@ -139,7 +139,7 @@
       if (node) {
         node.updateNode(size, isolateCount);
       } else {
-        node = new Profiler.LiveHeapProfileView.GridNode(url, size, isolateCount);
+        node = new GridNode(url, size, isolateCount);
         this._gridNodeByUrl.set(url, node);
         rootNode.appendChild(node);
       }
@@ -256,9 +256,9 @@
   async _stopRecording() {
     this._setting.set(false);
   }
-};
+}
 
-Profiler.LiveHeapProfileView.GridNode = class extends DataGrid.SortableDataGridNode {
+export class GridNode extends DataGrid.SortableDataGridNode {
   /**
    * @param {string} url
    * @param {number} size
@@ -305,12 +305,12 @@
     }
     return cell;
   }
-};
+}
 
 /**
  * @implements {UI.ActionDelegate}
  */
-Profiler.LiveHeapProfileView.ActionDelegate = class {
+export class ActionDelegate {
   /**
    * @override
    * @param {!UI.Context} context
@@ -322,13 +322,13 @@
       const profileViewId = 'live_heap_profile';
       await UI.viewManager.showView(profileViewId);
       const widget = await UI.viewManager.view(profileViewId).widget();
-      this._innerHandleAction(/** @type {!Profiler.LiveHeapProfileView} */ (widget), actionId);
+      this._innerHandleAction(/** @type {!LiveHeapProfileView} */ (widget), actionId);
     })();
     return true;
   }
 
   /**
-   * @param {!Profiler.LiveHeapProfileView} profilerView
+   * @param {!LiveHeapProfileView} profilerView
    * @param {string} actionId
    */
   _innerHandleAction(profilerView, actionId) {
@@ -343,4 +343,19 @@
         console.assert(false, `Unknown action: ${actionId}`);
     }
   }
-};
+}
+
+/* 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;