Skip to content

Commit

Permalink
clean up isInputPending in Scheduler (#28444)
Browse files Browse the repository at this point in the history
## Summary

`isInputPending` is not in use. This PR cleans up the flags controlling
its gating and parameters to simplify Scheduler.

Makes `frameYieldMs` feature flag static, set to 10ms in www, which we
found built on the wins provided by a broader yield interval via
`isInputPending`. Flag remains set to 5ms in OSS builds.

## How did you test this change?
`yarn test Scheduler`

DiffTrain build for commit 3bcd2de.
  • Loading branch information
noahlemen committed Feb 27, 2024
1 parent 54a10b4 commit ae4690b
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25733,7 +25733,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "18.3.0-canary-172a7f629-20240226";
var ReactVersion = "18.3.0-canary-3bcd2de01-20240227";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9171,7 +9171,7 @@ var devToolsConfig$jscomp$inline_1014 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-172a7f629-20240226",
version: "18.3.0-canary-3bcd2de01-20240227",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1195 = {
Expand Down Expand Up @@ -9202,7 +9202,7 @@ var internals$jscomp$inline_1195 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-172a7f629-20240226"
reconcilerVersion: "18.3.0-canary-3bcd2de01-20240227"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1196 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9599,7 +9599,7 @@ var devToolsConfig$jscomp$inline_1056 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-172a7f629-20240226",
version: "18.3.0-canary-3bcd2de01-20240227",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1236 = {
Expand Down Expand Up @@ -9630,7 +9630,7 @@ var internals$jscomp$inline_1236 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-172a7f629-20240226"
reconcilerVersion: "18.3.0-canary-3bcd2de01-20240227"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1237 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (__DEV__) {
}
var dynamicFlags = require("ReactNativeInternalFeatureFlags");

var ReactVersion = "18.3.0-canary-172a7f629-20240226";
var ReactVersion = "18.3.0-canary-3bcd2de01-20240227";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,4 +598,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-172a7f629-20240226";
exports.version = "18.3.0-canary-3bcd2de01-20240227";
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-172a7f629-20240226";
exports.version = "18.3.0-canary-3bcd2de01-20240227";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<329119982dc400f73a57d3f8fddc6fb4>>
* @generated SignedSource<<58af4bb9ea8656229bd048421236ac87>>
*/

"use strict";
Expand Down Expand Up @@ -162,12 +162,6 @@ if (__DEV__) {
var localSetImmediate =
typeof setImmediate !== "undefined" ? setImmediate : null; // IE and Node.js + jsdom

typeof navigator !== "undefined" && // $FlowFixMe[prop-missing]
navigator.scheduling !== undefined && // $FlowFixMe[incompatible-type]
navigator.scheduling.isInputPending !== undefined
? navigator.scheduling.isInputPending.bind(navigator.scheduling)
: null;

function advanceTimers(currentTime) {
// Check for tasks that are no longer delayed and add them to the queue.
var timer = peek(timerQueue);
Expand Down Expand Up @@ -490,7 +484,7 @@ if (__DEV__) {
// The main thread has only been blocked for a really short amount of time;
// smaller than a single frame. Don't yield yet.
return false;
} // The main thread has been blocked for a non-negligible amount of time. We
} // Yield now.

return true;
}
Expand Down Expand Up @@ -540,7 +534,7 @@ if (__DEV__) {
isMessageLoopRunning = false;
}
}
} // Yielding to the browser will give it a chance to paint, so we can
}
};

var schedulePerformWorkUntilDeadline;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<cd7ed3a069445a95189053c07769d208>>
* @generated SignedSource<<cff8a50048229c976ba8e49d76cca4f5>>
*/

"use strict";
Expand Down Expand Up @@ -83,11 +83,6 @@ var taskQueue = [],
localSetTimeout = "function" === typeof setTimeout ? setTimeout : null,
localClearTimeout = "function" === typeof clearTimeout ? clearTimeout : null,
localSetImmediate = "undefined" !== typeof setImmediate ? setImmediate : null;
"undefined" !== typeof navigator &&
void 0 !== navigator.scheduling &&
void 0 !== navigator.scheduling.isInputPending
? navigator.scheduling.isInputPending.bind(navigator.scheduling)
: null;
function advanceTimers(currentTime) {
for (var timer = peek(timerQueue); null !== timer; ) {
if (null === timer.callback) pop(timerQueue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<685fe42d89ad677c0374d643bebb57cd>>
* @generated SignedSource<<2a1458dad9404c5aa87cab9701762eca>>
*/

"use strict";
Expand Down Expand Up @@ -87,11 +87,6 @@ var taskQueue = [],
localSetTimeout = "function" === typeof setTimeout ? setTimeout : null,
localClearTimeout = "function" === typeof clearTimeout ? clearTimeout : null,
localSetImmediate = "undefined" !== typeof setImmediate ? setImmediate : null;
"undefined" !== typeof navigator &&
void 0 !== navigator.scheduling &&
void 0 !== navigator.scheduling.isInputPending
? navigator.scheduling.isInputPending.bind(navigator.scheduling)
: null;
function advanceTimers(currentTime) {
for (var timer = peek(timerQueue); null !== timer; ) {
if (null === timer.callback) pop(timerQueue);
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
172a7f629a972fedb9e43fbae4fad0e9b1dc7fee
3bcd2de01b5716202eabe8faa338f51bdc59ce26

0 comments on commit ae4690b

Please sign in to comment.