@samitouri / QOS-React-2 / commits / 962dfc2c33

Remove experimental scheduler flags (#16672)

Dan Abramov committed Sep 5, 2019 at 20:08 UTC 962dfc2c33710b880d90ba8db4f531040077d48e
3 files changed -54
packages/scheduler/src/SchedulerFeatureFlags.js
-2
@@ -8,7 +8,5 @@
8
9 export const enableSchedulerDebugging = false;
10 export const enableIsInputPending = false;
11 -export const requestIdleCallbackBeforeFirstFrame = false;
12 -export const requestTimerEventBeforeFirstFrame = false;
11 export const enableMessageLoopImplementation = true;
12 export const enableProfiling = __PROFILE__;
packages/scheduler/src/forks/SchedulerFeatureFlags.www.js
-2
@@ -12,6 +12,4 @@ export const {
12 } = require('SchedulerFeatureFlags');
13
14 export const enableProfiling = __PROFILE__;
15 -export const requestIdleCallbackBeforeFirstFrame = false;
16 -export const requestTimerEventBeforeFirstFrame = false;
15 export const enableMessageLoopImplementation = true;
packages/scheduler/src/forks/SchedulerHostConfig.default.js
-50
@@ -7,8 +7,6 @@
7
8 import {
9 enableIsInputPending,
10 - requestIdleCallbackBeforeFirstFrame as requestIdleCallbackBeforeFirstFrameFlag,
11 - requestTimerEventBeforeFirstFrame,
10 enableMessageLoopImplementation,
11 } from '../SchedulerFeatureFlags';
12
@@ -87,7 +85,6 @@ if (
85 const clearTimeout = window.clearTimeout;
86 const requestAnimationFrame = window.requestAnimationFrame;
87 const cancelAnimationFrame = window.cancelAnimationFrame;
90 - const requestIdleCallback = window.requestIdleCallback;
88
89 if (typeof console !== 'undefined') {
90 // TODO: Remove fb.me link
@@ -107,11 +104,6 @@ if (
104 }
105 }
106
110 - const requestIdleCallbackBeforeFirstFrame =
111 - requestIdleCallbackBeforeFirstFrameFlag &&
112 - typeof requestIdleCallback === 'function' &&
113 - typeof cancelIdleCallback === 'function';
114 -
107 if (
108 typeof performance === 'object' &&
109 typeof performance.now === 'function'
@@ -359,50 +351,8 @@ if (
351 // Start a rAF loop.
352 isRAFLoopRunning = true;
353 requestAnimationFrame(rAFTime => {
362 - if (requestIdleCallbackBeforeFirstFrame) {
363 - cancelIdleCallback(idleCallbackID);
364 - }
365 - if (requestTimerEventBeforeFirstFrame) {
366 - clearTimeout(idleTimeoutID);
367 - }
354 onAnimationFrame(rAFTime);
355 });
370 -
371 - // If we just missed the last vsync, the next rAF might not happen for
372 - // another frame. To claim as much idle time as possible, post a
373 - // callback with `requestIdleCallback`, which should fire if there's
374 - // idle time left in the frame.
375 - //
376 - // This should only be an issue for the first rAF in the loop;
377 - // subsequent rAFs are scheduled at the beginning of the
378 - // preceding frame.
379 - let idleCallbackID;
380 - if (requestIdleCallbackBeforeFirstFrame) {
381 - idleCallbackID = requestIdleCallback(
382 - function onIdleCallbackBeforeFirstFrame() {
383 - if (requestTimerEventBeforeFirstFrame) {
384 - clearTimeout(idleTimeoutID);
385 - }
386 - frameDeadline = getCurrentTime() + frameLength;
387 - performWorkUntilDeadline();
388 - },
389 - );
390 - }
391 - // Alternate strategy to address the same problem. Scheduler a timer
392 - // with no delay. If this fires before the rAF, that likely indicates
393 - // that there's idle time before the next vsync. This isn't always the
394 - // case, but we'll be aggressive and assume it is, as a trade off to
395 - // prevent idle periods.
396 - let idleTimeoutID;
397 - if (requestTimerEventBeforeFirstFrame) {
398 - idleTimeoutID = setTimeout(function onTimerEventBeforeFirstFrame() {
399 - if (requestIdleCallbackBeforeFirstFrame) {
400 - cancelIdleCallback(idleCallbackID);
401 - }
402 - frameDeadline = getCurrentTime() + frameLength;
403 - performWorkUntilDeadline();
404 - }, 0);
405 - }
356 }
357 }
358 };