Skip to content

Commit 1e9ef39

Browse files
authored
[flags] Delete enableSchedulerDebugger (facebook#31826)
The tool for this isn't used so I killed it internally and we can clean up the code to make it easier to reduce the scheduler code.
1 parent 7eb8234 commit 1e9ef39

File tree

8 files changed

+8
-133
lines changed

8 files changed

+8
-133
lines changed

fixtures/scheduler/index.html

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,8 @@ <h2>Tests:</h2>
9191
<div> If the counter advanced while you were away from this tab, it's correct.</div>
9292
</li>
9393
<li>
94-
<p>Can pause execution, dump scheduled callbacks, and continue where it left off</p>
95-
<button onClick="runTestEight()">Run Test 8</button>
96-
<div><b>Click the button above, press "continue" to finish the test after it pauses:</b></div>
97-
<button onClick="continueTestEight()">continue</button>
98-
<div><b>Expected:</b></div>
99-
<div id="test-8-expected">
100-
</div>
101-
<div> -------------------------------------------------</div>
102-
<div> If the test didn't progress until you hit "continue" and </div>
103-
<div> you see the same above and below afterwards it's correct.
104-
<div> -------------------------------------------------</div>
105-
<div><b>Actual:</b></div>
106-
<div id="test-8"></div>
94+
<p>Test Eight Removed</p>
95+
<p>Test 8 was removed because it was testing a feature that was removed from the scheduler.</p>
10796
</li>
10897
<li>
10998
<p>Can force a specific framerate</p>
@@ -156,9 +145,6 @@ <h2>Tests:</h2>
156145
unstable_scheduleCallback: scheduleCallback,
157146
unstable_cancelCallback: cancelCallback,
158147
unstable_now: now,
159-
unstable_getFirstCallbackNode: getFirstCallbackNode,
160-
unstable_pauseExecution: pauseExecution,
161-
unstable_continueExecution: continueExecution,
162148
unstable_forceFrameRate: forceFrameRate,
163149
unstable_shouldYield: shouldYield,
164150
unstable_NormalPriority: NormalPriority,
@@ -587,50 +573,6 @@ <h2>Tests:</h2>
587573
scheduleCallback(NormalPriority, incrementCounterAndScheduleNextCallback);
588574
}
589575

590-
function runTestEight() {
591-
// Test 8
592-
// Pauses execution, dumps the queue, and continues execution
593-
clearTestResult(8);
594-
595-
function countNodesInStack(firstCallbackNode) {
596-
var node = firstCallbackNode;
597-
var count = 0;
598-
if (node !== null) {
599-
do {
600-
count = count + 1;
601-
node = node.next;
602-
} while (node !== firstCallbackNode);
603-
}
604-
return count;
605-
}
606-
607-
scheduleCallback(NormalPriority, () => {
608-
609-
// size should be 0
610-
updateTestResult(8, `Queue size: ${countNodesInStack(getFirstCallbackNode())}.`);
611-
updateTestResult(8, 'Pausing... press continue to resume.');
612-
pauseExecution();
613-
614-
scheduleCallback(NormalPriority, function () {
615-
updateTestResult(8, 'Finishing...');
616-
displayTestResult(8);
617-
})
618-
scheduleCallback(NormalPriority, function () {
619-
updateTestResult(8, 'Done!');
620-
displayTestResult(8);
621-
checkTestResult(8);
622-
})
623-
624-
// new size should be 2 now
625-
updateTestResult(8, `Queue size: ${countNodesInStack(getFirstCallbackNode())}.`);
626-
displayTestResult(8);
627-
});
628-
}
629-
630-
function continueTestEight() {
631-
continueExecution();
632-
}
633-
634576
function runTestNine() {
635577
clearTestResult(9);
636578
// We have this to make sure that the thing that goes right after it can get a full frame

packages/scheduler/src/SchedulerFeatureFlags.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* @flow strict
88
*/
99

10-
export const enableSchedulerDebugging = false;
1110
export const enableProfiling = false;
1211
export const frameYieldMs = 5;
1312

packages/scheduler/src/forks/Scheduler.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import type {PriorityLevel} from '../SchedulerPriorities';
1313

1414
import {
15-
enableSchedulerDebugging,
1615
enableProfiling,
1716
frameYieldMs,
1817
userBlockingPriorityTimeout,
@@ -83,9 +82,6 @@ var timerQueue: Array<Task> = [];
8382
// Incrementing id counter. Used to maintain insertion order.
8483
var taskIdCounter = 1;
8584

86-
// Pausing the scheduler is useful for debugging.
87-
var isSchedulerPaused = false;
88-
8985
var currentTask = null;
9086
var currentPriorityLevel = NormalPriority;
9187

@@ -193,10 +189,7 @@ function workLoop(initialTime: number) {
193189
let currentTime = initialTime;
194190
advanceTimers(currentTime);
195191
currentTask = peek(taskQueue);
196-
while (
197-
currentTask !== null &&
198-
!(enableSchedulerDebugging && isSchedulerPaused)
199-
) {
192+
while (currentTask !== null) {
200193
if (!enableAlwaysYieldScheduler) {
201194
if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
202195
// This currentTask hasn't expired, and we've reached the deadline.
@@ -422,22 +415,6 @@ function unstable_scheduleCallback(
422415
return newTask;
423416
}
424417

425-
function unstable_pauseExecution() {
426-
isSchedulerPaused = true;
427-
}
428-
429-
function unstable_continueExecution() {
430-
isSchedulerPaused = false;
431-
if (!isHostCallbackScheduled && !isPerformingWork) {
432-
isHostCallbackScheduled = true;
433-
requestHostCallback();
434-
}
435-
}
436-
437-
function unstable_getFirstCallbackNode(): Task | null {
438-
return peek(taskQueue);
439-
}
440-
441418
function unstable_cancelCallback(task: Task) {
442419
if (enableProfiling) {
443420
if (task.isQueued) {
@@ -606,9 +583,6 @@ export {
606583
unstable_getCurrentPriorityLevel,
607584
shouldYieldToHost as unstable_shouldYield,
608585
requestPaint as unstable_requestPaint,
609-
unstable_continueExecution,
610-
unstable_pauseExecution,
611-
unstable_getFirstCallbackNode,
612586
getCurrentTime as unstable_now,
613587
forceFrameRate as unstable_forceFrameRate,
614588
};

packages/scheduler/src/forks/SchedulerFeatureFlags.www.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const dynamicFeatureFlags = require('SchedulerFeatureFlags');
1212

1313
export const {enableRequestPaint} = dynamicFeatureFlags;
1414

15-
export const enableSchedulerDebugging = false;
1615
export const enableProfiling = __DEV__;
1716
export const frameYieldMs = 10;
1817

packages/scheduler/src/forks/SchedulerMock.js

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212

1313
import type {PriorityLevel} from '../SchedulerPriorities';
1414

15-
import {
16-
enableSchedulerDebugging,
17-
enableProfiling,
18-
} from '../SchedulerFeatureFlags';
15+
import {enableProfiling} from '../SchedulerFeatureFlags';
1916
import {push, pop, peek} from '../SchedulerMinHeap';
2017

2118
// TODO: Use symbols?
@@ -72,9 +69,6 @@ var timerQueue: Array<Task> = [];
7269
// Incrementing id counter. Used to maintain insertion order.
7370
var taskIdCounter = 1;
7471

75-
// Pausing the scheduler is useful for debugging.
76-
var isSchedulerPaused = false;
77-
7872
var currentTask = null;
7973
var currentPriorityLevel = NormalPriority;
8074

@@ -195,10 +189,7 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean {
195189
let currentTime = initialTime;
196190
advanceTimers(currentTime);
197191
currentTask = peek(taskQueue);
198-
while (
199-
currentTask !== null &&
200-
!(enableSchedulerDebugging && isSchedulerPaused)
201-
) {
192+
while (currentTask !== null) {
202193
if (
203194
currentTask.expirationTime > currentTime &&
204195
(!hasTimeRemaining || shouldYieldToHost())
@@ -422,22 +413,6 @@ function unstable_scheduleCallback(
422413
return newTask;
423414
}
424415

425-
function unstable_pauseExecution() {
426-
isSchedulerPaused = true;
427-
}
428-
429-
function unstable_continueExecution() {
430-
isSchedulerPaused = false;
431-
if (!isHostCallbackScheduled && !isPerformingWork) {
432-
isHostCallbackScheduled = true;
433-
requestHostCallback(flushWork);
434-
}
435-
}
436-
437-
function unstable_getFirstCallbackNode(): Task | null {
438-
return peek(taskQueue);
439-
}
440-
441416
function unstable_cancelCallback(task: Task) {
442417
if (enableProfiling) {
443418
if (task.isQueued) {
@@ -679,9 +654,6 @@ export {
679654
unstable_getCurrentPriorityLevel,
680655
shouldYieldToHost as unstable_shouldYield,
681656
requestPaint as unstable_requestPaint,
682-
unstable_continueExecution,
683-
unstable_pauseExecution,
684-
unstable_getFirstCallbackNode,
685657
getCurrentTime as unstable_now,
686658
forceFrameRate as unstable_forceFrameRate,
687659
unstable_flushAllWithoutAsserting,

packages/scheduler/src/forks/SchedulerNative.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ export const unstable_now: () => number | DOMHighResTimeStamp =
9797
export const unstable_next: any = throwNotImplemented;
9898
export const unstable_runWithPriority: any = throwNotImplemented;
9999
export const unstable_wrapCallback: any = throwNotImplemented;
100-
export const unstable_continueExecution: any = throwNotImplemented;
101-
export const unstable_pauseExecution: any = throwNotImplemented;
102-
export const unstable_getFirstCallbackNode: any = throwNotImplemented;
103100
export const unstable_forceFrameRate: any = throwNotImplemented;
104101
export const unstable_Profiling: any = null;
105102

packages/scheduler/src/forks/SchedulerPostTask.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,5 @@ export function unstable_wrapCallback<T>(callback: () => T): () => T {
234234

235235
export function unstable_forceFrameRate() {}
236236

237-
export function unstable_pauseExecution() {}
238-
239-
export function unstable_continueExecution() {}
240-
241-
export function unstable_getFirstCallbackNode(): null {
242-
return null;
243-
}
244-
245237
// Currently no profiling build
246238
export const unstable_Profiling = null;

scripts/jest/setupTests.www.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jest.mock('scheduler/src/SchedulerFeatureFlags', () => {
3434
schedulerSrcPath + '/src/forks/SchedulerFeatureFlags.www'
3535
);
3636

37-
// These flags are not a dynamic on www, but we still want to run
38-
// tests in both versions.
39-
actual.enableSchedulerDebugging = __VARIANT__;
37+
// Add flags here that are not a dynamic on www,
38+
// but we still want to run tests in both versions.
39+
// <this list is empty>
4040

4141
return actual;
4242
});

0 commit comments

Comments
 (0)