Skip to content

[flags] Delete enableSchedulerDebugger #31826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 2 additions & 60 deletions fixtures/scheduler/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,8 @@ <h2>Tests:</h2>
<div> If the counter advanced while you were away from this tab, it's correct.</div>
</li>
<li>
<p>Can pause execution, dump scheduled callbacks, and continue where it left off</p>
<button onClick="runTestEight()">Run Test 8</button>
<div><b>Click the button above, press "continue" to finish the test after it pauses:</b></div>
<button onClick="continueTestEight()">continue</button>
<div><b>Expected:</b></div>
<div id="test-8-expected">
</div>
<div> -------------------------------------------------</div>
<div> If the test didn't progress until you hit "continue" and </div>
<div> you see the same above and below afterwards it's correct.
<div> -------------------------------------------------</div>
<div><b>Actual:</b></div>
<div id="test-8"></div>
<p>Test Eight Removed</p>
<p>Test 8 was removed because it was testing a feature that was removed from the scheduler.</p>
</li>
<li>
<p>Can force a specific framerate</p>
Expand Down Expand Up @@ -156,9 +145,6 @@ <h2>Tests:</h2>
unstable_scheduleCallback: scheduleCallback,
unstable_cancelCallback: cancelCallback,
unstable_now: now,
unstable_getFirstCallbackNode: getFirstCallbackNode,
unstable_pauseExecution: pauseExecution,
unstable_continueExecution: continueExecution,
unstable_forceFrameRate: forceFrameRate,
unstable_shouldYield: shouldYield,
unstable_NormalPriority: NormalPriority,
Expand Down Expand Up @@ -587,50 +573,6 @@ <h2>Tests:</h2>
scheduleCallback(NormalPriority, incrementCounterAndScheduleNextCallback);
}

function runTestEight() {
// Test 8
// Pauses execution, dumps the queue, and continues execution
clearTestResult(8);

function countNodesInStack(firstCallbackNode) {
var node = firstCallbackNode;
var count = 0;
if (node !== null) {
do {
count = count + 1;
node = node.next;
} while (node !== firstCallbackNode);
}
return count;
}

scheduleCallback(NormalPriority, () => {

// size should be 0
updateTestResult(8, `Queue size: ${countNodesInStack(getFirstCallbackNode())}.`);
updateTestResult(8, 'Pausing... press continue to resume.');
pauseExecution();

scheduleCallback(NormalPriority, function () {
updateTestResult(8, 'Finishing...');
displayTestResult(8);
})
scheduleCallback(NormalPriority, function () {
updateTestResult(8, 'Done!');
displayTestResult(8);
checkTestResult(8);
})

// new size should be 2 now
updateTestResult(8, `Queue size: ${countNodesInStack(getFirstCallbackNode())}.`);
displayTestResult(8);
});
}

function continueTestEight() {
continueExecution();
}

function runTestNine() {
clearTestResult(9);
// We have this to make sure that the thing that goes right after it can get a full frame
Expand Down
1 change: 0 additions & 1 deletion packages/scheduler/src/SchedulerFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* @flow strict
*/

export const enableSchedulerDebugging = false;
export const enableProfiling = false;
export const frameYieldMs = 5;

Expand Down
28 changes: 1 addition & 27 deletions packages/scheduler/src/forks/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import type {PriorityLevel} from '../SchedulerPriorities';

import {
enableSchedulerDebugging,
enableProfiling,
frameYieldMs,
userBlockingPriorityTimeout,
Expand Down Expand Up @@ -83,9 +82,6 @@ var timerQueue: Array<Task> = [];
// Incrementing id counter. Used to maintain insertion order.
var taskIdCounter = 1;

// Pausing the scheduler is useful for debugging.
var isSchedulerPaused = false;

var currentTask = null;
var currentPriorityLevel = NormalPriority;

Expand Down Expand Up @@ -193,10 +189,7 @@ function workLoop(initialTime: number) {
let currentTime = initialTime;
advanceTimers(currentTime);
currentTask = peek(taskQueue);
while (
currentTask !== null &&
!(enableSchedulerDebugging && isSchedulerPaused)
) {
while (currentTask !== null) {
if (!enableAlwaysYieldScheduler) {
if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
// This currentTask hasn't expired, and we've reached the deadline.
Expand Down Expand Up @@ -422,22 +415,6 @@ function unstable_scheduleCallback(
return newTask;
}

function unstable_pauseExecution() {
isSchedulerPaused = true;
}

function unstable_continueExecution() {
isSchedulerPaused = false;
if (!isHostCallbackScheduled && !isPerformingWork) {
isHostCallbackScheduled = true;
requestHostCallback();
}
}

function unstable_getFirstCallbackNode(): Task | null {
return peek(taskQueue);
}

function unstable_cancelCallback(task: Task) {
if (enableProfiling) {
if (task.isQueued) {
Expand Down Expand Up @@ -606,9 +583,6 @@ export {
unstable_getCurrentPriorityLevel,
shouldYieldToHost as unstable_shouldYield,
requestPaint as unstable_requestPaint,
unstable_continueExecution,
unstable_pauseExecution,
unstable_getFirstCallbackNode,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk if it's ok to delete these methods or if we should keep them around as noops, seems like something you would have an opinion on @acdlite

getCurrentTime as unstable_now,
forceFrameRate as unstable_forceFrameRate,
};
Expand Down
1 change: 0 additions & 1 deletion packages/scheduler/src/forks/SchedulerFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const dynamicFeatureFlags = require('SchedulerFeatureFlags');

export const {enableRequestPaint} = dynamicFeatureFlags;

export const enableSchedulerDebugging = false;
export const enableProfiling = __DEV__;
export const frameYieldMs = 10;

Expand Down
32 changes: 2 additions & 30 deletions packages/scheduler/src/forks/SchedulerMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@

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

import {
enableSchedulerDebugging,
enableProfiling,
} from '../SchedulerFeatureFlags';
import {enableProfiling} from '../SchedulerFeatureFlags';
import {push, pop, peek} from '../SchedulerMinHeap';

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

// Pausing the scheduler is useful for debugging.
var isSchedulerPaused = false;

var currentTask = null;
var currentPriorityLevel = NormalPriority;

Expand Down Expand Up @@ -195,10 +189,7 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean {
let currentTime = initialTime;
advanceTimers(currentTime);
currentTask = peek(taskQueue);
while (
currentTask !== null &&
!(enableSchedulerDebugging && isSchedulerPaused)
) {
while (currentTask !== null) {
if (
currentTask.expirationTime > currentTime &&
(!hasTimeRemaining || shouldYieldToHost())
Expand Down Expand Up @@ -422,22 +413,6 @@ function unstable_scheduleCallback(
return newTask;
}

function unstable_pauseExecution() {
isSchedulerPaused = true;
}

function unstable_continueExecution() {
isSchedulerPaused = false;
if (!isHostCallbackScheduled && !isPerformingWork) {
isHostCallbackScheduled = true;
requestHostCallback(flushWork);
}
}

function unstable_getFirstCallbackNode(): Task | null {
return peek(taskQueue);
}

function unstable_cancelCallback(task: Task) {
if (enableProfiling) {
if (task.isQueued) {
Expand Down Expand Up @@ -679,9 +654,6 @@ export {
unstable_getCurrentPriorityLevel,
shouldYieldToHost as unstable_shouldYield,
requestPaint as unstable_requestPaint,
unstable_continueExecution,
unstable_pauseExecution,
unstable_getFirstCallbackNode,
getCurrentTime as unstable_now,
forceFrameRate as unstable_forceFrameRate,
unstable_flushAllWithoutAsserting,
Expand Down
3 changes: 0 additions & 3 deletions packages/scheduler/src/forks/SchedulerNative.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ export const unstable_now: () => number | DOMHighResTimeStamp =
export const unstable_next: any = throwNotImplemented;
export const unstable_runWithPriority: any = throwNotImplemented;
export const unstable_wrapCallback: any = throwNotImplemented;
export const unstable_continueExecution: any = throwNotImplemented;
export const unstable_pauseExecution: any = throwNotImplemented;
export const unstable_getFirstCallbackNode: any = throwNotImplemented;
export const unstable_forceFrameRate: any = throwNotImplemented;
export const unstable_Profiling: any = null;

Expand Down
8 changes: 0 additions & 8 deletions packages/scheduler/src/forks/SchedulerPostTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,5 @@ export function unstable_wrapCallback<T>(callback: () => T): () => T {

export function unstable_forceFrameRate() {}

export function unstable_pauseExecution() {}

export function unstable_continueExecution() {}

export function unstable_getFirstCallbackNode(): null {
return null;
}

// Currently no profiling build
export const unstable_Profiling = null;
6 changes: 3 additions & 3 deletions scripts/jest/setupTests.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jest.mock('scheduler/src/SchedulerFeatureFlags', () => {
schedulerSrcPath + '/src/forks/SchedulerFeatureFlags.www'
);

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

return actual;
});
Expand Down
Loading