Changeset 231663 in webkit
- Timestamp:
- May 10, 2018, 3:02:31 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/Cocoa/NavigationState.mm (modified) (1 diff)
-
Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r231654 r231663 1 2018-05-10 Chris Dumez <cdumez@apple.com> 2 3 [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background 4 https://bugs.webkit.org/show_bug.cgi?id=185318 5 6 Reviewed by Geoffrey Garen. 7 8 Whenever there is a page load going on, we take a background process assertion to delay process 9 suspension until this load completes. However, there is also a 3 seconds grace period after 10 a load is complete to allow the app to trigger a new load shortly after. This grace period was 11 introduced to support use cases where a visible app does loads in an offscreen view. However, 12 it can be abused by apps running in the background as they could trigger new page loads while 13 in the background to delay process suspension. This patch tightens the policy so that only 14 apps that are currently visible get to use this grace period. Apps that are in the background 15 get to finish their current load and will then get suspended. 16 17 * UIProcess/Cocoa/NavigationState.mm: 18 (WebKit::NavigationState::didChangeIsLoading): 19 1 20 2018-05-10 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm
r231498 r231663 1158 1158 #if PLATFORM(IOS) 1159 1159 if (m_webView->_page->pageLoadState().isLoading()) { 1160 if (m_releaseActivityTimer.isActive()) 1160 if (m_releaseActivityTimer.isActive()) { 1161 RELEASE_LOG_IF(m_webView->_page->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - A new page load started while the UIProcess was still holding a page load background assertion", this); 1161 1162 m_releaseActivityTimer.stop(); 1162 else {1163 } else { 1163 1164 RELEASE_LOG_IF(m_webView->_page->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - UIProcess is taking a background assertion because a page load started", this); 1164 1165 ASSERT(!m_activityToken); 1165 1166 m_activityToken = m_webView->_page->process().throttler().backgroundActivityToken(); 1166 1167 } 1167 } else { 1168 // Delay releasing the background activity for 3 seconds to give the application a chance to start another navigation 1169 // before suspending the WebContent process <rdar://problem/27910964>. 1170 m_releaseActivityTimer.startOneShot(3_s); 1168 } else if (m_activityToken) { 1169 if (m_webView._isBackground) 1170 releaseNetworkActivityToken(); 1171 else { 1172 // The application is visible so we delay releasing the background activity for 3 seconds to give it a chance to start another navigation 1173 // before suspending the WebContent process <rdar://problem/27910964>. 1174 RELEASE_LOG_IF(m_webView->_page->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - Page load completed and UIProcess will be releasing background assertion soon unless a new load starts", this); 1175 m_releaseActivityTimer.startOneShot(3_s); 1176 } 1171 1177 } 1172 1178 #endif -
trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
r229542 r231663 50 50 SOFT_LINK_FRAMEWORK(UIKit) 51 51 SOFT_LINK_CLASS(UIKit, UIWindow) 52 53 @implementation WKWebView (WKWebViewTestingQuicks) 54 55 // TestWebKitAPI is currently not a UIApplication so we are unable to track if it is in 56 // the background or not (https://bugs.webkit.org/show_bug.cgi?id=175204). This can 57 // cause our processes to get suspended on iOS. We work around this by having 58 // WKWebView._isBackground always return NO in the context of API tests. 59 - (BOOL)_isBackground 60 { 61 return NO; 62 } 63 @end 52 64 #endif 53 65
Note:
See TracChangeset
for help on using the changeset viewer.