Skip to content

Commit 81a0851

Browse files
ergunshDevtools-frontend LUCI CQ
authored andcommitted
[Animations] Release all the animations before taking a heap snapshot
The animations are stored for replay in the animations panel and they might cause detached nodes to appear in snapshots. Because of this, we release all the animations first before taking a heap snapshot. Fixed: 395798202 Change-Id: Ie75a5c4eadc9f9dd0553c6ad07ad76b0faff8a4f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6286492 Auto-Submit: Ergün Erdoğmuş <[email protected]> Commit-Queue: Alex Rudenko <[email protected]> Reviewed-by: Alex Rudenko <[email protected]>
1 parent 006f4f5 commit 81a0851

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

front_end/core/sdk/AnimationModel.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,12 @@ export class AnimationModel extends SDKModel<EventTypes> {
458458
void this.agent.invoke_setPlaybackRate({playbackRate});
459459
}
460460

461+
async releaseAllAnimations(): Promise<void> {
462+
const animationIds = [...this.animationGroups.values()].flatMap(
463+
animationGroup => animationGroup.animations().map(animation => animation.id()));
464+
await this.agent.invoke_releaseAnimations({animations: animationIds});
465+
}
466+
461467
releaseAnimations(animations: string[]): void {
462468
void this.agent.invoke_releaseAnimations({animations});
463469
}

front_end/panels/profiler/HeapSnapshotView.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,15 @@ export class HeapSnapshotProfileType extends
13641364
this.addProfile(profile);
13651365
profile.updateStatus(i18nString(UIStrings.snapshotting));
13661366

1367+
// Release all the animations before taking a heap snapshot.
1368+
// The animations are stored for replay in the animations panel and they might cause
1369+
// detached nodes to appear in snapshots. Because of this, we release
1370+
// all the animations first before taking a heap snapshot.
1371+
const animationModel = heapProfilerModel.target().model(SDK.AnimationModel.AnimationModel);
1372+
if (animationModel) {
1373+
await animationModel.releaseAllAnimations();
1374+
}
1375+
13671376
await heapProfilerModel.takeHeapSnapshot({
13681377
reportProgress: true,
13691378
captureNumericValue: true,

0 commit comments

Comments
 (0)