@@ -37,28 +37,6 @@ export type LaneMap<T> = Array<T>; |
37 | 37 |
|
38 | 38 | import {enableCache, enableSchedulingProfiler} from 'shared/ReactFeatureFlags'; |
39 | 39 |
|
40 | | -export const SyncLanePriority: LanePriority = 12; |
41 | | - |
42 | | -const InputContinuousHydrationLanePriority: LanePriority = 11; |
43 | | -export const InputContinuousLanePriority: LanePriority = 10; |
44 | | - |
45 | | -const DefaultHydrationLanePriority: LanePriority = 9; |
46 | | -export const DefaultLanePriority: LanePriority = 8; |
47 | | - |
48 | | -const TransitionHydrationPriority: LanePriority = 7; |
49 | | -export const TransitionPriority: LanePriority = 6; |
50 | | - |
51 | | -const RetryLanePriority: LanePriority = 5; |
52 | | - |
53 | | -const SelectiveHydrationLanePriority: LanePriority = 4; |
54 | | - |
55 | | -const IdleHydrationLanePriority: LanePriority = 3; |
56 | | -export const IdleLanePriority: LanePriority = 2; |
57 | | - |
58 | | -const OffscreenLanePriority: LanePriority = 1; |
59 | | - |
60 | | -export const NoLanePriority: LanePriority = 0; |
61 | | - |
62 | 40 | // Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler. |
63 | 41 | // If those values are changed that package should be rebuilt and redeployed. |
64 | 42 |
|
@@ -162,29 +140,19 @@ export const NoTimestamp = -1; |
162 | 140 | let nextTransitionLane: Lane = TransitionLane1; |
163 | 141 | let nextRetryLane: Lane = RetryLane1; |
164 | 142 |
|
165 | | -// "Registers" used to "return" multiple values |
166 | | -// Used by getHighestPriorityLanes and getNextLanes: |
167 | | -let return_highestLanePriority: LanePriority = DefaultLanePriority; |
168 | | - |
169 | 143 | function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { |
170 | 144 | switch (getHighestPriorityLane(lanes)) { |
171 | 145 | case SyncLane: |
172 | | - return_highestLanePriority = SyncLanePriority; |
173 | 146 | return SyncLane; |
174 | 147 | case InputContinuousHydrationLane: |
175 | | - return_highestLanePriority = InputContinuousHydrationLanePriority; |
176 | 148 | return InputContinuousHydrationLane; |
177 | 149 | case InputContinuousLane: |
178 | | - return_highestLanePriority = InputContinuousLanePriority; |
179 | 150 | return InputContinuousLane; |
180 | 151 | case DefaultHydrationLane: |
181 | | - return_highestLanePriority = DefaultHydrationLanePriority; |
182 | 152 | return DefaultHydrationLane; |
183 | 153 | case DefaultLane: |
184 | | - return_highestLanePriority = DefaultLanePriority; |
185 | 154 | return DefaultLane; |
186 | 155 | case TransitionHydrationLane: |
187 | | - return_highestLanePriority = TransitionHydrationPriority; |
188 | 156 | return TransitionHydrationLane; |
189 | 157 | case TransitionLane1: |
190 | 158 | case TransitionLane2: |
@@ -202,26 +170,20 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { |
202 | 170 | case TransitionLane14: |
203 | 171 | case TransitionLane15: |
204 | 172 | case TransitionLane16: |
205 | | - return_highestLanePriority = TransitionPriority; |
206 | 173 | return lanes & TransitionLanes; |
207 | 174 | case RetryLane1: |
208 | 175 | case RetryLane2: |
209 | 176 | case RetryLane3: |
210 | 177 | case RetryLane4: |
211 | 178 | case RetryLane5: |
212 | | - return_highestLanePriority = RetryLanePriority; |
213 | 179 | return lanes & RetryLanes; |
214 | 180 | case SelectiveHydrationLane: |
215 | | - return_highestLanePriority = SelectiveHydrationLanePriority; |
216 | 181 | return SelectiveHydrationLane; |
217 | 182 | case IdleHydrationLane: |
218 | | - return_highestLanePriority = IdleHydrationLanePriority; |
219 | 183 | return IdleHydrationLane; |
220 | 184 | case IdleLane: |
221 | | - return_highestLanePriority = IdleLanePriority; |
222 | 185 | return IdleLane; |
223 | 186 | case OffscreenLane: |
224 | | - return_highestLanePriority = OffscreenLanePriority; |
225 | 187 | return OffscreenLane; |
226 | 188 | default: |
227 | 189 | if (__DEV__) { |
@@ -230,7 +192,6 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { |
230 | 192 | ); |
231 | 193 | } |
232 | 194 | // This shouldn't be reachable, but as a fallback, return the entire bitmask. |
233 | | - return_highestLanePriority = DefaultLanePriority; |
234 | 195 | return lanes; |
235 | 196 | } |
236 | 197 | } |
@@ -239,12 +200,10 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes { |
239 | 200 | // Early bailout if there's no pending work left. |
240 | 201 | const pendingLanes = root.pendingLanes; |
241 | 202 | if (pendingLanes === NoLanes) { |
242 | | - return_highestLanePriority = NoLanePriority; |
243 | 203 | return NoLanes; |
244 | 204 | } |
245 | 205 |
|
246 | 206 | let nextLanes = NoLanes; |
247 | | - let nextLanePriority = NoLanePriority; |
248 | 207 |
|
249 | 208 | const suspendedLanes = root.suspendedLanes; |
250 | 209 | const pingedLanes = root.pingedLanes; |
@@ -256,24 +215,20 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes { |
256 | 215 | const nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; |
257 | 216 | if (nonIdleUnblockedLanes !== NoLanes) { |
258 | 217 | nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); |
259 | | - nextLanePriority = return_highestLanePriority; |
260 | 218 | } else { |
261 | 219 | const nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; |
262 | 220 | if (nonIdlePingedLanes !== NoLanes) { |
263 | 221 | nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); |
264 | | - nextLanePriority = return_highestLanePriority; |
265 | 222 | } |
266 | 223 | } |
267 | 224 | } else { |
268 | 225 | // The only remaining work is Idle. |
269 | 226 | const unblockedLanes = pendingLanes & ~suspendedLanes; |
270 | 227 | if (unblockedLanes !== NoLanes) { |
271 | 228 | nextLanes = getHighestPriorityLanes(unblockedLanes); |
272 | | - nextLanePriority = return_highestLanePriority; |
273 | 229 | } else { |
274 | 230 | if (pingedLanes !== NoLanes) { |
275 | 231 | nextLanes = getHighestPriorityLanes(pingedLanes); |
276 | | - nextLanePriority = return_highestLanePriority; |
277 | 232 | } |
278 | 233 | } |
279 | 234 | } |
@@ -307,8 +262,6 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes { |
307 | 262 | ) { |
308 | 263 | // Keep working on the existing in-progress tree. Do not interrupt. |
309 | 264 | return wipLanes; |
310 | | - } else { |
311 | | - return_highestLanePriority = nextLanePriority; |
312 | 265 | } |
313 | 266 | } |
314 | 267 |
|
@@ -490,9 +443,6 @@ export function getLanesToRetrySynchronouslyOnError(root: FiberRoot): Lanes { |
490 | 443 | return NoLanes; |
491 | 444 | } |
492 | 445 |
|
493 | | -export function returnNextLanesPriority() { |
494 | | - return return_highestLanePriority; |
495 | | -} |
496 | 446 | export function includesNonIdleWork(lanes: Lanes) { |
497 | 447 | return (lanes & NonIdleLanes) !== NoLanes; |
498 | 448 | } |
@@ -579,13 +529,6 @@ export function higherPriorityLane(a: Lane, b: Lane) { |
579 | 529 | return a !== NoLane && a < b ? a : b; |
580 | 530 | } |
581 | 531 |
|
582 | | -export function higherLanePriority( |
583 | | - a: LanePriority, |
584 | | - b: LanePriority, |
585 | | -): LanePriority { |
586 | | - return a !== NoLanePriority && a > b ? a : b; |
587 | | -} |
588 | | - |
589 | 532 | export function createLaneMap<T>(initial: T): LaneMap<T> { |
590 | 533 | // Intentionally pushing one by one. |
591 | 534 | // https://v8.dev/blog/elements-kinds#avoid-creating-holes |
|