WebKit Bugzilla
Attachment 370951 Details for
Bug 198380
: [iOS] UIProcess' background task expiration handler may get called after the app is foreground again
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198380-20190530102947.patch (text/plain), 3.34 KB, created by
Chris Dumez
on 2019-05-30 10:29:48 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2019-05-30 10:29:48 PDT
Size:
3.34 KB
patch
obsolete
>Subversion Revision: 245892 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 9eb299bb2e40cc78cf028df7a14269553885b317..8f1a43113801556478d373f1dc10966afeee45b0 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,23 @@ >+2019-05-30 Chris Dumez <cdumez@apple.com> >+ >+ [iOS] UIProcess' background task expiration handler may get called after the app is foreground again >+ https://bugs.webkit.org/show_bug.cgi?id=198380 >+ <rdar://problem/49762471> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ UIProcess' background task expiration handler may get called after the app is foreground again. When >+ this happens, we already have a foreground assertion on behalf of the WebContent process, and the view >+ is visible. We would send the WillSuspendImminently IPC to the WebContent process, which would freeze >+ its layers, even though it is visible on screen. >+ >+ To address the issue, we now check if the app is visible in the expiration handler. If it is visible, >+ we do not notify clients of imminent suspension. Instead, we end the background task right away and >+ call _updateBackgroundTask asynchronously to start a new background task if necessary. >+ >+ * UIProcess/ios/ProcessAssertionIOS.mm: >+ (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): >+ > 2019-05-30 Truitt Savell <tsavell@apple.com> > > Unreviewed, rolling out r245881. >diff --git a/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm b/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm >index 2aca868bb8b5713159c91d2abe5feca9461cc72f..2b9ab03ad269f2535b7694ab469e16d842a7ebfc 100644 >--- a/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm >+++ b/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm >@@ -150,7 +150,17 @@ - (void)_updateBackgroundTask > } > RELEASE_LOG(ProcessSuspension, "%p - WKProcessAssertionBackgroundTaskManager - beginBackgroundTaskWithName", self); > _backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithName:@"com.apple.WebKit.ProcessAssertion" expirationHandler:^{ >- RELEASE_LOG_ERROR(ProcessSuspension, "Background task expired while holding WebKit ProcessAssertion (isMainThread? %d).", RunLoop::isMain()); >+ RELEASE_LOG_ERROR(ProcessSuspension, "Background task expired while holding WebKit ProcessAssertion (isMainThread? %d, applicationIsBackgrounded? %d).", RunLoop::isMain(), _applicationIsBackgrounded); >+ if (!_applicationIsBackgrounded) { >+ // We've received the invalidation warning after the app has become foreground again. In this case, we should not warn clients of imminent suspension. >+ // To be safe (avoid potential killing), we end the task right away and call _updateBackgroundTask asynchronously to start a new task if necessary. >+ [self _cancelPendingReleaseTask]; >+ [self _releaseBackgroundTask]; >+ dispatch_async(dispatch_get_main_queue(), ^{ >+ [self _updateBackgroundTask]; >+ }); >+ return; >+ } > // The expiration handler gets called on a non-main thread when the underlying assertion could not be taken (rdar://problem/27278419). > if (RunLoop::isMain()) > [self _notifyAssertionsOfImminentSuspension];
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 198380
:
370951
|
371163
|
371284