diff --git a/AUTHORS b/AUTHORS index 274333bba4..5d1ecc21ec 100644 --- a/AUTHORS +++ b/AUTHORS @@ -49,6 +49,7 @@ Yisi # BEGIN organizations section. Cloudflare, Inc. <*@cloudflare.com> +Facebook, Inc. <*@fb.com> Google Inc. <*@google.com> Igalia, S.L. <*@igalia.com> Intel Corporation <*@intel.com> diff --git a/front_end/core/i18n/locales/en-US.json b/front_end/core/i18n/locales/en-US.json index 48ff075632..23420b6293 100644 --- a/front_end/core/i18n/locales/en-US.json +++ b/front_end/core/i18n/locales/en-US.json @@ -7325,6 +7325,9 @@ "panels/profiler/HeapSnapshotView.ts | baseSnapshot": { "message": "Base snapshot" }, + "panels/profiler/HeapSnapshotView.ts | captureNumericValue": { + "message": "Include numerical values in capture" + }, "panels/profiler/HeapSnapshotView.ts | classFilter": { "message": "Class filter" }, diff --git a/front_end/core/i18n/locales/en-XL.json b/front_end/core/i18n/locales/en-XL.json index 3166c7d5aa..a5013749f2 100644 --- a/front_end/core/i18n/locales/en-XL.json +++ b/front_end/core/i18n/locales/en-XL.json @@ -7325,6 +7325,9 @@ "panels/profiler/HeapSnapshotView.ts | baseSnapshot": { "message": "B̂áŝé ŝńâṕŝh́ôt́" }, + "panels/profiler/HeapSnapshotView.ts | captureNumericValue": { + "message": "Îńĉĺûd́ê ńûḿêŕîćâĺ v̂ál̂úêś îń ĉáp̂t́ûŕê" + }, "panels/profiler/HeapSnapshotView.ts | classFilter": { "message": "Ĉĺâśŝ f́îĺt̂ér̂" }, diff --git a/front_end/core/sdk/HeapProfilerModel.ts b/front_end/core/sdk/HeapProfilerModel.ts index 60c7d7bca9..c526fa6387 100644 --- a/front_end/core/sdk/HeapProfilerModel.ts +++ b/front_end/core/sdk/HeapProfilerModel.ts @@ -102,8 +102,10 @@ export class HeapProfilerModel extends SDKModel { return Boolean(response.getError()); } - async takeHeapSnapshot(reportProgress: boolean, treatGlobalObjectsAsRoots: boolean): Promise { - await this._heapProfilerAgent.invoke_takeHeapSnapshot({reportProgress, treatGlobalObjectsAsRoots}); + async takeHeapSnapshot(reportProgress: boolean, treatGlobalObjectsAsRoots: boolean, captureNumericValue: boolean): + Promise { + await this._heapProfilerAgent.invoke_takeHeapSnapshot( + {reportProgress, treatGlobalObjectsAsRoots, captureNumericValue}); } async startTrackingHeapObjects(recordAllocationStacks: boolean): Promise { diff --git a/front_end/panels/profiler/HeapSnapshotView.ts b/front_end/panels/profiler/HeapSnapshotView.ts index 23c56e939c..6a081f794d 100644 --- a/front_end/panels/profiler/HeapSnapshotView.ts +++ b/front_end/panels/profiler/HeapSnapshotView.ts @@ -174,6 +174,10 @@ const UIStrings = { treatGlobalObjectsAsRoots: 'Treat global objects as roots (recommended, unchecking this exposes internal nodes and introduces excessive detail, but might help debugging cycles in retaining paths)', /** + *@description Text in Heap Snapshot View of a profiler tool + */ + captureNumericValue: 'Include numerical values in capture', + /** *@description Progress update that the profiler is capturing a snapshot of the heap */ snapshotting: 'Snapshotting…', @@ -1161,7 +1165,8 @@ export class StatisticsPerspective extends Perspective { export class HeapSnapshotProfileType extends ProfileType implements SDK.SDKModel.SDKModelObserver { _treatGlobalObjectsAsRoots: Common.Settings.Setting; - _customContent: UI.UIUtils.CheckboxLabel|null; + _captureNumericValue: Common.Settings.Setting; + _customContent: HTMLElement|null; constructor(id?: string, title?: string) { super(id || HeapSnapshotProfileType.TypeId, title || i18nString(UIStrings.heapSnapshot)); SDK.SDKModel.TargetManager.instance().observeModels(SDK.HeapProfilerModel.HeapProfilerModel, this); @@ -1175,6 +1180,7 @@ export class HeapSnapshotProfileType extends ProfileType implements this._reportHeapSnapshotProgress, this); this._treatGlobalObjectsAsRoots = Common.Settings.Settings.instance().createSetting('treatGlobalObjectsAsRoots', true); + this._captureNumericValue = Common.Settings.Settings.instance().createSetting('captureNumericValue', false); this._customContent = null; } @@ -1216,17 +1222,27 @@ export class HeapSnapshotProfileType extends ProfileType implements } customContent(): Element|null { - const checkboxSetting = UI.SettingsUI.createSettingCheckbox( - i18nString(UIStrings.treatGlobalObjectsAsRoots), this._treatGlobalObjectsAsRoots, true); - this._customContent = (checkboxSetting as UI.UIUtils.CheckboxLabel); + const optionsContainer = document.createElement('div'); const showOptionToNotTreatGlobalObjectsAsRoots = Root.Runtime.experiments.isEnabled('showOptionToNotTreatGlobalObjectsAsRoots'); - return showOptionToNotTreatGlobalObjectsAsRoots ? checkboxSetting : null; + const omitParagraphElement = !showOptionToNotTreatGlobalObjectsAsRoots; + if (showOptionToNotTreatGlobalObjectsAsRoots) { + const treatGlobalObjectsAsRootsCheckbox = UI.SettingsUI.createSettingCheckbox( + i18nString(UIStrings.treatGlobalObjectsAsRoots), this._treatGlobalObjectsAsRoots, omitParagraphElement); + optionsContainer.appendChild(treatGlobalObjectsAsRootsCheckbox); + } + const captureNumericValueCheckbox = UI.SettingsUI.createSettingCheckbox( + UIStrings.captureNumericValue, this._captureNumericValue, omitParagraphElement); + optionsContainer.appendChild(captureNumericValueCheckbox); + this._customContent = optionsContainer; + return optionsContainer; } setCustomContentEnabled(enable: boolean): void { if (this._customContent) { - this._customContent.checkboxElement.disabled = !enable; + this._customContent.querySelectorAll('[is=dt-checkbox]').forEach(label => { + (label as UI.UIUtils.CheckboxLabel).checkboxElement.disabled = !enable; + }); } } @@ -1248,7 +1264,8 @@ export class HeapSnapshotProfileType extends ProfileType implements this.addProfile(profile); profile.updateStatus(i18nString(UIStrings.snapshotting)); - await heapProfilerModel.takeHeapSnapshot(true, this._treatGlobalObjectsAsRoots.get()); + await heapProfilerModel.takeHeapSnapshot( + true, this._treatGlobalObjectsAsRoots.get(), this._captureNumericValue.get()); profile = this.profileBeingRecorded() as HeapProfileHeader; if (!profile) { return;