From ae4690b594daccb1069475b89b00d9e5fe7f929e Mon Sep 17 00:00:00 2001 From: noahlemen Date: Tue, 27 Feb 2024 15:43:16 +0000 Subject: [PATCH] clean up isInputPending in Scheduler (#28444) ## 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 https://github.com/facebook/react/commit/3bcd2de01b5716202eabe8faa338f51bdc59ce26. --- .../react-test-renderer/cjs/ReactTestRenderer-dev.js | 2 +- .../cjs/ReactTestRenderer-prod.js | 4 ++-- .../cjs/ReactTestRenderer-profiling.js | 4 ++-- .../js/RKJSModules/vendor/react/cjs/React-dev.js | 2 +- .../js/RKJSModules/vendor/react/cjs/React-prod.js | 2 +- .../RKJSModules/vendor/react/cjs/React-profiling.js | 2 +- .../vendor/scheduler/cjs/Scheduler-dev.js | 12 +++--------- .../vendor/scheduler/cjs/Scheduler-prod.js | 7 +------ .../vendor/scheduler/cjs/Scheduler-profiling.js | 7 +------ .../react-native-github/Libraries/Renderer/REVISION | 2 +- 10 files changed, 14 insertions(+), 30 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index f59aed740ce08..b896db939395e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -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. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index 89d422dd78e72..d4f9d6863fb16 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -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 = { @@ -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__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index f8fd1679d89ee..b9d7425f77b44 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -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 = { @@ -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__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index fad1985a6a5b0..ff2aafca528dd 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -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, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index f630897b75ee8..b567547c0cdca 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -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"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index 0912679d8d9fe..8deb7f999421b 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -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 && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-dev.js index 68a05076e9ad9..58701090969d8 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<329119982dc400f73a57d3f8fddc6fb4>> + * @generated SignedSource<<58af4bb9ea8656229bd048421236ac87>> */ "use strict"; @@ -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); @@ -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; } @@ -540,7 +534,7 @@ if (__DEV__) { isMessageLoopRunning = false; } } - } // Yielding to the browser will give it a chance to paint, so we can + } }; var schedulePerformWorkUntilDeadline; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-prod.js index 8f3dcfe6a92c0..0d778bbd21653 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -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); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-profiling.js index a83cfd3fb74f2..d6340e772e0e6 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/scheduler/cjs/Scheduler-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<685fe42d89ad677c0374d643bebb57cd>> + * @generated SignedSource<<2a1458dad9404c5aa87cab9701762eca>> */ "use strict"; @@ -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); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index e9a3b433580e9..6869e9e07b1f3 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -172a7f629a972fedb9e43fbae4fad0e9b1dc7fee +3bcd2de01b5716202eabe8faa338f51bdc59ce26