Bug 212619 - [iOS] WKProcessAssertionBackgroundTaskManager incorrectly ignores expiration notifications for daemons
Summary: [iOS] WKProcessAssertionBackgroundTaskManager incorrectly ignores expiration ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on: 212615
Blocks:
  Show dependency treegraph
 
Reported: 2020-06-01 16:49 PDT by Chris Dumez
Modified: 2020-06-02 22:30 PDT (History)
3 users (show)

See Also:


Attachments
Patch (9.01 KB, patch)
2020-06-01 16:58 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (8.99 KB, patch)
2020-06-01 17:01 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (8.94 KB, patch)
2020-06-02 08:33 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (9.78 KB, patch)
2020-06-02 08:41 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (9.78 KB, patch)
2020-06-02 08:46 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (9.77 KB, patch)
2020-06-02 18:50 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2020-06-01 16:49:08 PDT
WKProcessAssertionBackgroundTaskManager incorrectly ignores expiration notifications for daemons, because it rely on visibility to make decisions.
Comment 1 Chris Dumez 2020-06-01 16:58:53 PDT
Created attachment 400770 [details]
Patch
Comment 2 Chris Dumez 2020-06-01 17:01:07 PDT
Created attachment 400771 [details]
Patch
Comment 3 Chris Dumez 2020-06-02 08:33:38 PDT
Created attachment 400825 [details]
Patch
Comment 4 Chris Dumez 2020-06-02 08:41:16 PDT
Created attachment 400828 [details]
Patch
Comment 5 Chris Dumez 2020-06-02 08:46:05 PDT
Created attachment 400830 [details]
Patch
Comment 6 Alex Christensen 2020-06-02 17:31:20 PDT
Comment on attachment 400830 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=400830&action=review

> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:53
> +    return [[[RBSProcessHandle currentProcess] activeLimitations] runTime] != RBSProcessTimeLimitationNone;

It might be worth putting this inside a std::call_once, because this should never change, right?

> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:241
> +    auto remainingTime = [[[RBSProcessHandle currentProcess] activeLimitations] runTime];

Can we use dot syntax for any of this?
Comment 7 Chris Dumez 2020-06-02 17:33:21 PDT
Comment on attachment 400830 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=400830&action=review

>> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:53
>> +    return [[[RBSProcessHandle currentProcess] activeLimitations] runTime] != RBSProcessTimeLimitationNone;
> 
> It might be worth putting this inside a std::call_once, because this should never change, right?

It totally changes. For example, for applications, based on app visibility. The timer should only get started after the app gets backgrounded and thus this would return RBSProcessTimeLimitationNone when foreground and a positive value when background.

>> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:241
>> +    auto remainingTime = [[[RBSProcessHandle currentProcess] activeLimitations] runTime];
> 
> Can we use dot syntax for any of this?

ok
Comment 8 Chris Dumez 2020-06-02 18:50:03 PDT
Created attachment 400875 [details]
Patch
Comment 9 EWS 2020-06-02 22:29:18 PDT
Committed r262477: <https://trac.webkit.org/changeset/262477>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 400875 [details].
Comment 10 Radar WebKit Bug Importer 2020-06-02 22:30:16 PDT
<rdar://problem/63909510>