Title: [253110] branches/safari-608-branch/Source/WebKit
- Revision
- 253110
- Author
- [email protected]
- Date
- 2019-12-04 10:17:03 -0800 (Wed, 04 Dec 2019)
Log Message
Cherry-pick r252811. rdar://problem/57609336
[iOS] Copy assertions before iterating over them in _notifyAssertionsOfImminentSuspension
https://bugs.webkit.org/show_bug.cgi?id=204524
<rdar://problem/57265830>
Reviewed by Alexey Proskuryakov.
Copy assertions before iterating over them in _notifyAssertionsOfImminentSuspension and use WeakPtr
to make sure the assertions are still alive before calling uiAssertionWillExpireImminently() on
them. It is common for process assertions to get released when uiAssertionWillExpireImminently()
gets called, which would remove them from the _assertionsNeedingBackgroundTask vector we were
iterating on.
* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252811 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (253109 => 253110)
--- branches/safari-608-branch/Source/WebKit/ChangeLog 2019-12-04 18:16:59 UTC (rev 253109)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog 2019-12-04 18:17:03 UTC (rev 253110)
@@ -1,3 +1,41 @@
+2019-12-03 Alan Coon <[email protected]>
+
+ Cherry-pick r252811. rdar://problem/57609336
+
+ [iOS] Copy assertions before iterating over them in _notifyAssertionsOfImminentSuspension
+ https://bugs.webkit.org/show_bug.cgi?id=204524
+ <rdar://problem/57265830>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Copy assertions before iterating over them in _notifyAssertionsOfImminentSuspension and use WeakPtr
+ to make sure the assertions are still alive before calling uiAssertionWillExpireImminently() on
+ them. It is common for process assertions to get released when uiAssertionWillExpireImminently()
+ gets called, which would remove them from the _assertionsNeedingBackgroundTask vector we were
+ iterating on.
+
+ * UIProcess/ios/ProcessAssertionIOS.mm:
+ (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252811 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-11-22 Chris Dumez <[email protected]>
+
+ [iOS] Copy assertions before iterating over them in _notifyAssertionsOfImminentSuspension
+ https://bugs.webkit.org/show_bug.cgi?id=204524
+ <rdar://problem/57265830>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Copy assertions before iterating over them in _notifyAssertionsOfImminentSuspension and use WeakPtr
+ to make sure the assertions are still alive before calling uiAssertionWillExpireImminently() on
+ them. It is common for process assertions to get released when uiAssertionWillExpireImminently()
+ gets called, which would remove them from the _assertionsNeedingBackgroundTask vector we were
+ iterating on.
+
+ * UIProcess/ios/ProcessAssertionIOS.mm:
+ (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
+
2019-11-19 Alan Coon <[email protected]>
Cherry-pick r252619. rdar://problem/57330791
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm (253109 => 253110)
--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm 2019-12-04 18:16:59 UTC (rev 253109)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm 2019-12-04 18:17:03 UTC (rev 253110)
@@ -112,8 +112,16 @@
{
ASSERT(RunLoop::isMain());
- for (auto* assertion : copyToVector(_assertionsNeedingBackgroundTask))
- assertion->uiAssertionWillExpireImminently();
+ Vector<WeakPtr<ProcessAndUIAssertion>> assertionsNeedingBackgroundTask = WTF::map(_assertionsNeedingBackgroundTask, [](auto* assertion) {
+ return makeWeakPtr(*assertion);
+ });
+
+ // Note that we don't expect clients to register new assertions when getting notified that the UI assertion will expire imminently.
+ // If clients were to do so, then those new assertions would not get notified of the imminent suspension.
+ for (auto assertion : assertionsNeedingBackgroundTask) {
+ if (assertion)
+ assertion->uiAssertionWillExpireImminently();
+ }
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes