[Scheduler] Add names to inline functions (#16180)
Noticed when looking at the performance profiler with Luna that it's hard to tell which event causes `performWorkUntilDeadline` to fire because these functions are anonymous.
Andrew Clark committed
Jul 23, 2019 at 11:08 UTC
19354db511e74d96a1c8b6d8b589a72f025da498
1 file changed
+10
-8
packages/scheduler/src/forks/SchedulerHostConfig.default.js
+10
-8
@@ -326,13 +326,15 @@ if (
326
// rAFs are scheduled at the beginning of the preceding frame.
327
let idleCallbackID;
328
if (requestIdleCallbackBeforeFirstFrame) {
329
- idleCallbackID = requestIdleCallback(() => {
330
- if (requestTimerEventBeforeFirstFrame) {
331
- clearTimeout(idleTimeoutID);
332
- }
333
- frameDeadline = getCurrentTime() + frameLength;
334
- performWorkUntilDeadline();
335
- });
329
+ idleCallbackID = requestIdleCallback(
330
+ function onIdleCallbackBeforeFirstFrame() {
331
+ if (requestTimerEventBeforeFirstFrame) {
332
+ clearTimeout(idleTimeoutID);
333
+ }
334
+ frameDeadline = getCurrentTime() + frameLength;
335
+ performWorkUntilDeadline();
336
+ },
337
+ );
338
}
339
// Alternate strategy to address the same problem. Scheduler a timer with
340
// no delay. If this fires before the rAF, that likely indicates that
@@ -341,7 +343,7 @@ if (
343
// idle periods.
344
let idleTimeoutID;
345
if (requestTimerEventBeforeFirstFrame) {
344
- idleTimeoutID = setTimeout(() => {
346
+ idleTimeoutID = setTimeout(function onTimerEventBeforeFirstFrame() {
347
if (requestIdleCallbackBeforeFirstFrame) {
348
cancelIdleCallback(idleCallbackID);
349
}