Remove unstable native heap sampling experiment

[email protected]

Fixed: 1138481
Change-Id: I2bbbe53adbd70e52b8a2c5132874f0086d81d216
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2475715
Commit-Queue: Tim van der Lippe <[email protected]>
Reviewed-by: Peter Marshall <[email protected]>
diff --git a/front_end/host/UserMetrics.js b/front_end/host/UserMetrics.js
index 857a696..b36dcea 100644
--- a/front_end/host/UserMetrics.js
+++ b/front_end/host/UserMetrics.js
@@ -600,7 +600,6 @@
   'emptySourceMapAutoStepping': 9,
   'inputEventsOnTimelineOverview': 10,
   'liveHeapProfile': 11,
-  'nativeHeapProfiler': 12,
   'protocolMonitor': 13,
   'developerResourcesView': 15,
   'recordCoverageWithPerformanceTracing': 16,
diff --git a/front_end/main/MainImpl.js b/front_end/main/MainImpl.js
index 477cace..49d9dcd 100644
--- a/front_end/main/MainImpl.js
+++ b/front_end/main/MainImpl.js
@@ -151,7 +151,6 @@
     Root.Runtime.experiments.register('emptySourceMapAutoStepping', 'Empty sourcemap auto-stepping');
     Root.Runtime.experiments.register('inputEventsOnTimelineOverview', 'Input events on Timeline overview', true);
     Root.Runtime.experiments.register('liveHeapProfile', 'Live heap profile', true);
-    Root.Runtime.experiments.register('nativeHeapProfiler', 'Native memory sampling heap profiler', true);
     Root.Runtime.experiments.register('protocolMonitor', 'Protocol Monitor');
     Root.Runtime.experiments.register('developerResourcesView', 'Show developer resources view');
     Root.Runtime.experiments.register(
diff --git a/front_end/profiler/HeapProfileView.js b/front_end/profiler/HeapProfileView.js
index c0b5ba1..23a42b8 100644
--- a/front_end/profiler/HeapProfileView.js
+++ b/front_end/profiler/HeapProfileView.js
@@ -16,7 +16,7 @@
 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';
+import {ProfileView, WritableProfileHeader} from './ProfileView.js';
 
 /**
  * @implements {UI.SearchableView.Searchable}
@@ -31,15 +31,7 @@
 
     this._profileHeader = profileHeader;
     this._profileType = profileHeader.profileType();
-    const views = [ViewTypes.Flame, ViewTypes.Heavy, ViewTypes.Tree];
-
-    const isNativeProfile = this._profileType.id === SamplingNativeHeapProfileType.TypeId ||
-        this._profileType.id === SamplingNativeHeapSnapshotType.TypeId;
-    if (isNativeProfile) {
-      views.push(ViewTypes.Text);
-    }
-
-    this.initialize(new NodeFormatter(this), views);
+    this.initialize(new NodeFormatter(this));
     const profile = new SamplingHeapProfileModel(profileHeader._profile || profileHeader.protocolProfile());
     this.adjustedTotal = profile.total;
     this.setProfile(profile);
@@ -155,80 +147,6 @@
         /** @type {!SamplingHeapProfileModel} */ (this.profile()), this._profileHeader.heapProfilerModel());
   }
 
-  /**
-   * @override
-   * @param {!UI.View.SimpleView} view
-   */
-  populateTextView(view) {
-    const guides = '+!:|';
-    let text = `Sampling memory profile.\n\nDate/Time:       ${new Date()}\n` +
-        'Report Version:  7\n' +
-        `App Version:     ${/Chrom\S*/.exec(navigator.appVersion)[0] || 'Unknown'}\n` +
-        'Node Weight:     1 KiB\n' +
-        `Total Size:      ${Math.round(this.profile().root.total / 1024)} KiB\n` +
-        '----\n\nCall graph:\n';
-    const sortedChildren = this.profile().root.children.sort((a, b) => b.total - a.total);
-    const modules = this.profile().modules.map(
-        m => Object.assign({address: BigInt(m.baseAddress), endAddress: BigInt(m.baseAddress) + BigInt(m.size)}, m));
-    modules.sort((m1, m2) => m1.address > m2.address ? 1 : m1.address < m2.address ? -1 : 0);
-    for (const child of sortedChildren) {
-      printTree('    ', child !== sortedChildren.peekLast(), child);
-    }
-
-    text += '\nBinary Images:\n';
-    for (const module of modules) {
-      const endAddress = /** @type {bigint} */ (module.endAddress);
-      const fileName = /[^/\\]*$/.exec(module.name)[0];
-      const version = '1.0';
-      const formattedUuid = module.uuid.includes('-') ?
-          module.uuid :
-          module.uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12}).*/, '$1-$2-$3-$4-$5');
-      text += `${('0x' + module.address.toString(16)).padStart(18)} - `;
-      text += `${('0x' + (endAddress - BigInt(1)).toString(16)).padStart(18)}`;
-      text += `  ${fileName} (${version}) <${formattedUuid}> ${module.name}\n`;
-    }
-
-    view.contentElement.createChild('pre', 'profile-text-view monospace').textContent = text;
-
-    /**
-     * @param {string} padding
-     * @param {boolean} drawGuide
-     * @param {!SDK.ProfileTreeModel.ProfileNode} node
-     */
-    function printTree(padding, drawGuide, node) {
-      const addressText = /0x[0-9a-f]*|[0-9]*/.exec(node.functionName)[0] || '';
-      let module;
-      if (addressText) {
-        const address = BigInt(addressText);
-        const pos = modules.upperBound(address, (address, module) => address - module.address);
-        if (pos > 0 && address < modules[pos - 1].endAddress) {
-          module = modules[pos - 1];
-        }
-      }
-      const functionName =
-          (addressText ? node.functionName.substr(addressText.length + 1) : node.functionName) || '???';
-      text += `${padding}${Math.round(node.total / 1024)}  ${functionName}  `;
-      if (module) {
-        const address = /** @type {bigint} */ (module.address);
-        const fileName = /[^/\\]*$/.exec(module.name);
-        if (fileName) {
-          text += `(in ${fileName})  `;
-        }
-        const offset = BigInt(addressText) - address;
-        text += `load address ${module.baseAddress} + 0x${offset.toString(16)}  `;
-      }
-      if (addressText) {
-        text += `[${addressText}]`;
-      }
-      text += '\n';
-      const guideChar = drawGuide ? guides[padding.length / 2 % guides.length] : ' ';
-      const nextPadding = padding + guideChar + ' ';
-      const sortedChildren = node.children.sort((a, b) => b.total - a.total);
-      for (const child of sortedChildren) {
-        printTree(nextPadding, child !== sortedChildren.peekLast(), child);
-      }
-    }
-  }
 }
 
 /**
@@ -430,163 +348,6 @@
 /**
  * @unrestricted
  */
-export class SamplingNativeHeapProfileType extends SamplingHeapProfileTypeBase {
-  constructor() {
-    super(SamplingNativeHeapProfileType.TypeId, ls`Native memory allocation sampling`);
-    SamplingNativeHeapProfileType.instance = this;
-  }
-
-  /**
-   * @override
-   */
-  get treeItemTitle() {
-    return ls`NATIVE SAMPLING PROFILES`;
-  }
-
-  /**
-   * @override
-   */
-  get description() {
-    return ls`Allocation profiles show sampled native memory allocations from the renderer process.`;
-  }
-
-  /**
-   * @override
-   */
-  _startSampling() {
-    this.profileBeingRecorded().heapProfilerModel().startNativeSampling();
-  }
-
-  /**
-   * @override
-   * return {!Promise<!Protocol.HeapProfiler.SamplingHeapProfile>}
-   */
-  _stopSampling() {
-    return this.profileBeingRecorded().heapProfilerModel().stopNativeSampling();
-  }
-}
-
-SamplingNativeHeapProfileType.TypeId = 'SamplingNativeHeapRecording';
-
-/**
- * @unrestricted
- */
-export class SamplingNativeHeapSnapshotType extends SamplingHeapProfileTypeBase {
-  /**
-   * @param {string} processType
-   */
-  constructor(processType) {
-    super(SamplingNativeHeapSnapshotType.TypeId, ls`Native memory allocation snapshot (${processType})`);
-  }
-
-  /**
-   * @override
-   * @return {boolean}
-   */
-  isInstantProfile() {
-    return true;
-  }
-
-  /**
-   * @override
-   */
-  get treeItemTitle() {
-    return ls`NATIVE SNAPSHOTS`;
-  }
-
-  /**
-   * @override
-   */
-  get description() {
-    return ls`Native memory snapshots show sampled native allocations in the renderer process since start up.
-              Chrome has to be started with --memlog=all flag. Check flags at chrome://flags`;
-  }
-
-  /**
-   * @override
-   * @return {boolean}
-   */
-  buttonClicked() {
-    this._takeSnapshot();
-    return false;
-  }
-
-  /**
-   * @return {!Promise}
-   */
-  async _takeSnapshot() {
-    if (this.profileBeingRecorded()) {
-      return;
-    }
-    const heapProfilerModel = UI.Context.Context.instance().flavor(SDK.HeapProfilerModel.HeapProfilerModel);
-    if (!heapProfilerModel) {
-      return;
-    }
-
-    const profile = new SamplingHeapProfileHeader(heapProfilerModel, this, ls`Snapshot ${this.nextProfileUid()}`);
-    this.setProfileBeingRecorded(profile);
-    this.addProfile(profile);
-    profile.updateStatus(ls`Snapshotting…`);
-
-    const protocolProfile =
-        await this._takeNativeSnapshot(/** @type {!SDK.HeapProfilerModel.HeapProfilerModel} */ (heapProfilerModel));
-    const recordedProfile = this.profileBeingRecorded();
-    if (recordedProfile) {
-      console.assert(protocolProfile);
-      recordedProfile.setProtocolProfile(/** @type {!Protocol.Profiler.Profile} */ (protocolProfile));
-      recordedProfile.updateStatus('');
-      this.setProfileBeingRecorded(null);
-    }
-
-    this.dispatchEventToListeners(ProfileEvents.ProfileComplete, recordedProfile);
-  }
-
-  /**
-   * @param {!SDK.HeapProfilerModel.HeapProfilerModel} heapProfilerModel
-   * @return {!Promise<?SDK.HeapProfilerModel.CommonHeapProfile>}
-   */
-  _takeNativeSnapshot(heapProfilerModel) {
-    throw 'Not implemented';
-  }
-}
-
-SamplingNativeHeapSnapshotType.TypeId = 'SamplingNativeHeapSnapshot';
-
-export class SamplingNativeHeapSnapshotBrowserType extends SamplingNativeHeapSnapshotType {
-  constructor() {
-    super(ls`Browser`);
-    SamplingNativeHeapSnapshotBrowserType.instance = this;
-  }
-
-  /**
-   * @override
-   * @param {!SDK.HeapProfilerModel.HeapProfilerModel} heapProfilerModel
-   * @return {!Promise<?SDK.HeapProfilerModel.CommonHeapProfile>}
-   */
-  async _takeNativeSnapshot(heapProfilerModel) {
-    return heapProfilerModel.takeNativeBrowserSnapshot();
-  }
-}
-
-export class SamplingNativeHeapSnapshotRendererType extends SamplingNativeHeapSnapshotType {
-  constructor() {
-    super(ls`Renderer`);
-    SamplingNativeHeapSnapshotRendererType.instance = this;
-  }
-
-  /**
-   * @override
-   * @param {!SDK.HeapProfilerModel.HeapProfilerModel} heapProfilerModel
-   * @return {!Promise<?SDK.HeapProfilerModel.CommonHeapProfile>}
-   */
-  async _takeNativeSnapshot(heapProfilerModel) {
-    return heapProfilerModel.takeNativeSnapshot();
-  }
-}
-
-/**
- * @unrestricted
- */
 export class SamplingHeapProfileHeader extends WritableProfileHeader {
   /**
    * @param {?SDK.HeapProfilerModel.HeapProfilerModel} heapProfilerModel
diff --git a/front_end/profiler/HeapProfilerPanel.js b/front_end/profiler/HeapProfilerPanel.js
index 2ce150d..1ee8d8f 100644
--- a/front_end/profiler/HeapProfilerPanel.js
+++ b/front_end/profiler/HeapProfilerPanel.js
@@ -22,11 +22,6 @@
     const registry = instance;
     const profileTypes =
         [registry.heapSnapshotProfileType, registry.trackingHeapSnapshotProfileType, registry.samplingHeapProfileType];
-    if (Root.Runtime.experiments.isEnabled('nativeHeapProfiler')) {
-      profileTypes.push(registry.samplingNativeHeapProfileType);
-      profileTypes.push(registry.samplingNativeHeapSnapshotRendererType);
-      profileTypes.push(registry.samplingNativeHeapSnapshotBrowserType);
-    }
     super('heap_profiler', profileTypes, 'profiler.heap-toggle-recording');
   }
 
diff --git a/front_end/profiler/ProfileTypeRegistry.js b/front_end/profiler/ProfileTypeRegistry.js
index 256edc9..79029ca 100644
--- a/front_end/profiler/ProfileTypeRegistry.js
+++ b/front_end/profiler/ProfileTypeRegistry.js
@@ -6,7 +6,7 @@
 // TODO(crbug.com/1011811): Enable TypeScript compiler checks
 
 import {CPUProfileType} from './CPUProfileView.js';
-import {SamplingHeapProfileType, SamplingNativeHeapProfileType, SamplingNativeHeapSnapshotBrowserType, SamplingNativeHeapSnapshotRendererType,} from './HeapProfileView.js';
+import {SamplingHeapProfileType} from './HeapProfileView.js';
 import {HeapSnapshotProfileType, TrackingHeapSnapshotProfileType} from './HeapSnapshotView.js';
 
 /**
@@ -17,9 +17,6 @@
     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();
   }
 }
diff --git a/front_end/profiler/ProfileView.js b/front_end/profiler/ProfileView.js
index 9f1b79b..7effd0d 100644
--- a/front_end/profiler/ProfileView.js
+++ b/front_end/profiler/ProfileView.js
@@ -108,20 +108,18 @@
 
   /**
    * @param {!Formatter} nodeFormatter
-   * @param {!Array<string>=} viewTypes
    * @protected
    */
-  initialize(nodeFormatter, viewTypes) {
+  initialize(nodeFormatter) {
     this._nodeFormatter = nodeFormatter;
 
     this._viewType = Common.Settings.Settings.instance().createSetting('profileView', ViewTypes.Heavy);
-    viewTypes = viewTypes || [ViewTypes.Flame, ViewTypes.Heavy, ViewTypes.Tree];
+    const viewTypes = [ViewTypes.Flame, ViewTypes.Heavy, ViewTypes.Tree];
 
     const optionNames = new Map([
       [ViewTypes.Flame, ls`Chart`],
       [ViewTypes.Heavy, ls`Heavy (Bottom Up)`],
       [ViewTypes.Tree, ls`Tree (Top Down)`],
-      [ViewTypes.Text, ls`Text (Top Down)`],
     ]);
 
     const options =
@@ -303,21 +301,6 @@
     return this._linkifier;
   }
 
-  _ensureTextViewCreated() {
-    if (this._textView) {
-      return;
-    }
-    this._textView = new UI.View.SimpleView(ls`Call tree`);
-    this._textView.registerRequiredCSS('profiler/profilesPanel.css');
-    this.populateTextView(this._textView);
-  }
-
-  /**
-   * @param {!UI.View.SimpleView} view
-   */
-  populateTextView(view) {
-  }
-
   /**
    * @return {!ProfileFlameChartDataProvider}
    */
@@ -387,11 +370,6 @@
         this._visibleView = this.dataGrid.asWidget();
         this._searchableElement = this.profileDataGridTree;
         break;
-      case ViewTypes.Text:
-        this._ensureTextViewCreated();
-        this._visibleView = this._textView;
-        this._searchableElement = this._textView;
-        break;
     }
 
     const isFlame = this._viewType.get() === ViewTypes.Flame;
@@ -476,7 +454,6 @@
   Flame: 'Flame',
   Tree: 'Tree',
   Heavy: 'Heavy',
-  Text: 'Text'
 };
 
 /**
diff --git a/front_end/profiler/profiler_strings.grdp b/front_end/profiler/profiler_strings.grdp
index 6a60ca4..f9f4273 100644
--- a/front_end/profiler/profiler_strings.grdp
+++ b/front_end/profiler/profiler_strings.grdp
@@ -24,15 +24,9 @@
   <message name="IDS_DEVTOOLS_072601db05446105324a952ed068aa6c" desc="A context menu item in the Heap Profiler Panel of a profiler tool">
     Reveal object &apos;<ph name="MATCH_GROUPS_OBJECTNAME">$1s<ex>SomeClassConstructor</ex></ph>&apos; with id @<ph name="MATCH_GROUPS_SNAPSHOTNODEID">$2s<ex>12345</ex></ph> in Summary view
   </message>
-  <message name="IDS_DEVTOOLS_07b20ae970048fc2002d756f27acc863" desc="Text in Heap Profile View of a profiler tool">
-    Renderer
-  </message>
   <message name="IDS_DEVTOOLS_07d2bff541ce0f9ec4389e93a97997ee" desc="Title in Heap Snapshot View of a profiler tool">
     Objects allocated between <ph name="LIST_I______TITLE">$1s<ex>Profile 1</ex></ph> and <ph name="LIST_I__TITLE">$2s<ex>Profile 2</ex></ph>
   </message>
-  <message name="IDS_DEVTOOLS_0a63e0039bb8cb9846ad74ace8e1e5de" desc="Text in Profile View of a profiler tool">
-    Call tree
-  </message>
   <message name="IDS_DEVTOOLS_0aa6f4210bf373c95eda00232e93cd98" desc="Text in Heap Snapshot Data Grids of a profiler tool">
     Distance
   </message>
@@ -69,9 +63,6 @@
   <message name="IDS_DEVTOOLS_27c0ad7a8ff8f9df8e13bb2d974c95d0" desc="Text in Heap Snapshot View of a profiler tool">
     Allocation
   </message>
-  <message name="IDS_DEVTOOLS_2d7b69664bc4226fb198124fb707e57c" desc="Text in Heap Profile View of a profiler tool">
-    Snapshot <ph name="THIS_NEXTPROFILEUID__">$1s<ex>1</ex></ph>
-  </message>
   <message name="IDS_DEVTOOLS_2db1f9be46028cfdf9b8f96a0110e637" desc="Text in CPUProfile View of a profiler tool">
     <ph name="VALUE">$1.2f<ex>21.33</ex></ph> %%
   </message>
@@ -99,9 +90,6 @@
   <message name="IDS_DEVTOOLS_3a9619400e054970a7ab8b67c4ce5109" desc="Tooltip text that appears when hovering over the largeicon refresh button in the Profile View of a profiler tool">
     Restore all functions
   </message>
-  <message name="IDS_DEVTOOLS_3ae3895607d1203d8e73e18dd4c4551c" desc="Text in Heap Profile View of a profiler tool">
-    Allocation profiles show sampled native memory allocations from the renderer process.
-  </message>
   <message name="IDS_DEVTOOLS_3b6077563702806850baeddff55ee1c6" desc="Text in Heap Snapshot Grid Nodes of a profiler tool">
     Preview is not available
   </message>
@@ -120,9 +108,6 @@
   <message name="IDS_DEVTOOLS_42db600672cae99246e499a23827146b" desc="Text in Heap Snapshot View of a profiler tool">
     Heap snapshot profiles show memory distribution among your page&apos;s JavaScript objects and related DOM nodes.
   </message>
-  <message name="IDS_DEVTOOLS_4307cf6e92b003765b9f493109f8fa51" desc="Text in Heap Profile View of a profiler tool">
-    Native memory allocation sampling
-  </message>
   <message name="IDS_DEVTOOLS_43190a68dbd847e2f98a7ddd04b2eec5" desc="Text in Heap Snapshot Data Grids of a profiler tool">
     Live Size
   </message>
@@ -147,12 +132,6 @@
   <message name="IDS_DEVTOOLS_4d4d76db5d9ef72b504f83d89af5b6dd" desc="Text in Heap Profile View of a profiler tool">
     Selected size: <ph name="NUMBER_BYTESTOSTRING_EVENT_DATA_SIZE_">$1s<ex>3 MB</ex></ph>
   </message>
-  <message name="IDS_DEVTOOLS_4d8aa0a7e336e08bad365b81a197f184" desc="Text in Heap Profile View of a profiler tool">
-    NATIVE SAMPLING PROFILES
-  </message>
-  <message name="IDS_DEVTOOLS_4daace4b0bc45c13739427cfc06cf7b7" desc="Text in Profile View of a profiler tool">
-    Text (Top Down)
-  </message>
   <message name="IDS_DEVTOOLS_5209fac92c957988ce1453bb139790ce" desc="Text in Profile View of a profiler tool">
     Failed to read file
   </message>
@@ -171,25 +150,15 @@
   <message name="IDS_DEVTOOLS_5e0ebd581894697a7ae357bea6b7e590" desc="Text in CPUProfile View of a profiler tool">
     Start CPU profiling
   </message>
-  <message name="IDS_DEVTOOLS_60dcffb26f0ed1b0c73f8cea5d5d9772" desc="Text in Heap Profile View of a profiler tool">
-    Native memory allocation snapshot (<ph name="PROCESSTYPE">$1s<ex>Renderer</ex></ph>)
-  </message>
   <message name="IDS_DEVTOOLS_610de28d957d1148614ecc6b2ec48443" desc="Text in Live Heap Profile View of a profiler tool">
     URL of the script source
   </message>
-  <message name="IDS_DEVTOOLS_61b4b76027d49142c386737a0e94cedb" desc="Text in Heap Profile View of a profiler tool">
-    NATIVE SNAPSHOTS
-  </message>
   <message name="IDS_DEVTOOLS_678d0a4421b60dc59999ac02837496a6" desc="Text in Heap Snapshot Data Grids of a profiler tool">
     Constructor
   </message>
   <message name="IDS_DEVTOOLS_6a5084781ea4e6bf97a2dcd0cda17a1a" desc="Title of an action under the Performance category that can be invoked through the Command Menu">
     Start recording heap allocations
   </message>
-  <message name="IDS_DEVTOOLS_6b59ba1fcfd868474cae169876f9cbfa" desc="Text in Heap Profile View of a profiler tool">
-    Native memory snapshots show sampled native allocations in the renderer process since start up.
-              <ph name="LOCKED_1">Chrome</ph> has to be started with <ph name="LOCKED_2">--memlog=all</ph> flag. Check flags at <ph name="LOCKED_1">chrome://flags</ph>
-  </message>
   <message name="IDS_DEVTOOLS_6d27e30b2f09c2a451a6d123c1a35805" desc="Text in Profiles Panel of a profiler tool">
     Run <ph name="_">$1d<ex>2</ex></ph>
   </message>
@@ -427,9 +396,6 @@
   <message name="IDS_DEVTOOLS_eec806d119a5eddd61e2ccd21bfd9b20" desc="Text in CPUProfile View of a profiler tool">
     Aggregated total time
   </message>
-  <message name="IDS_DEVTOOLS_ef15fd2f45e6bb5ce57587895ba64f93" desc="Text in Heap Profile View of a profiler tool">
-    Browser
-  </message>
   <message name="IDS_DEVTOOLS_f3e40bc520cf1f22e4d36d5c5f8d2618" desc="Text in Heap Snapshot Grid Nodes of a profiler tool">
     User object reachable from window
   </message>
diff --git a/front_end/sdk/HeapProfilerModel.js b/front_end/sdk/HeapProfilerModel.js
index 27c53a6..1b7fcc4 100644
--- a/front_end/sdk/HeapProfilerModel.js
+++ b/front_end/sdk/HeapProfilerModel.js
@@ -88,96 +88,6 @@
   }
 
   /**
-   * @returns {!Promise<boolean>}
-   */
-  async startNativeSampling() {
-    const samplingInterval = 65536;
-    const response = await this._memoryAgent.invoke_startSampling({samplingInterval});
-    return !!response.getError();
-  }
-
-  /**
-   * @return {!Promise<?NativeHeapProfile>}
-   */
-  async stopNativeSampling() {
-    const response = await this._memoryAgent.invoke_getSamplingProfile();
-    // Try to stop sampling independent of an error in `getSamplingProfile`.
-    await this._memoryAgent.invoke_stopSampling();
-    if (response.getError()) {
-      return null;
-    }
-    return this._convertNativeProfile(response.profile);
-  }
-
-  /**
-   * @return {!Promise<?NativeHeapProfile>}
-   */
-  async takeNativeSnapshot() {
-    const response = await this._memoryAgent.invoke_getAllTimeSamplingProfile();
-    if (response.getError()) {
-      return null;
-    }
-    return this._convertNativeProfile(response.profile);
-  }
-
-  /**
-   * @return {!Promise<?NativeHeapProfile>}
-   */
-  async takeNativeBrowserSnapshot() {
-    const response = await this._memoryAgent.invoke_getBrowserSamplingProfile();
-    if (response.getError()) {
-      return null;
-    }
-    return this._convertNativeProfile(response.profile);
-  }
-
-  /**
-   * @param {!Protocol.Memory.SamplingProfile} rawProfile
-   * @return {!NativeHeapProfile}
-   */
-  _convertNativeProfile(rawProfile) {
-    /** @type {!NodeForConstruction}} */
-    const head = (({
-      childMap: new Map(),
-      selfSize: 0,
-      callFrame: {functionName: '(root)', url: '', scriptId: '', lineNumber: -1, columnNumber: -1}
-    }));
-    for (const sample of rawProfile.samples) {
-      const node = sample.stack.reverse().reduce((node, name) => {
-        let child = node.childMap.get(name);
-        if (child) {
-          return child;
-        }
-        const namespace = /^([^:]*)::/.exec(name);
-
-        // The native profile doesn't have scriptId and line/column numbers, so we need to pass undefined to
-        // not have them displayed.
-        const callFrame = /** @type {!NativeProfilerCallFrame} */ ({
-          functionName: name,
-          url: namespace && namespace[1] || '',
-          scriptId: undefined,
-          lineNumber: undefined,
-          columnNumber: undefined,
-        });
-        child = {childMap: new Map(), callFrame, selfSize: 0};
-        node.childMap.set(name, child);
-        return child;
-      }, head);
-      node.selfSize += sample.total;
-    }
-
-    /**
-     * @param {!NodeForConstruction} node
-     * @return {!CommonHeapProfileNode}
-     */
-    function convertChildren(node) {
-      const children = Array.from(node.childMap.values()).map(convertChildren);
-      return {selfSize: node.selfSize, callFrame: node.callFrame, children, id: -1};
-    }
-    return new NativeHeapProfile(convertChildren(head), rawProfile.modules);
-  }
-
-  /**
    * @return {!Promise<boolean>}
    */
   async collectGarbage() {
@@ -306,21 +216,6 @@
 export let CommonHeapProfile;  // eslint-disable-line no-unused-vars
 
 /**
- * TODO(chromium:1011811): Change this to implements once we are TypeScript-only.
- * @extends {CommonHeapProfile}
- */
-class NativeHeapProfile {
-  /**
-   * @param {!CommonHeapProfileNode} head
-   * @param {!Array<!Protocol.Memory.Module>} modules
-   */
-  constructor(head, modules) {
-    this.head = head;
-    this.modules = modules;
-  }
-}
-
-/**
  * @implements {ProtocolProxyApi.HeapProfilerDispatcher}
  */
 class HeapProfilerDispatcher {