From e0ee779d98179810fe4b3bad9c00c687c7e5f3fa Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Tue, 23 Mar 2021 15:19:56 -0400 Subject: [PATCH 1/2] Delete SyncBatchedLane --- .../src/constants.js | 2 +- .../__tests__/preprocessData-test.internal.js | 26 ++--- .../src/ReactFiberLane.new.js | 98 ++++++++----------- .../src/ReactFiberLane.old.js | 98 ++++++++----------- .../src/ReactFiberWorkLoop.new.js | 15 --- .../src/ReactFiberWorkLoop.old.js | 15 --- .../__tests__/DebugTracing-test.internal.js | 4 +- 7 files changed, 102 insertions(+), 156 deletions(-) diff --git a/packages/react-devtools-scheduling-profiler/src/constants.js b/packages/react-devtools-scheduling-profiler/src/constants.js index 2e463ae632d95..5b925cb562b7f 100644 --- a/packages/react-devtools-scheduling-profiler/src/constants.js +++ b/packages/react-devtools-scheduling-profiler/src/constants.js @@ -12,4 +12,4 @@ export { COMPACT_LINE_HEIGHT, } from 'react-devtools-shared/src/constants.js'; -export const REACT_TOTAL_NUM_LANES = 31; +export const REACT_TOTAL_NUM_LANES = 30; diff --git a/packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js b/packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js index b5b3a4561e8ff..54b1a5985aa36 100644 --- a/packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js +++ b/packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js @@ -42,7 +42,7 @@ describe(getLanesFromTransportDecimalBitmask, () => { it('should ignore lanes outside REACT_TOTAL_NUM_LANES', () => { // Sanity check; this test may need to be updated when the no. of fiber // lanes are changed. - expect(REACT_TOTAL_NUM_LANES).toBe(31); + expect(REACT_TOTAL_NUM_LANES).toBe(30); expect( getLanesFromTransportDecimalBitmask( @@ -404,7 +404,7 @@ describe(preprocessData, () => { { componentStack: '', laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.005, type: 'schedule-render', }, @@ -413,7 +413,7 @@ describe(preprocessData, () => { componentStack: '', isCascading: false, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.013, type: 'schedule-state-update', }, @@ -425,7 +425,7 @@ describe(preprocessData, () => { depth: 0, duration: 0.004999999999999999, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.006, type: 'render-idle', }, @@ -434,7 +434,7 @@ describe(preprocessData, () => { depth: 0, duration: 0.001, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.006, type: 'render', }, @@ -443,7 +443,7 @@ describe(preprocessData, () => { depth: 0, duration: 0.002999999999999999, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.008, type: 'commit', }, @@ -452,7 +452,7 @@ describe(preprocessData, () => { depth: 1, duration: 0.0010000000000000009, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.009, type: 'layout-effects', }, @@ -461,7 +461,7 @@ describe(preprocessData, () => { depth: 0, duration: 0.002, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.012, type: 'passive-effects', }, @@ -470,7 +470,7 @@ describe(preprocessData, () => { depth: 0, duration: 0.005000000000000001, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.015, type: 'render-idle', }, @@ -479,7 +479,7 @@ describe(preprocessData, () => { depth: 0, duration: 0.0010000000000000009, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.015, type: 'render', }, @@ -488,7 +488,7 @@ describe(preprocessData, () => { depth: 0, duration: 0.002999999999999999, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.017, type: 'commit', }, @@ -497,7 +497,7 @@ describe(preprocessData, () => { depth: 1, duration: 0.0010000000000000009, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.018, type: 'layout-effects', }, @@ -506,7 +506,7 @@ describe(preprocessData, () => { depth: 0, duration: 0.0009999999999999974, laneLabels: ['Default'], - lanes: [5], + lanes: [4], timestamp: 0.021, type: 'passive-effects', }, diff --git a/packages/react-reconciler/src/ReactFiberLane.new.js b/packages/react-reconciler/src/ReactFiberLane.new.js index 692f799bce858..197ff7e740efd 100644 --- a/packages/react-reconciler/src/ReactFiberLane.new.js +++ b/packages/react-reconciler/src/ReactFiberLane.new.js @@ -46,8 +46,7 @@ import { NoPriority as NoSchedulerPriority, } from './SchedulerWithReactIntegration.new'; -export const SyncLanePriority: LanePriority = 13; -export const SyncBatchedLanePriority: LanePriority = 12; +export const SyncLanePriority: LanePriority = 12; const InputContinuousHydrationLanePriority: LanePriority = 11; export const InputContinuousLanePriority: LanePriority = 10; @@ -72,55 +71,54 @@ export const NoLanePriority: LanePriority = 0; // Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler. // If those values are changed that package should be rebuilt and redeployed. -export const TotalLanes = 31; - -export const NoLanes: Lanes = /* */ 0b0000000000000000000000000000000; -export const NoLane: Lane = /* */ 0b0000000000000000000000000000000; - -export const SyncLane: Lane = /* */ 0b0000000000000000000000000000001; -export const SyncBatchedLane: Lane = /* */ 0b0000000000000000000000000000010; - -const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000000100; -export const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000000001000; - -export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000000010000; -export const DefaultLane: Lanes = /* */ 0b0000000000000000000000000100000; - -const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000001000000; -const TransitionLanes: Lanes = /* */ 0b0000000011111111111111110000000; -const TransitionLane1: Lane = /* */ 0b0000000000000000000000010000000; -const TransitionLane2: Lane = /* */ 0b0000000000000000000000100000000; -const TransitionLane3: Lane = /* */ 0b0000000000000000000001000000000; -const TransitionLane4: Lane = /* */ 0b0000000000000000000010000000000; -const TransitionLane5: Lane = /* */ 0b0000000000000000000100000000000; -const TransitionLane6: Lane = /* */ 0b0000000000000000001000000000000; -const TransitionLane7: Lane = /* */ 0b0000000000000000010000000000000; -const TransitionLane8: Lane = /* */ 0b0000000000000000100000000000000; -const TransitionLane9: Lane = /* */ 0b0000000000000001000000000000000; -const TransitionLane10: Lane = /* */ 0b0000000000000010000000000000000; -const TransitionLane11: Lane = /* */ 0b0000000000000100000000000000000; -const TransitionLane12: Lane = /* */ 0b0000000000001000000000000000000; -const TransitionLane13: Lane = /* */ 0b0000000000010000000000000000000; -const TransitionLane14: Lane = /* */ 0b0000000000100000000000000000000; -const TransitionLane15: Lane = /* */ 0b0000000001000000000000000000000; -const TransitionLane16: Lane = /* */ 0b0000000010000000000000000000000; - -const RetryLanes: Lanes = /* */ 0b0000111100000000000000000000000; -const RetryLane1: Lane = /* */ 0b0000000100000000000000000000000; -const RetryLane2: Lane = /* */ 0b0000001000000000000000000000000; -const RetryLane3: Lane = /* */ 0b0000010000000000000000000000000; -const RetryLane4: Lane = /* */ 0b0000100000000000000000000000000; +export const TotalLanes = 30; + +export const NoLanes: Lanes = /* */ 0b000000000000000000000000000000; +export const NoLane: Lane = /* */ 0b000000000000000000000000000000; + +export const SyncLane: Lane = /* */ 0b000000000000000000000000000001; + +const InputContinuousHydrationLane: Lane = /* */ 0b000000000000000000000000000010; +export const InputContinuousLane: Lanes = /* */ 0b000000000000000000000000000100; + +export const DefaultHydrationLane: Lane = /* */ 0b000000000000000000000000001000; +export const DefaultLane: Lanes = /* */ 0b000000000000000000000000010000; + +const TransitionHydrationLane: Lane = /* */ 0b000000000000000000000000100000; +const TransitionLanes: Lanes = /* */ 0b000000001111111111111111000000; +const TransitionLane1: Lane = /* */ 0b000000000000000000000001000000; +const TransitionLane2: Lane = /* */ 0b000000000000000000000010000000; +const TransitionLane3: Lane = /* */ 0b000000000000000000000100000000; +const TransitionLane4: Lane = /* */ 0b000000000000000000001000000000; +const TransitionLane5: Lane = /* */ 0b000000000000000000010000000000; +const TransitionLane6: Lane = /* */ 0b000000000000000000100000000000; +const TransitionLane7: Lane = /* */ 0b000000000000000001000000000000; +const TransitionLane8: Lane = /* */ 0b000000000000000010000000000000; +const TransitionLane9: Lane = /* */ 0b000000000000000100000000000000; +const TransitionLane10: Lane = /* */ 0b000000000000001000000000000000; +const TransitionLane11: Lane = /* */ 0b000000000000010000000000000000; +const TransitionLane12: Lane = /* */ 0b000000000000100000000000000000; +const TransitionLane13: Lane = /* */ 0b000000000001000000000000000000; +const TransitionLane14: Lane = /* */ 0b000000000010000000000000000000; +const TransitionLane15: Lane = /* */ 0b000000000100000000000000000000; +const TransitionLane16: Lane = /* */ 0b000000001000000000000000000000; + +const RetryLanes: Lanes = /* */ 0b000011110000000000000000000000; +const RetryLane1: Lane = /* */ 0b000000010000000000000000000000; +const RetryLane2: Lane = /* */ 0b000000100000000000000000000000; +const RetryLane3: Lane = /* */ 0b000001000000000000000000000000; +const RetryLane4: Lane = /* */ 0b000010000000000000000000000000; export const SomeRetryLane: Lane = RetryLane1; -export const SelectiveHydrationLane: Lane = /* */ 0b0001000000000000000000000000000; +export const SelectiveHydrationLane: Lane = /* */ 0b000100000000000000000000000000; -const NonIdleLanes = /* */ 0b0001111111111111111111111111111; +const NonIdleLanes = /* */ 0b000111111111111111111111111111; -export const IdleHydrationLane: Lane = /* */ 0b0010000000000000000000000000000; -const IdleLane: Lanes = /* */ 0b0100000000000000000000000000000; +export const IdleHydrationLane: Lane = /* */ 0b001000000000000000000000000000; +const IdleLane: Lanes = /* */ 0b010000000000000000000000000000; -export const OffscreenLane: Lane = /* */ 0b1000000000000000000000000000000; +export const OffscreenLane: Lane = /* */ 0b100000000000000000000000000000; // This function is used for the experimental scheduling profiler (react-devtools-scheduling-profiler) // It should be kept in sync with the Lanes values above. @@ -130,9 +128,6 @@ export function getLabelsForLanes(lanes: Lanes): Array | void { if (lanes & SyncLane) { labels.push('Sync'); } - if (lanes & SyncBatchedLane) { - labels.push('SyncBatched'); - } if (lanes & InputContinuousHydrationLane) { labels.push('InputContinuousHydration'); } @@ -194,9 +189,6 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { case SyncLane: return_highestLanePriority = SyncLanePriority; return SyncLane; - case SyncBatchedLane: - return_highestLanePriority = SyncBatchedLanePriority; - return SyncBatchedLane; case InputContinuousHydrationLane: return_highestLanePriority = InputContinuousHydrationLanePriority; return InputContinuousHydrationLane; @@ -265,7 +257,6 @@ export function lanePriorityToSchedulerPriority( ): ReactPriorityLevel { switch (lanePriority) { case SyncLanePriority: - case SyncBatchedLanePriority: return ImmediateSchedulerPriority; case InputContinuousHydrationLanePriority: case InputContinuousLanePriority: @@ -547,8 +538,6 @@ export function findUpdateLane(lanePriority: LanePriority): Lane { break; case SyncLanePriority: return SyncLane; - case SyncBatchedLanePriority: - return SyncBatchedLane; case InputContinuousLanePriority: return InputContinuousLane; case DefaultLanePriority: @@ -805,7 +794,6 @@ export function getBumpedLaneForHydration( let lane; switch (highestLanePriority) { case SyncLanePriority: - case SyncBatchedLanePriority: lane = NoLane; break; case InputContinuousLanePriority: diff --git a/packages/react-reconciler/src/ReactFiberLane.old.js b/packages/react-reconciler/src/ReactFiberLane.old.js index aaf63a66403b5..a8b28aeaa51ac 100644 --- a/packages/react-reconciler/src/ReactFiberLane.old.js +++ b/packages/react-reconciler/src/ReactFiberLane.old.js @@ -46,8 +46,7 @@ import { NoPriority as NoSchedulerPriority, } from './SchedulerWithReactIntegration.old'; -export const SyncLanePriority: LanePriority = 13; -export const SyncBatchedLanePriority: LanePriority = 12; +export const SyncLanePriority: LanePriority = 12; const InputContinuousHydrationLanePriority: LanePriority = 11; export const InputContinuousLanePriority: LanePriority = 10; @@ -72,55 +71,54 @@ export const NoLanePriority: LanePriority = 0; // Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler. // If those values are changed that package should be rebuilt and redeployed. -export const TotalLanes = 31; - -export const NoLanes: Lanes = /* */ 0b0000000000000000000000000000000; -export const NoLane: Lane = /* */ 0b0000000000000000000000000000000; - -export const SyncLane: Lane = /* */ 0b0000000000000000000000000000001; -export const SyncBatchedLane: Lane = /* */ 0b0000000000000000000000000000010; - -const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000000100; -export const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000000001000; - -export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000000010000; -export const DefaultLane: Lanes = /* */ 0b0000000000000000000000000100000; - -const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000001000000; -const TransitionLanes: Lanes = /* */ 0b0000000011111111111111110000000; -const TransitionLane1: Lane = /* */ 0b0000000000000000000000010000000; -const TransitionLane2: Lane = /* */ 0b0000000000000000000000100000000; -const TransitionLane3: Lane = /* */ 0b0000000000000000000001000000000; -const TransitionLane4: Lane = /* */ 0b0000000000000000000010000000000; -const TransitionLane5: Lane = /* */ 0b0000000000000000000100000000000; -const TransitionLane6: Lane = /* */ 0b0000000000000000001000000000000; -const TransitionLane7: Lane = /* */ 0b0000000000000000010000000000000; -const TransitionLane8: Lane = /* */ 0b0000000000000000100000000000000; -const TransitionLane9: Lane = /* */ 0b0000000000000001000000000000000; -const TransitionLane10: Lane = /* */ 0b0000000000000010000000000000000; -const TransitionLane11: Lane = /* */ 0b0000000000000100000000000000000; -const TransitionLane12: Lane = /* */ 0b0000000000001000000000000000000; -const TransitionLane13: Lane = /* */ 0b0000000000010000000000000000000; -const TransitionLane14: Lane = /* */ 0b0000000000100000000000000000000; -const TransitionLane15: Lane = /* */ 0b0000000001000000000000000000000; -const TransitionLane16: Lane = /* */ 0b0000000010000000000000000000000; - -const RetryLanes: Lanes = /* */ 0b0000111100000000000000000000000; -const RetryLane1: Lane = /* */ 0b0000000100000000000000000000000; -const RetryLane2: Lane = /* */ 0b0000001000000000000000000000000; -const RetryLane3: Lane = /* */ 0b0000010000000000000000000000000; -const RetryLane4: Lane = /* */ 0b0000100000000000000000000000000; +export const TotalLanes = 30; + +export const NoLanes: Lanes = /* */ 0b000000000000000000000000000000; +export const NoLane: Lane = /* */ 0b000000000000000000000000000000; + +export const SyncLane: Lane = /* */ 0b000000000000000000000000000001; + +const InputContinuousHydrationLane: Lane = /* */ 0b000000000000000000000000000010; +export const InputContinuousLane: Lanes = /* */ 0b000000000000000000000000000100; + +export const DefaultHydrationLane: Lane = /* */ 0b000000000000000000000000001000; +export const DefaultLane: Lanes = /* */ 0b000000000000000000000000010000; + +const TransitionHydrationLane: Lane = /* */ 0b000000000000000000000000100000; +const TransitionLanes: Lanes = /* */ 0b000000001111111111111111000000; +const TransitionLane1: Lane = /* */ 0b000000000000000000000001000000; +const TransitionLane2: Lane = /* */ 0b000000000000000000000010000000; +const TransitionLane3: Lane = /* */ 0b000000000000000000000100000000; +const TransitionLane4: Lane = /* */ 0b000000000000000000001000000000; +const TransitionLane5: Lane = /* */ 0b000000000000000000010000000000; +const TransitionLane6: Lane = /* */ 0b000000000000000000100000000000; +const TransitionLane7: Lane = /* */ 0b000000000000000001000000000000; +const TransitionLane8: Lane = /* */ 0b000000000000000010000000000000; +const TransitionLane9: Lane = /* */ 0b000000000000000100000000000000; +const TransitionLane10: Lane = /* */ 0b000000000000001000000000000000; +const TransitionLane11: Lane = /* */ 0b000000000000010000000000000000; +const TransitionLane12: Lane = /* */ 0b000000000000100000000000000000; +const TransitionLane13: Lane = /* */ 0b000000000001000000000000000000; +const TransitionLane14: Lane = /* */ 0b000000000010000000000000000000; +const TransitionLane15: Lane = /* */ 0b000000000100000000000000000000; +const TransitionLane16: Lane = /* */ 0b000000001000000000000000000000; + +const RetryLanes: Lanes = /* */ 0b000011110000000000000000000000; +const RetryLane1: Lane = /* */ 0b000000010000000000000000000000; +const RetryLane2: Lane = /* */ 0b000000100000000000000000000000; +const RetryLane3: Lane = /* */ 0b000001000000000000000000000000; +const RetryLane4: Lane = /* */ 0b000010000000000000000000000000; export const SomeRetryLane: Lane = RetryLane1; -export const SelectiveHydrationLane: Lane = /* */ 0b0001000000000000000000000000000; +export const SelectiveHydrationLane: Lane = /* */ 0b000100000000000000000000000000; -const NonIdleLanes = /* */ 0b0001111111111111111111111111111; +const NonIdleLanes = /* */ 0b000111111111111111111111111111; -export const IdleHydrationLane: Lane = /* */ 0b0010000000000000000000000000000; -const IdleLane: Lanes = /* */ 0b0100000000000000000000000000000; +export const IdleHydrationLane: Lane = /* */ 0b001000000000000000000000000000; +const IdleLane: Lanes = /* */ 0b010000000000000000000000000000; -export const OffscreenLane: Lane = /* */ 0b1000000000000000000000000000000; +export const OffscreenLane: Lane = /* */ 0b100000000000000000000000000000; // This function is used for the experimental scheduling profiler (react-devtools-scheduling-profiler) // It should be kept in sync with the Lanes values above. @@ -130,9 +128,6 @@ export function getLabelsForLanes(lanes: Lanes): Array | void { if (lanes & SyncLane) { labels.push('Sync'); } - if (lanes & SyncBatchedLane) { - labels.push('SyncBatched'); - } if (lanes & InputContinuousHydrationLane) { labels.push('InputContinuousHydration'); } @@ -194,9 +189,6 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { case SyncLane: return_highestLanePriority = SyncLanePriority; return SyncLane; - case SyncBatchedLane: - return_highestLanePriority = SyncBatchedLanePriority; - return SyncBatchedLane; case InputContinuousHydrationLane: return_highestLanePriority = InputContinuousHydrationLanePriority; return InputContinuousHydrationLane; @@ -265,7 +257,6 @@ export function lanePriorityToSchedulerPriority( ): ReactPriorityLevel { switch (lanePriority) { case SyncLanePriority: - case SyncBatchedLanePriority: return ImmediateSchedulerPriority; case InputContinuousHydrationLanePriority: case InputContinuousLanePriority: @@ -547,8 +538,6 @@ export function findUpdateLane(lanePriority: LanePriority): Lane { break; case SyncLanePriority: return SyncLane; - case SyncBatchedLanePriority: - return SyncBatchedLane; case InputContinuousLanePriority: return InputContinuousLane; case DefaultLanePriority: @@ -805,7 +794,6 @@ export function getBumpedLaneForHydration( let lane; switch (highestLanePriority) { case SyncLanePriority: - case SyncBatchedLanePriority: lane = NoLane; break; case InputContinuousLanePriority: diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index 186381b9b5cf8..03eb396fc77e0 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -132,12 +132,10 @@ import { import { NoLanePriority, SyncLanePriority, - SyncBatchedLanePriority, DefaultLanePriority, NoLanes, NoLane, SyncLane, - SyncBatchedLane, NoTimestamp, findUpdateLane, claimNextTransitionLane, @@ -380,10 +378,6 @@ export function requestUpdateLane(fiber: Fiber): Lane { const mode = fiber.mode; if ((mode & ConcurrentMode) === NoMode) { return (SyncLane: Lane); - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentUpdateLanePriority() === SyncLanePriority - ? (SyncLane: Lane) - : (SyncBatchedLane: Lane); } else if ( !deferRenderPhaseUpdateToNextBatch && (executionContext & RenderContext) !== NoContext && @@ -449,10 +443,6 @@ function requestRetryLane(fiber: Fiber) { const mode = fiber.mode; if ((mode & ConcurrentMode) === NoMode) { return (SyncLane: Lane); - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentUpdateLanePriority() === SyncLanePriority - ? (SyncLane: Lane) - : (SyncBatchedLane: Lane); } // See `requestUpdateLane` for explanation of `currentEventWipLanes` @@ -703,11 +693,6 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) { scheduleCallback(ImmediateSchedulerPriority, flushSyncCallbackQueue); } newCallbackNode = null; - } else if (newCallbackPriority === SyncBatchedLanePriority) { - newCallbackNode = scheduleCallback( - ImmediateSchedulerPriority, - performSyncWorkOnRoot.bind(null, root), - ); } else { const schedulerPriorityLevel = lanePriorityToSchedulerPriority( newCallbackPriority, diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index ba328d5fdb449..3b63c3f12eb12 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -132,12 +132,10 @@ import { import { NoLanePriority, SyncLanePriority, - SyncBatchedLanePriority, DefaultLanePriority, NoLanes, NoLane, SyncLane, - SyncBatchedLane, NoTimestamp, findUpdateLane, claimNextTransitionLane, @@ -380,10 +378,6 @@ export function requestUpdateLane(fiber: Fiber): Lane { const mode = fiber.mode; if ((mode & ConcurrentMode) === NoMode) { return (SyncLane: Lane); - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentUpdateLanePriority() === SyncLanePriority - ? (SyncLane: Lane) - : (SyncBatchedLane: Lane); } else if ( !deferRenderPhaseUpdateToNextBatch && (executionContext & RenderContext) !== NoContext && @@ -449,10 +443,6 @@ function requestRetryLane(fiber: Fiber) { const mode = fiber.mode; if ((mode & ConcurrentMode) === NoMode) { return (SyncLane: Lane); - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentUpdateLanePriority() === SyncLanePriority - ? (SyncLane: Lane) - : (SyncBatchedLane: Lane); } // See `requestUpdateLane` for explanation of `currentEventWipLanes` @@ -703,11 +693,6 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) { scheduleCallback(ImmediateSchedulerPriority, flushSyncCallbackQueue); } newCallbackNode = null; - } else if (newCallbackPriority === SyncBatchedLanePriority) { - newCallbackNode = scheduleCallback( - ImmediateSchedulerPriority, - performSyncWorkOnRoot.bind(null, root), - ); } else { const schedulerPriorityLevel = lanePriorityToSchedulerPriority( newCallbackPriority, diff --git a/packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js b/packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js index 3191158b67d1a..83fc6b2eba890 100644 --- a/packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js +++ b/packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js @@ -16,8 +16,8 @@ describe('DebugTracing', () => { let logs; - const DEFAULT_LANE_STRING = '0b0000000000000000000000000100000'; - const RETRY_LANE_STRING = '0b0000000100000000000000000000000'; + const DEFAULT_LANE_STRING = '0b0000000000000000000000000010000'; + const RETRY_LANE_STRING = '0b0000000010000000000000000000000'; beforeEach(() => { jest.resetModules(); From 7fe6a732eb384ce7e8bd8c6798a8a72d6c6cc82a Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Wed, 24 Mar 2021 12:39:30 -0400 Subject: [PATCH 2/2] Go back to 31 lanes --- .../src/constants.js | 2 +- .../__tests__/preprocessData-test.internal.js | 2 +- .../src/ReactFiberLane.new.js | 78 ++++++++++--------- .../src/ReactFiberLane.old.js | 78 ++++++++++--------- 4 files changed, 82 insertions(+), 78 deletions(-) diff --git a/packages/react-devtools-scheduling-profiler/src/constants.js b/packages/react-devtools-scheduling-profiler/src/constants.js index 5b925cb562b7f..2e463ae632d95 100644 --- a/packages/react-devtools-scheduling-profiler/src/constants.js +++ b/packages/react-devtools-scheduling-profiler/src/constants.js @@ -12,4 +12,4 @@ export { COMPACT_LINE_HEIGHT, } from 'react-devtools-shared/src/constants.js'; -export const REACT_TOTAL_NUM_LANES = 30; +export const REACT_TOTAL_NUM_LANES = 31; diff --git a/packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js b/packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js index 54b1a5985aa36..4945b5fdb4d54 100644 --- a/packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js +++ b/packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js @@ -42,7 +42,7 @@ describe(getLanesFromTransportDecimalBitmask, () => { it('should ignore lanes outside REACT_TOTAL_NUM_LANES', () => { // Sanity check; this test may need to be updated when the no. of fiber // lanes are changed. - expect(REACT_TOTAL_NUM_LANES).toBe(30); + expect(REACT_TOTAL_NUM_LANES).toBe(31); expect( getLanesFromTransportDecimalBitmask( diff --git a/packages/react-reconciler/src/ReactFiberLane.new.js b/packages/react-reconciler/src/ReactFiberLane.new.js index 197ff7e740efd..ea5b8300bd711 100644 --- a/packages/react-reconciler/src/ReactFiberLane.new.js +++ b/packages/react-reconciler/src/ReactFiberLane.new.js @@ -71,54 +71,55 @@ export const NoLanePriority: LanePriority = 0; // Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler. // If those values are changed that package should be rebuilt and redeployed. -export const TotalLanes = 30; +export const TotalLanes = 31; export const NoLanes: Lanes = /* */ 0b000000000000000000000000000000; export const NoLane: Lane = /* */ 0b000000000000000000000000000000; -export const SyncLane: Lane = /* */ 0b000000000000000000000000000001; - -const InputContinuousHydrationLane: Lane = /* */ 0b000000000000000000000000000010; -export const InputContinuousLane: Lanes = /* */ 0b000000000000000000000000000100; - -export const DefaultHydrationLane: Lane = /* */ 0b000000000000000000000000001000; -export const DefaultLane: Lanes = /* */ 0b000000000000000000000000010000; - -const TransitionHydrationLane: Lane = /* */ 0b000000000000000000000000100000; -const TransitionLanes: Lanes = /* */ 0b000000001111111111111111000000; -const TransitionLane1: Lane = /* */ 0b000000000000000000000001000000; -const TransitionLane2: Lane = /* */ 0b000000000000000000000010000000; -const TransitionLane3: Lane = /* */ 0b000000000000000000000100000000; -const TransitionLane4: Lane = /* */ 0b000000000000000000001000000000; -const TransitionLane5: Lane = /* */ 0b000000000000000000010000000000; -const TransitionLane6: Lane = /* */ 0b000000000000000000100000000000; -const TransitionLane7: Lane = /* */ 0b000000000000000001000000000000; -const TransitionLane8: Lane = /* */ 0b000000000000000010000000000000; -const TransitionLane9: Lane = /* */ 0b000000000000000100000000000000; -const TransitionLane10: Lane = /* */ 0b000000000000001000000000000000; -const TransitionLane11: Lane = /* */ 0b000000000000010000000000000000; -const TransitionLane12: Lane = /* */ 0b000000000000100000000000000000; -const TransitionLane13: Lane = /* */ 0b000000000001000000000000000000; -const TransitionLane14: Lane = /* */ 0b000000000010000000000000000000; -const TransitionLane15: Lane = /* */ 0b000000000100000000000000000000; -const TransitionLane16: Lane = /* */ 0b000000001000000000000000000000; - -const RetryLanes: Lanes = /* */ 0b000011110000000000000000000000; -const RetryLane1: Lane = /* */ 0b000000010000000000000000000000; -const RetryLane2: Lane = /* */ 0b000000100000000000000000000000; -const RetryLane3: Lane = /* */ 0b000001000000000000000000000000; -const RetryLane4: Lane = /* */ 0b000010000000000000000000000000; +export const SyncLane: Lane = /* */ 0b0000000000000000000000000000001; + +const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000000010; +export const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000000000100; + +export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000000001000; +export const DefaultLane: Lanes = /* */ 0b0000000000000000000000000010000; + +const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000000100000; +const TransitionLanes: Lanes = /* */ 0b0000000001111111111111111000000; +const TransitionLane1: Lane = /* */ 0b0000000000000000000000001000000; +const TransitionLane2: Lane = /* */ 0b0000000000000000000000010000000; +const TransitionLane3: Lane = /* */ 0b0000000000000000000000100000000; +const TransitionLane4: Lane = /* */ 0b0000000000000000000001000000000; +const TransitionLane5: Lane = /* */ 0b0000000000000000000010000000000; +const TransitionLane6: Lane = /* */ 0b0000000000000000000100000000000; +const TransitionLane7: Lane = /* */ 0b0000000000000000001000000000000; +const TransitionLane8: Lane = /* */ 0b0000000000000000010000000000000; +const TransitionLane9: Lane = /* */ 0b0000000000000000100000000000000; +const TransitionLane10: Lane = /* */ 0b0000000000000001000000000000000; +const TransitionLane11: Lane = /* */ 0b0000000000000010000000000000000; +const TransitionLane12: Lane = /* */ 0b0000000000000100000000000000000; +const TransitionLane13: Lane = /* */ 0b0000000000001000000000000000000; +const TransitionLane14: Lane = /* */ 0b0000000000010000000000000000000; +const TransitionLane15: Lane = /* */ 0b0000000000100000000000000000000; +const TransitionLane16: Lane = /* */ 0b0000000001000000000000000000000; + +const RetryLanes: Lanes = /* */ 0b0000111110000000000000000000000; +const RetryLane1: Lane = /* */ 0b0000000010000000000000000000000; +const RetryLane2: Lane = /* */ 0b0000000100000000000000000000000; +const RetryLane3: Lane = /* */ 0b0000001000000000000000000000000; +const RetryLane4: Lane = /* */ 0b0000010000000000000000000000000; +const RetryLane5: Lane = /* */ 0b0000100000000000000000000000000; export const SomeRetryLane: Lane = RetryLane1; -export const SelectiveHydrationLane: Lane = /* */ 0b000100000000000000000000000000; +export const SelectiveHydrationLane: Lane = /* */ 0b0001000000000000000000000000000; -const NonIdleLanes = /* */ 0b000111111111111111111111111111; +const NonIdleLanes = /* */ 0b0001111111111111111111111111111; -export const IdleHydrationLane: Lane = /* */ 0b001000000000000000000000000000; -const IdleLane: Lanes = /* */ 0b010000000000000000000000000000; +export const IdleHydrationLane: Lane = /* */ 0b0010000000000000000000000000000; +const IdleLane: Lanes = /* */ 0b0100000000000000000000000000000; -export const OffscreenLane: Lane = /* */ 0b100000000000000000000000000000; +export const OffscreenLane: Lane = /* */ 0b1000000000000000000000000000000; // This function is used for the experimental scheduling profiler (react-devtools-scheduling-profiler) // It should be kept in sync with the Lanes values above. @@ -226,6 +227,7 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { case RetryLane2: case RetryLane3: case RetryLane4: + case RetryLane5: return_highestLanePriority = RetryLanePriority; return lanes & RetryLanes; case SelectiveHydrationLane: diff --git a/packages/react-reconciler/src/ReactFiberLane.old.js b/packages/react-reconciler/src/ReactFiberLane.old.js index a8b28aeaa51ac..009d7ba87d32d 100644 --- a/packages/react-reconciler/src/ReactFiberLane.old.js +++ b/packages/react-reconciler/src/ReactFiberLane.old.js @@ -71,54 +71,55 @@ export const NoLanePriority: LanePriority = 0; // Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler. // If those values are changed that package should be rebuilt and redeployed. -export const TotalLanes = 30; +export const TotalLanes = 31; export const NoLanes: Lanes = /* */ 0b000000000000000000000000000000; export const NoLane: Lane = /* */ 0b000000000000000000000000000000; -export const SyncLane: Lane = /* */ 0b000000000000000000000000000001; - -const InputContinuousHydrationLane: Lane = /* */ 0b000000000000000000000000000010; -export const InputContinuousLane: Lanes = /* */ 0b000000000000000000000000000100; - -export const DefaultHydrationLane: Lane = /* */ 0b000000000000000000000000001000; -export const DefaultLane: Lanes = /* */ 0b000000000000000000000000010000; - -const TransitionHydrationLane: Lane = /* */ 0b000000000000000000000000100000; -const TransitionLanes: Lanes = /* */ 0b000000001111111111111111000000; -const TransitionLane1: Lane = /* */ 0b000000000000000000000001000000; -const TransitionLane2: Lane = /* */ 0b000000000000000000000010000000; -const TransitionLane3: Lane = /* */ 0b000000000000000000000100000000; -const TransitionLane4: Lane = /* */ 0b000000000000000000001000000000; -const TransitionLane5: Lane = /* */ 0b000000000000000000010000000000; -const TransitionLane6: Lane = /* */ 0b000000000000000000100000000000; -const TransitionLane7: Lane = /* */ 0b000000000000000001000000000000; -const TransitionLane8: Lane = /* */ 0b000000000000000010000000000000; -const TransitionLane9: Lane = /* */ 0b000000000000000100000000000000; -const TransitionLane10: Lane = /* */ 0b000000000000001000000000000000; -const TransitionLane11: Lane = /* */ 0b000000000000010000000000000000; -const TransitionLane12: Lane = /* */ 0b000000000000100000000000000000; -const TransitionLane13: Lane = /* */ 0b000000000001000000000000000000; -const TransitionLane14: Lane = /* */ 0b000000000010000000000000000000; -const TransitionLane15: Lane = /* */ 0b000000000100000000000000000000; -const TransitionLane16: Lane = /* */ 0b000000001000000000000000000000; - -const RetryLanes: Lanes = /* */ 0b000011110000000000000000000000; -const RetryLane1: Lane = /* */ 0b000000010000000000000000000000; -const RetryLane2: Lane = /* */ 0b000000100000000000000000000000; -const RetryLane3: Lane = /* */ 0b000001000000000000000000000000; -const RetryLane4: Lane = /* */ 0b000010000000000000000000000000; +export const SyncLane: Lane = /* */ 0b0000000000000000000000000000001; + +const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000000010; +export const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000000000100; + +export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000000001000; +export const DefaultLane: Lanes = /* */ 0b0000000000000000000000000010000; + +const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000000100000; +const TransitionLanes: Lanes = /* */ 0b0000000001111111111111111000000; +const TransitionLane1: Lane = /* */ 0b0000000000000000000000001000000; +const TransitionLane2: Lane = /* */ 0b0000000000000000000000010000000; +const TransitionLane3: Lane = /* */ 0b0000000000000000000000100000000; +const TransitionLane4: Lane = /* */ 0b0000000000000000000001000000000; +const TransitionLane5: Lane = /* */ 0b0000000000000000000010000000000; +const TransitionLane6: Lane = /* */ 0b0000000000000000000100000000000; +const TransitionLane7: Lane = /* */ 0b0000000000000000001000000000000; +const TransitionLane8: Lane = /* */ 0b0000000000000000010000000000000; +const TransitionLane9: Lane = /* */ 0b0000000000000000100000000000000; +const TransitionLane10: Lane = /* */ 0b0000000000000001000000000000000; +const TransitionLane11: Lane = /* */ 0b0000000000000010000000000000000; +const TransitionLane12: Lane = /* */ 0b0000000000000100000000000000000; +const TransitionLane13: Lane = /* */ 0b0000000000001000000000000000000; +const TransitionLane14: Lane = /* */ 0b0000000000010000000000000000000; +const TransitionLane15: Lane = /* */ 0b0000000000100000000000000000000; +const TransitionLane16: Lane = /* */ 0b0000000001000000000000000000000; + +const RetryLanes: Lanes = /* */ 0b0000111110000000000000000000000; +const RetryLane1: Lane = /* */ 0b0000000010000000000000000000000; +const RetryLane2: Lane = /* */ 0b0000000100000000000000000000000; +const RetryLane3: Lane = /* */ 0b0000001000000000000000000000000; +const RetryLane4: Lane = /* */ 0b0000010000000000000000000000000; +const RetryLane5: Lane = /* */ 0b0000100000000000000000000000000; export const SomeRetryLane: Lane = RetryLane1; -export const SelectiveHydrationLane: Lane = /* */ 0b000100000000000000000000000000; +export const SelectiveHydrationLane: Lane = /* */ 0b0001000000000000000000000000000; -const NonIdleLanes = /* */ 0b000111111111111111111111111111; +const NonIdleLanes = /* */ 0b0001111111111111111111111111111; -export const IdleHydrationLane: Lane = /* */ 0b001000000000000000000000000000; -const IdleLane: Lanes = /* */ 0b010000000000000000000000000000; +export const IdleHydrationLane: Lane = /* */ 0b0010000000000000000000000000000; +const IdleLane: Lanes = /* */ 0b0100000000000000000000000000000; -export const OffscreenLane: Lane = /* */ 0b100000000000000000000000000000; +export const OffscreenLane: Lane = /* */ 0b1000000000000000000000000000000; // This function is used for the experimental scheduling profiler (react-devtools-scheduling-profiler) // It should be kept in sync with the Lanes values above. @@ -226,6 +227,7 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { case RetryLane2: case RetryLane3: case RetryLane4: + case RetryLane5: return_highestLanePriority = RetryLanePriority; return lanes & RetryLanes; case SelectiveHydrationLane: