WebKit Bugzilla
Attachment 339585 Details for
Bug 185318
: [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185318-20180504130131.patch (text/plain), 3.56 KB, created by
Chris Dumez
on 2018-05-04 13:01:32 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2018-05-04 13:01:32 PDT
Size:
3.56 KB
patch
obsolete
>Subversion Revision: 231334 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index dd5597fbb51b590e0185c9784b8478ecde38de7f..a2f4a168bb2d991124f5cba48b06635c337f39a7 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,22 @@ >+2018-05-04 Chris Dumez <cdumez@apple.com> >+ >+ [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background >+ https://bugs.webkit.org/show_bug.cgi?id=185318 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Whenever there is a page load going on, we take a background process assertion to delay process >+ suspension until this load completes. However, there is also a 3 seconds grace period after >+ a load is complete to allow the app to trigger a new load shortly after. This grace period was >+ introduced to support use cases where a visible app does loads in an offscreen view. However, >+ it can be abused by apps running in the background as they could trigger new page loads while >+ in the background to delay process suspension. This patch tightens the policy so that only >+ apps that are currently visible get to use this grace period. Apps that are in the background >+ get to finish their current load and will then get suspended. >+ >+ * UIProcess/Cocoa/NavigationState.mm: >+ (WebKit::NavigationState::didChangeIsLoading): >+ > 2018-05-03 Justin Fan <justin_fan@apple.com> > > [WebGL] Add runtime flag for enabling ASTC support in WebGL >diff --git a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >index 809e5a008d72b379fe9ae74837e8f8b85e02c793..203706afb66e833ca5967216bd2fb65ff13b2bad 100644 >--- a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >+++ b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >@@ -1157,17 +1157,23 @@ void NavigationState::didChangeIsLoading() > { > #if PLATFORM(IOS) > if (m_webView->_page->pageLoadState().isLoading()) { >- if (m_releaseActivityTimer.isActive()) >+ if (m_releaseActivityTimer.isActive()) { >+ 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); > m_releaseActivityTimer.stop(); >- else { >+ } else { > RELEASE_LOG_IF(m_webView->_page->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - UIProcess is taking a background assertion because a page load started", this); > ASSERT(!m_activityToken); > m_activityToken = m_webView->_page->process().throttler().backgroundActivityToken(); > } >- } else { >- // Delay releasing the background activity for 3 seconds to give the application a chance to start another navigation >- // before suspending the WebContent process <rdar://problem/27910964>. >- m_releaseActivityTimer.startOneShot(3_s); >+ } else if (m_activityToken) { >+ if (m_webView._isBackground) >+ releaseNetworkActivityToken(); >+ else { >+ // The application is visible so we delay releasing the background activity for 3 seconds to give it a chance to start another navigation >+ // before suspending the WebContent process <rdar://problem/27910964>. >+ 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); >+ m_releaseActivityTimer.startOneShot(3_s); >+ } > } > #endif >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185318
:
339584
|
339585
|
340119