mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-22 22:14:39 +08:00
[heap-profiler] Offer additional reveal options
This CL enables the context menu of the heap profiler's summary view for snapshots to display additional reveal options, if the back-end indicated them in a suitable form. This is the most light-weight way to simplify debugging of retainment chains that involve WeakMaps. Bug: chromium:1020096 Change-Id: Ie79977e5e3899b3eee71e618104e48d640707c78 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1893075 Commit-Queue: Sigurd Schneider <sigurds@chromium.org> Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
cc75dee3ba
commit
8cfb8ccc1a
@@ -146,6 +146,15 @@ Profiler.HeapSnapshotSortableDataGrid = class extends DataGrid.DataGrid {
|
||||
contextMenu.revealSection().appendItem(ls`Reveal in Summary view`, () => {
|
||||
this._dataDisplayDelegate.showObject(node.snapshotNodeId, ls`Summary`);
|
||||
});
|
||||
if (node._referenceName) {
|
||||
for (const match of node._referenceName.matchAll(/\((?<objectName>[^@)]*) @(?<snapshotNodeId>\d+)\)/g)) {
|
||||
const {objectName, snapshotNodeId} = /** @type {!{objectName:string, snapshotNodeId:string}} */ (match.groups);
|
||||
contextMenu.revealSection().appendItem(
|
||||
ls`Reveal object '${objectName}' with id @${snapshotNodeId} in Summary view`, () => {
|
||||
this._dataDisplayDelegate.showObject(snapshotNodeId, ls`Summary`);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (gridNode.linkElement && !contextMenu.containsTarget(gridNode.linkElement)) {
|
||||
contextMenu.appendApplicableItems(gridNode.linkElement);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
<message name="IDS_DEVTOOLS_05ce989cc1015cd221844376fc4cf206" desc="Profile title in Heap Snapshot View of a profiler tool">
|
||||
Snapshot <ph name="PROFILE_UID">$1d<ex>1</ex></ph>
|
||||
</message>
|
||||
<message name="IDS_DEVTOOLS_072601db05446105324a952ed068aa6c" desc="A context menu item in the Heap Profiler Panel of a profiler tool">
|
||||
Reveal object '<ph name="MATCH_GROUPS_OBJECTNAME">$1s<ex>SomeClassConstructor</ex></ph>' 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>
|
||||
@@ -430,4 +433,4 @@
|
||||
<message name="IDS_DEVTOOLS_ffd4ebcdf9ad139d4cd2c84d853f4f34" desc="Text in Heap Profile View of a profiler tool">
|
||||
Total Size (bytes)
|
||||
</message>
|
||||
</grit-part>
|
||||
</grit-part>
|
||||
|
||||
Reference in New Issue
Block a user