From b2bbee7ba31bb7d212a9ff2e682a695a32f8a87f Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Thu, 18 Feb 2021 11:06:53 -0500 Subject: [PATCH] Disable (unstable) scheduler sampling profiler for OSS builds (#20832) * Disabled Scheduler sampling profiler for OSS builds * Added missing conditional feature flag around profiling calls --- packages/scheduler/src/Scheduler.js | 8 ++++++-- packages/scheduler/src/SchedulerFeatureFlags.js | 2 +- .../scheduler/src/__tests__/SchedulerProfiling-test.js | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/scheduler/src/Scheduler.js b/packages/scheduler/src/Scheduler.js index 9162da0a0875c..efcc01fa6805a 100644 --- a/packages/scheduler/src/Scheduler.js +++ b/packages/scheduler/src/Scheduler.js @@ -181,12 +181,16 @@ function workLoop(hasTimeRemaining, initialTime) { currentTask.callback = null; currentPriorityLevel = currentTask.priorityLevel; const didUserCallbackTimeout = currentTask.expirationTime <= currentTime; - markTaskRun(currentTask, currentTime); + if (enableProfiling) { + markTaskRun(currentTask, currentTime); + } const continuationCallback = callback(didUserCallbackTimeout); currentTime = getCurrentTime(); if (typeof continuationCallback === 'function') { currentTask.callback = continuationCallback; - markTaskYield(currentTask, currentTime); + if (enableProfiling) { + markTaskYield(currentTask, currentTime); + } } else { if (enableProfiling) { markTaskCompleted(currentTask, currentTime); diff --git a/packages/scheduler/src/SchedulerFeatureFlags.js b/packages/scheduler/src/SchedulerFeatureFlags.js index 848c299dd6df4..9b9deeb63ec1c 100644 --- a/packages/scheduler/src/SchedulerFeatureFlags.js +++ b/packages/scheduler/src/SchedulerFeatureFlags.js @@ -8,4 +8,4 @@ export const enableSchedulerDebugging = false; export const enableIsInputPending = false; -export const enableProfiling = __PROFILE__; +export const enableProfiling = false; diff --git a/packages/scheduler/src/__tests__/SchedulerProfiling-test.js b/packages/scheduler/src/__tests__/SchedulerProfiling-test.js index cf9f9c5ea8cd8..b7828b14487fd 100644 --- a/packages/scheduler/src/__tests__/SchedulerProfiling-test.js +++ b/packages/scheduler/src/__tests__/SchedulerProfiling-test.js @@ -44,7 +44,8 @@ function priorityLevelToString(priorityLevel) { } describe('Scheduler', () => { - if (!__PROFILE__) { + const {enableProfiling} = require('scheduler/src/SchedulerFeatureFlags'); + if (!enableProfiling) { // The tests in this suite only apply when profiling is on it('profiling APIs are not available', () => { Scheduler = require('scheduler');