Commit 54b9af1
Avoid expensive exception throw in SynchronousMountItem for stopped surfaces (#56969)
Summary:
Pull Request resolved: #56969
When a `SynchronousMountItem` is dispatched for a reactTag whose surface has already been torn down, the `RetryableMountingLayerException ` is thrown in `storeSynchronousMountPropsOverride` and `updatePropsSynchronously`. The exception was immediately caught in the `SynchronousMountItem.execute`, making it a costly no-op. For each throw the stack trace is captured while holding the ART mutator lock in shared mode. On devices with high thread counts and deep Choreographer call stacks, this contributes to ANR during `doFrame`.
This diff switches `storeSynchronousMountPropsOverride` and `updatePropsSynchronously` to use the nullable `getSurfaceManagerForView` variant, which returns null and silently no-ops when the surface is missing — the same end behavior as before, without the exception overhead.
Changelog:
[Internal]
Reviewed By: zeyap
Differential Revision: D106094737
fbshipit-source-id: df19657acbf6f66c2489d31e7c91c4a5c1e4f0fc1 parent abcb782 commit 54b9af1
2 files changed
Lines changed: 6 additions & 8 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting
- mountitems
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
| 268 | + | |
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| |||
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| |||
0 commit comments