Disable (unstable) scheduler sampling profiler for OSS builds (#20832)

* Disabled Scheduler sampling profiler for OSS builds
* Added missing conditional feature flag around profiling calls
This commit is contained in:
Brian Vaughn
2021-02-18 11:06:53 -05:00
committed by Dan Abramov
parent 8cc6ff2488
commit b2bbee7ba3
3 changed files with 9 additions and 4 deletions
+6 -2
View File
@@ -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);
@@ -8,4 +8,4 @@
export const enableSchedulerDebugging = false;
export const enableIsInputPending = false;
export const enableProfiling = __PROFILE__;
export const enableProfiling = false;
@@ -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');