mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-30 01:07:01 +08:00
export captureNumericValue in HeapSnapshotView
Numeric values have been added to V8 Heap Snapshots in https://chromium-review.googlesource.com/c/v8/v8/+/2806747 This patch exposes the option in HeapSnapshotView via a checkbox. The setting is false by default. If treatGlobalObjectsAsRoots is also exposed, then we wrap both checkbox inside a paragraph. Bug: chromium:1203047 Change-Id: Icc5a58f0dbe7324f85d8ad6fb9f3158c574ad36e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2852453 Commit-Queue: Arnaud Renevier <arenevier@fb.com> Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
85f7a8d541
commit
3b10a97f91
@@ -49,6 +49,7 @@ Yisi <yiorsi@gmail.com>
|
||||
|
||||
# BEGIN organizations section.
|
||||
Cloudflare, Inc. <*@cloudflare.com>
|
||||
Facebook, Inc. <*@fb.com>
|
||||
Google Inc. <*@google.com>
|
||||
Igalia, S.L. <*@igalia.com>
|
||||
Intel Corporation <*@intel.com>
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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̂"
|
||||
},
|
||||
|
||||
@@ -102,8 +102,10 @@ export class HeapProfilerModel extends SDKModel {
|
||||
return Boolean(response.getError());
|
||||
}
|
||||
|
||||
async takeHeapSnapshot(reportProgress: boolean, treatGlobalObjectsAsRoots: boolean): Promise<void> {
|
||||
await this._heapProfilerAgent.invoke_takeHeapSnapshot({reportProgress, treatGlobalObjectsAsRoots});
|
||||
async takeHeapSnapshot(reportProgress: boolean, treatGlobalObjectsAsRoots: boolean, captureNumericValue: boolean):
|
||||
Promise<void> {
|
||||
await this._heapProfilerAgent.invoke_takeHeapSnapshot(
|
||||
{reportProgress, treatGlobalObjectsAsRoots, captureNumericValue});
|
||||
}
|
||||
|
||||
async startTrackingHeapObjects(recordAllocationStacks: boolean): Promise<boolean> {
|
||||
|
||||
@@ -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<SDK.HeapProfilerModel.HeapProfilerModel> {
|
||||
_treatGlobalObjectsAsRoots: Common.Settings.Setting<boolean>;
|
||||
_customContent: UI.UIUtils.CheckboxLabel|null;
|
||||
_captureNumericValue: Common.Settings.Setting<boolean>;
|
||||
_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;
|
||||
|
||||
Reference in New Issue
Block a user