Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Start/stop ProcessStateMonitor with ApplicationStateTracker
https://bugs.webkit.org/show_bug.cgi?id=241427 Reviewed by Geoffrey Garen. We want ProcessStateMonitor to be started when application is in background and to be stopped when application is in foreground. In r294405, we start/stop ProcessStateMonitor on receiving UIApplicationDidEnterBackgroundNotification and UIApplicationWillEnterForegroundNotification notifications. However, UIApplicationWillEnterForegroundNotification can be sent later than UISceneWillEnterForegroundNotification. In ApplicationStateTracke, we start creating foreground activity for web process on receiving UISceneWillEnterForegroundNotification. At this time, UIApplicationWillEnterForegroundNotification may not be received yet and ProcessStateMonitor may still be working. ProcessStateMonitor may forbid creating new activity after it sets process shouldSuspend (see r294405), so we need to make sure ProcessStateMonitor is stopped before starting new foreground activity. To achieve that, we now decide when to start/stop ProcessStateMonitor with ApplicationStateTracker. We start ProcessStateMonitor when all trackers are in the background, and stop it when at least one tracker is in foreground. * Source/WebKit/UIProcess/ApplicationStateTracker.mm: (WebKit::allApplicationStateTrackers): (WebKit::updateApplicationBackgroundState): (WebKit::ApplicationStateTracker::ApplicationStateTracker): (WebKit::ApplicationStateTracker::~ApplicationStateTracker): (WebKit::ApplicationStateTracker::applicationDidEnterBackground): (WebKit::ApplicationStateTracker::applicationWillEnterForeground): * Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::setProcessesShouldSuspend): * Source/WebKit/UIProcess/ProcessAssertion.h: * Source/WebKit/UIProcess/WebProcessPool.h: * Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]): (-[WKProcessAssertionBackgroundTaskManager setProcessStateMonitorEnabled:]): (WebKit::ProcessAndUIAssertion::setProcessStateMonitorEnabled): * Source/WebKit/UIProcess/ios/ProcessStateMonitor.mm: (WebKit::ProcessStateMonitor::checkRemainingRunTime): * Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm: (WebKit::WebProcessProxy::platformInitialize): Canonical link: https://commits.webkit.org/251498@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295493 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
7 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters