()
| 4487 | } |
| 4488 | |
| 4489 | function flushPassiveEffectsImpl() { |
| 4490 | // Cache and clear the transitions flag |
| 4491 | const transitions = pendingPassiveTransitions; |
| 4492 | pendingPassiveTransitions = null; |
| 4493 | |
| 4494 | const root = pendingEffectsRoot; |
| 4495 | const lanes = pendingEffectsLanes; |
| 4496 | pendingEffectsStatus = NO_PENDING_EFFECTS; |
| 4497 | pendingEffectsRoot = (null: any); // Clear for GC purposes. |
| 4498 | pendingFinishedWork = (null: any); // Clear for GC purposes. |
| 4499 | // TODO: This is sometimes out of sync with pendingEffectsRoot. |
| 4500 | // Figure out why and fix it. It's not causing any known issues (probably |
| 4501 | // because it's only used for profiling), but it's a refactor hazard. |
| 4502 | pendingEffectsLanes = NoLanes; |
| 4503 | |
| 4504 | if (enableYieldingBeforePassive) { |
| 4505 | // We've finished our work for this render pass. |
| 4506 | root.callbackNode = null; |
| 4507 | root.callbackPriority = NoLane; |
| 4508 | } |
| 4509 | |
| 4510 | if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { |
| 4511 | throw new Error('Cannot flush passive effects while already rendering.'); |
| 4512 | } |
| 4513 | |
| 4514 | if (enableProfilerTimer && enableComponentPerformanceTrack) { |
| 4515 | // We're about to log a lot of profiling for this commit. |
| 4516 | // We set this once so we don't have to recompute it for every log. |
| 4517 | setCurrentTrackFromLanes(lanes); |
| 4518 | } |
| 4519 | |
| 4520 | if (__DEV__) { |
| 4521 | isFlushingPassiveEffects = true; |
| 4522 | didScheduleUpdateDuringPassiveEffects = false; |
| 4523 | } |
| 4524 | |
| 4525 | let passiveEffectStartTime = 0; |
| 4526 | if (enableProfilerTimer && enableComponentPerformanceTrack) { |
| 4527 | resetCommitErrors(); |
| 4528 | passiveEffectStartTime = now(); |
| 4529 | if (pendingDelayedCommitReason === ANIMATION_STARTED_COMMIT) { |
| 4530 | // The animation was started, so we've been animating since that happened. |
| 4531 | logAnimatingPhase(commitEndTime, passiveEffectStartTime, animatingTask); |
| 4532 | } else { |
| 4533 | logPaintYieldPhase( |
| 4534 | commitEndTime, |
| 4535 | passiveEffectStartTime, |
| 4536 | pendingDelayedCommitReason === DELAYED_PASSIVE_COMMIT, |
| 4537 | workInProgressUpdateTask, |
| 4538 | ); |
| 4539 | } |
| 4540 | } |
| 4541 | |
| 4542 | if (enableSchedulingProfiler) { |
| 4543 | markPassiveEffectsStarted(lanes); |
| 4544 | } |
| 4545 | |
| 4546 | const prevExecutionContext = executionContext; |
no test coverage detected