Skip to content

Commit

Permalink
Remove discrete lanes and priorities (#21040)
Browse files Browse the repository at this point in the history
We use SyncLane everywhere we used to use InputDiscreteLane or
InputDiscreteHydrationLane. So we can delete them now, along with their
associated lane priority levels.
  • Loading branch information
acdlite authored Mar 22, 2021
1 parent ca99ae9 commit dcdf8de
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ describe(preprocessData, () => {
{
componentStack: '',
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.005,
type: 'schedule-render',
},
Expand All @@ -413,7 +413,7 @@ describe(preprocessData, () => {
componentStack: '',
isCascading: false,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.013,
type: 'schedule-state-update',
},
Expand All @@ -425,7 +425,7 @@ describe(preprocessData, () => {
depth: 0,
duration: 0.004999999999999999,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.006,
type: 'render-idle',
},
Expand All @@ -434,7 +434,7 @@ describe(preprocessData, () => {
depth: 0,
duration: 0.001,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.006,
type: 'render',
},
Expand All @@ -443,7 +443,7 @@ describe(preprocessData, () => {
depth: 0,
duration: 0.002999999999999999,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.008,
type: 'commit',
},
Expand All @@ -452,7 +452,7 @@ describe(preprocessData, () => {
depth: 1,
duration: 0.0010000000000000009,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.009,
type: 'layout-effects',
},
Expand All @@ -461,7 +461,7 @@ describe(preprocessData, () => {
depth: 0,
duration: 0.002,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.012,
type: 'passive-effects',
},
Expand All @@ -470,7 +470,7 @@ describe(preprocessData, () => {
depth: 0,
duration: 0.005000000000000001,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.015,
type: 'render-idle',
},
Expand All @@ -479,7 +479,7 @@ describe(preprocessData, () => {
depth: 0,
duration: 0.0010000000000000009,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.015,
type: 'render',
},
Expand All @@ -488,7 +488,7 @@ describe(preprocessData, () => {
depth: 0,
duration: 0.002999999999999999,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.017,
type: 'commit',
},
Expand All @@ -497,7 +497,7 @@ describe(preprocessData, () => {
depth: 1,
duration: 0.0010000000000000009,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.018,
type: 'layout-effects',
},
Expand All @@ -506,7 +506,7 @@ describe(preprocessData, () => {
depth: 0,
duration: 0.0009999999999999974,
laneLabels: ['Default'],
lanes: [7],
lanes: [5],
timestamp: 0.021,
type: 'passive-effects',
},
Expand Down
9 changes: 2 additions & 7 deletions packages/react-dom/src/events/ReactDOMEventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ import {
} from './ReactDOMUpdateBatching';

import {
InputDiscreteLanePriority as InputDiscreteLanePriority_old,
InputContinuousLanePriority as InputContinuousLanePriority_old,
DefaultLanePriority as DefaultLanePriority_old,
getCurrentUpdateLanePriority as getCurrentUpdateLanePriority_old,
setCurrentUpdateLanePriority as setCurrentUpdateLanePriority_old,
} from 'react-reconciler/src/ReactFiberLane.old';
import {
InputDiscreteLanePriority as InputDiscreteLanePriority_new,
InputContinuousLanePriority as InputContinuousLanePriority_new,
DefaultLanePriority as DefaultLanePriority_new,
getCurrentUpdateLanePriority as getCurrentUpdateLanePriority_new,
Expand All @@ -75,9 +73,6 @@ import {
} from 'react-reconciler/src/SchedulerWithReactIntegration.new';
import type {LanePriority} from 'react-reconciler/src/ReactFiberLane.new';

const InputDiscreteLanePriority = enableNewReconciler
? InputDiscreteLanePriority_new
: InputDiscreteLanePriority_old;
const InputContinuousLanePriority = enableNewReconciler
? InputContinuousLanePriority_new
: InputContinuousLanePriority_old;
Expand Down Expand Up @@ -147,7 +142,7 @@ export function createEventListenerWrapperWithPriority(
const eventPriority = getEventPriority(domEventName);
let listenerWrapper;
switch (eventPriority) {
case InputDiscreteLanePriority:
case SyncLanePriority:
listenerWrapper = dispatchDiscreteEvent;
break;
case InputContinuousLanePriority:
Expand Down Expand Up @@ -412,7 +407,7 @@ export function getEventPriority(domEventName: DOMEventName): * {
case 'popstate':
case 'select':
case 'selectstart':
return InputDiscreteLanePriority;
return SyncLanePriority;
case 'drag':
case 'dragenter':
case 'dragexit':
Expand Down
79 changes: 28 additions & 51 deletions packages/react-reconciler/src/ReactFiberLane.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@ import {
NoPriority as NoSchedulerPriority,
} from './SchedulerWithReactIntegration.new';

export const SyncLanePriority: LanePriority = 15;
export const SyncBatchedLanePriority: LanePriority = 14;

const InputDiscreteHydrationLanePriority: LanePriority = 13;
export const InputDiscreteLanePriority: LanePriority = 12;
export const SyncLanePriority: LanePriority = 13;
export const SyncBatchedLanePriority: LanePriority = 12;

const InputContinuousHydrationLanePriority: LanePriority = 11;
export const InputContinuousLanePriority: LanePriority = 10;
Expand Down Expand Up @@ -83,31 +80,30 @@ export const NoLane: Lane = /* */ 0b0000000000000000000
export const SyncLane: Lane = /* */ 0b0000000000000000000000000000001;
export const SyncBatchedLane: Lane = /* */ 0b0000000000000000000000000000010;

export const InputDiscreteHydrationLane: Lane = /* */ 0b0000000000000000000000000000100;
export const InputDiscreteLane: Lanes = /* */ 0b0000000000000000000000000001000;

const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000010000;
export const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000000100000;

export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000001000000;
export const DefaultLane: Lanes = /* */ 0b0000000000000000000000010000000;

const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000100000000;
const TransitionLanes: Lanes = /* */ 0b0000000011111111111111000000000;
const TransitionLane1: Lane = /* */ 0b0000000000000000000001000000000;
const TransitionLane2: Lane = /* */ 0b0000000000000000000010000000000;
const TransitionLane3: Lane = /* */ 0b0000000000000000000100000000000;
const TransitionLane4: Lane = /* */ 0b0000000000000000001000000000000;
const TransitionLane5: Lane = /* */ 0b0000000000000000010000000000000;
const TransitionLane6: Lane = /* */ 0b0000000000000000100000000000000;
const TransitionLane7: Lane = /* */ 0b0000000000000001000000000000000;
const TransitionLane8: Lane = /* */ 0b0000000000000010000000000000000;
const TransitionLane9: Lane = /* */ 0b0000000000000100000000000000000;
const TransitionLane10: Lane = /* */ 0b0000000000001000000000000000000;
const TransitionLane11: Lane = /* */ 0b0000000000010000000000000000000;
const TransitionLane12: Lane = /* */ 0b0000000000100000000000000000000;
const TransitionLane13: Lane = /* */ 0b0000000001000000000000000000000;
const TransitionLane14: Lane = /* */ 0b0000000010000000000000000000000;
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;
Expand Down Expand Up @@ -137,12 +133,6 @@ export function getLabelsForLanes(lanes: Lanes): Array<string> | void {
if (lanes & SyncBatchedLane) {
labels.push('SyncBatched');
}
if (lanes & InputDiscreteHydrationLane) {
labels.push('InputDiscreteHydration');
}
if (lanes & InputDiscreteLane) {
labels.push('InputDiscrete');
}
if (lanes & InputContinuousHydrationLane) {
labels.push('InputContinuousHydration');
}
Expand Down Expand Up @@ -207,12 +197,6 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
case SyncBatchedLane:
return_highestLanePriority = SyncBatchedLanePriority;
return SyncBatchedLane;
case InputDiscreteHydrationLane:
return_highestLanePriority = InputDiscreteHydrationLanePriority;
return InputDiscreteHydrationLane;
case InputDiscreteLane:
return_highestLanePriority = InputDiscreteLanePriority;
return InputDiscreteLane;
case InputContinuousHydrationLane:
return_highestLanePriority = InputContinuousHydrationLanePriority;
return InputContinuousHydrationLane;
Expand Down Expand Up @@ -242,6 +226,8 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
case TransitionLane12:
case TransitionLane13:
case TransitionLane14:
case TransitionLane15:
case TransitionLane16:
return_highestLanePriority = TransitionPriority;
return lanes & TransitionLanes;
case RetryLane1:
Expand Down Expand Up @@ -281,8 +267,6 @@ export function lanePriorityToSchedulerPriority(
case SyncLanePriority:
case SyncBatchedLanePriority:
return ImmediateSchedulerPriority;
case InputDiscreteHydrationLanePriority:
case InputDiscreteLanePriority:
case InputContinuousHydrationLanePriority:
case InputContinuousLanePriority:
return UserBlockingSchedulerPriority;
Expand Down Expand Up @@ -565,8 +549,6 @@ export function findUpdateLane(lanePriority: LanePriority): Lane {
return SyncLane;
case SyncBatchedLanePriority:
return SyncBatchedLane;
case InputDiscreteLanePriority:
return SyncLane;
case InputContinuousLanePriority:
return InputContinuousLane;
case DefaultLanePriority:
Expand Down Expand Up @@ -826,11 +808,6 @@ export function getBumpedLaneForHydration(
case SyncBatchedLanePriority:
lane = NoLane;
break;
case InputDiscreteHydrationLanePriority:
case InputDiscreteLanePriority:
lane = InputDiscreteHydrationLane;
break;
case InputContinuousHydrationLanePriority:
case InputContinuousLanePriority:
lane = InputContinuousHydrationLane;
break;
Expand Down
Loading

0 comments on commit dcdf8de

Please sign in to comment.