Bug 1957994 - worker background state change should update timeout manager backgound state, r=smaug
call TimeoutManager::UpdateBackgroundState() in order to schedule the TimeoutExecutor in case the throttling is enabled and MinSchedulingDelay() is changed Differential Revision: https://phabricator.services.mozilla.com/D244184
This commit is contained in:
@@ -4531,6 +4531,15 @@ bool WorkerPrivate::ChangeBackgroundStateInternal(bool aIsBackground) {
|
||||
AssertIsOnWorkerThread();
|
||||
mIsInBackground = aIsBackground;
|
||||
auto data = mWorkerThreadAccessible.Access();
|
||||
if (StaticPrefs::dom_workers_timeoutmanager_AtStartup() &&
|
||||
StaticPrefs::dom_workers_throttling_enabled_AtStartup()) {
|
||||
auto* timeoutManager =
|
||||
data->mScope ? data->mScope->GetTimeoutManager() : nullptr;
|
||||
if (timeoutManager) {
|
||||
timeoutManager->UpdateBackgroundState();
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t index = 0; index < data->mChildWorkers.Length(); index++) {
|
||||
if (aIsBackground) {
|
||||
data->mChildWorkers[index]->SetIsRunningInBackground();
|
||||
|
||||
Reference in New Issue
Block a user