Commit 89fa597
Avoid copying surface props when starting or updating a surface (#57813)
Summary:
`SurfaceHandler` already takes a throwaway snapshot of its `Parameters` under `parametersMutex_` before handing them to the `UIManager`, but `UIManager::startSurface` and `UIManager::setSurfaceProps` took `moduleName` and `props` by const reference and then copy-captured them into the lambda posted to the `RuntimeExecutor`. That forced a second deep copy of the props tree — which for a real surface holds the initial route params and deep link data — on every surface start, prop update, and display mode change.
Take both by value and move them into the lambda, and move at the `SurfaceHandler` call sites, so the snapshot is handed off instead of duplicated. The snapshot is a local that is dead after the call, so there is nothing left to observe the moved-from state.
Changelog:
[General][Changed] - `UIManager::startSurface` and `UIManager::setSurfaceProps` now take `moduleName` and `props` by value
Reviewed By: zeyap, christophpurrer
Differential Revision: D1147303101 parent 44e590f commit 89fa597
12 files changed
Lines changed: 40 additions & 37 deletions
File tree
- packages/react-native/ReactCommon/react/renderer
- scheduler
- uimanager
- scripts/cxx-api/api-snapshots
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
| 121 | + | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
| 167 | + | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
238 | | - | |
| 237 | + | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
| |||
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
267 | | - | |
268 | | - | |
| 270 | + | |
| 271 | + | |
269 | 272 | | |
270 | 273 | | |
271 | 274 | | |
272 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
273 | 279 | | |
274 | 280 | | |
275 | 281 | | |
| |||
Lines changed: 4 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 125 | + | |
| 126 | + | |
130 | 127 | | |
131 | 128 | | |
132 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5295 | 5295 | | |
5296 | 5296 | | |
5297 | 5297 | | |
5298 | | - | |
| 5298 | + | |
5299 | 5299 | | |
5300 | 5300 | | |
5301 | | - | |
| 5301 | + | |
5302 | 5302 | | |
5303 | 5303 | | |
5304 | 5304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5106 | 5106 | | |
5107 | 5107 | | |
5108 | 5108 | | |
5109 | | - | |
| 5109 | + | |
5110 | 5110 | | |
5111 | 5111 | | |
5112 | | - | |
| 5112 | + | |
5113 | 5113 | | |
5114 | 5114 | | |
5115 | 5115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5286 | 5286 | | |
5287 | 5287 | | |
5288 | 5288 | | |
5289 | | - | |
| 5289 | + | |
5290 | 5290 | | |
5291 | 5291 | | |
5292 | | - | |
| 5292 | + | |
5293 | 5293 | | |
5294 | 5294 | | |
5295 | 5295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7469 | 7469 | | |
7470 | 7470 | | |
7471 | 7471 | | |
7472 | | - | |
| 7472 | + | |
7473 | 7473 | | |
7474 | 7474 | | |
7475 | | - | |
| 7475 | + | |
7476 | 7476 | | |
7477 | 7477 | | |
7478 | 7478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7308 | 7308 | | |
7309 | 7309 | | |
7310 | 7310 | | |
7311 | | - | |
| 7311 | + | |
7312 | 7312 | | |
7313 | 7313 | | |
7314 | | - | |
| 7314 | + | |
7315 | 7315 | | |
7316 | 7316 | | |
7317 | 7317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7460 | 7460 | | |
7461 | 7461 | | |
7462 | 7462 | | |
7463 | | - | |
| 7463 | + | |
7464 | 7464 | | |
7465 | 7465 | | |
7466 | | - | |
| 7466 | + | |
7467 | 7467 | | |
7468 | 7468 | | |
7469 | 7469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3746 | 3746 | | |
3747 | 3747 | | |
3748 | 3748 | | |
3749 | | - | |
| 3749 | + | |
3750 | 3750 | | |
3751 | 3751 | | |
3752 | | - | |
| 3752 | + | |
3753 | 3753 | | |
3754 | 3754 | | |
3755 | 3755 | | |
| |||
0 commit comments