@@ -15,11 +15,6 @@ import * as Scheduler from 'scheduler';
15
15
import { __interactionsRef } from 'scheduler/tracing' ;
16
16
import { enableSchedulerTracing } from 'shared/ReactFeatureFlags' ;
17
17
import invariant from 'shared/invariant' ;
18
- import {
19
- DiscreteEventPriority ,
20
- getCurrentUpdatePriority ,
21
- setCurrentUpdatePriority ,
22
- } from './ReactEventPriorities.new' ;
23
18
24
19
export const scheduleCallback = Scheduler . unstable_scheduleCallback ;
25
20
export const cancelCallback = Scheduler . unstable_cancelCallback ;
@@ -49,54 +44,3 @@ if (enableSchedulerTracing) {
49
44
}
50
45
51
46
export type SchedulerCallback = ( isSync : boolean ) => SchedulerCallback | null ;
52
-
53
- // TODO: Move sync task queue to its own module.
54
- let syncQueue : Array < SchedulerCallback > | null = null ;
55
- let isFlushingSyncQueue : boolean = false ;
56
-
57
- export function scheduleSyncCallback ( callback : SchedulerCallback ) {
58
- // Push this callback into an internal queue. We'll flush these either in
59
- // the next tick, or earlier if something calls `flushSyncCallbackQueue`.
60
- if ( syncQueue === null ) {
61
- syncQueue = [ callback ] ;
62
- } else {
63
- // Push onto existing queue. Don't need to schedule a callback because
64
- // we already scheduled one when we created the queue.
65
- syncQueue . push ( callback ) ;
66
- }
67
- }
68
-
69
- export function flushSyncCallbackQueue ( ) {
70
- if ( ! isFlushingSyncQueue && syncQueue !== null ) {
71
- // Prevent re-entrancy.
72
- isFlushingSyncQueue = true ;
73
- let i = 0 ;
74
- const previousUpdatePriority = getCurrentUpdatePriority ( ) ;
75
- try {
76
- const isSync = true ;
77
- const queue = syncQueue ;
78
- // TODO: Is this necessary anymore? The only user code that runs in this
79
- // queue is in the render or commit phases.
80
- setCurrentUpdatePriority ( DiscreteEventPriority ) ;
81
- for ( ; i < queue . length ; i ++ ) {
82
- let callback = queue [ i ] ;
83
- do {
84
- callback = callback ( isSync ) ;
85
- } while ( callback !== null ) ;
86
- }
87
- syncQueue = null ;
88
- } catch ( error ) {
89
- // If something throws, leave the remaining callbacks on the queue.
90
- if ( syncQueue !== null ) {
91
- syncQueue = syncQueue . slice ( i + 1 ) ;
92
- }
93
- // Resume flushing in the next tick
94
- scheduleCallback ( ImmediatePriority , flushSyncCallbackQueue ) ;
95
- throw error ;
96
- } finally {
97
- setCurrentUpdatePriority ( previousUpdatePriority ) ;
98
- isFlushingSyncQueue = false ;
99
- }
100
- }
101
- return null ;
102
- }
0 commit comments