Commit 1657ab3
Fixed the Event Listener Leak in styles panel
Every time the Styles panel rebuilt a CSS section, `StylePropertyTreeElement` would attach a new `LOCAL_VALUE_UPDATED` listener to the `SDK.CSSProperty`. Because these listeners were never removed, they accumulated. A single style update would eventually trigger thousands of `updateTitle()` calls, causing a CPU spike.
Explicitly saving the bound listener to a private property (`#onPropertyLocalValueUpdated`) in `StylePropertyTreeElement` and
leverage the `TreeElement` framework's native `onunbind()` lifecycle method to properly remove this listener when the element is detached.
Bug: 487901682
Change-Id: I7bb7c3e338109497df072333294d10386324892d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7658087
Auto-Submit: Danil Somsikov <dsv@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Danil Somsikov <dsv@chromium.org>1 parent c842e97 commit 1657ab3
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2066 | 2066 | | |
2067 | 2067 | | |
2068 | 2068 | | |
2069 | | - | |
2070 | | - | |
2071 | | - | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
2072 | 2075 | | |
2073 | 2076 | | |
2074 | 2077 | | |
| |||
0 commit comments