Skip to content

Commit

Permalink
[flags] Delete enableSchedulerDebugger
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Dec 17, 2024
1 parent facec3e commit 2987d7a
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 70 deletions.
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,
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
29 changes: 2 additions & 27 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
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

0 comments on commit 2987d7a

Please sign in to comment.