Move reporting of long tasks to before updating rendering (#46252)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46252

Changelog: [internal]

The long task API should only account for work specifically done by the task. Updating the rendering shouldn't be considered for that, so this moves the determination of long tasks before doing that work.

Reviewed By: sammy-SC, rshest

Differential Revision: D61939261

fbshipit-source-id: 6d2573d561d507dff60b9703e4cc90ce4d131960
This commit is contained in:
Rubén Norte
2024-08-29 12:28:15 -07:00
committed by Facebook GitHub Bot
parent 8501b6396b
commit a0909efbec
@@ -335,17 +335,17 @@ void RuntimeScheduler_Modern::runEventLoopTick(
performMicrotaskCheckpoint(runtime);
}
if (ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop()) {
// "Update the rendering" step.
updateRendering();
}
if (ReactNativeFeatureFlags::enableLongTaskAPI()) {
auto taskEndTime = now_();
markYieldingOpportunity(taskEndTime);
reportLongTasks(task, taskStartTime, taskEndTime);
}
if (ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop()) {
// "Update the rendering" step.
updateRendering();
}
currentTask_ = nullptr;
}