WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 225324
[iOS] Have ProcessAssertion take the RunningBoard assertion asynchronously by default
https://bugs.webkit.org/show_bug.cgi?id=225324
Summary
[iOS] Have ProcessAssertion take the RunningBoard assertion asynchronously by...
Chris Dumez
Reported
2021-05-03 13:06:49 PDT
Use async API to take RunningBoard assertions to avoid hanging the main thread.
Attachments
Patch
(12.55 KB, patch)
2021-05-03 13:13 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(13.59 KB, patch)
2021-05-03 13:31 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(13.59 KB, patch)
2021-05-03 13:38 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(11.60 KB, patch)
2021-05-03 22:24 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(11.54 KB, patch)
2021-05-03 23:15 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(29.16 KB, patch)
2021-07-01 12:51 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(29.60 KB, patch)
2021-07-01 13:07 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(30.61 KB, patch)
2021-07-01 13:39 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(30.64 KB, patch)
2021-07-01 15:56 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(31.66 KB, patch)
2021-07-02 13:43 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(31.74 KB, patch)
2021-07-02 15:36 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(10)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2021-05-03 13:07:17 PDT
<
rdar://76972252
>
Chris Dumez
Comment 2
2021-05-03 13:13:10 PDT
Created
attachment 427590
[details]
Patch
Chris Dumez
Comment 3
2021-05-03 13:31:14 PDT
Created
attachment 427593
[details]
Patch
Chris Dumez
Comment 4
2021-05-03 13:38:40 PDT
Created
attachment 427596
[details]
Patch
Simon Fraser (smfr)
Comment 5
2021-05-03 18:38:55 PDT
Comment on
attachment 427596
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=427596&action=review
> Source/WebKit/UIProcess/ProcessAssertion.h:78 > + bool m_isValid { false }; // Assume valid while in the process of being acquired.
The comment seems to disagree with the initialization value.
> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:66 > + std::atomic<bool> m_hasValidBackgroundAssertion; // Assume valid while in the process of being acquired.
The comment here is also confusing.
> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:168 > + m_hasValidBackgroundAssertion = true;
This is where I'd put the comment. Would it be more truthful to use an Optional<> to indicate that we don't know the state yet?
Geoffrey Garen
Comment 6
2021-05-03 20:59:39 PDT
Comment on
attachment 427596
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=427596&action=review
>> Source/WebKit/UIProcess/ProcessAssertion.h:78 >> + bool m_isValid { false }; // Assume valid while in the process of being acquired. > > The comment seems to disagree with the initialization value.
The dissonance between comment and initialization here threw me for a loop too at first. I'd suggest changing the default initialization to true, removing the comment, and removing the (additional) initialization from the cross platform constructor. The iOS constructor can explicitly set m_isValid to false in the !pid case.
>> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:66 >> + std::atomic<bool> m_hasValidBackgroundAssertion; // Assume valid while in the process of being acquired. > > The comment here is also confusing.
I'd call this _backgroundTaskIsValid and remove the comment.
>> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:168 >> + m_hasValidBackgroundAssertion = true; > > This is where I'd put the comment. Would it be more truthful to use an Optional<> to indicate that we don't know the state yet?
I don't think we can use Optional<> here because we never transition from not knowing to knowing. We're always in the "I tried to acquire state" until we're in the "I got invalidated" state. That said, I think it's fine to say that our state is "valid" from the moment we try to acquire. Our definition of "valid" is "there is no need to acquire".
Chris Dumez
Comment 7
2021-05-03 22:02:29 PDT
I was thinking of renaming the flag to m_wasInvalidated so it is clearer what it means. The definition of is valid is a bit ambiguous otherwise. And Geoff is right that we don’t know when we’ve successfully acquired the assertion. The only signal we get is the invalidation (which may be a failure to acquire).
Geoffrey Garen
Comment 8
2021-05-03 22:14:43 PDT
(In reply to Chris Dumez from
comment #7
)
> I was thinking of renaming the flag to m_wasInvalidated so it is clearer > what it means. The definition of is valid is a bit ambiguous otherwise.
m_wasInvalidated sounds good to me. Clearer. And it makes the initialization case clearer. (Anything with 'was' in the name must start out false, since nothing has happened yet.) (Remember to set wasInvalidated in the !pid case.)
Chris Dumez
Comment 9
2021-05-03 22:24:54 PDT
Created
attachment 427639
[details]
Patch
Chris Dumez
Comment 10
2021-05-03 22:29:46 PDT
(In reply to Geoffrey Garen from
comment #8
)
> (In reply to Chris Dumez from
comment #7
) > > I was thinking of renaming the flag to m_wasInvalidated so it is clearer > > what it means. The definition of is valid is a bit ambiguous otherwise. > > m_wasInvalidated sounds good to me. Clearer. And it makes the initialization > case clearer. (Anything with 'was' in the name must start out false, since > nothing has happened yet.) (Remember to set wasInvalidated in the !pid case.)
isValid() was already taking care of the !pid case: ``` bool ProcessAssertion::isValid() const { - return m_rbsAssertion && m_rbsAssertion.get().valid; + return m_rbsAssertion && !m_wasInvalidated; } ```
Chris Dumez
Comment 11
2021-05-03 23:15:17 PDT
Created
attachment 427640
[details]
Patch
Geoffrey Garen
Comment 12
2021-05-04 10:54:13 PDT
Comment on
attachment 427640
[details]
Patch r=me
EWS
Comment 13
2021-05-04 11:04:23 PDT
Committed
r276969
(
237298@main
): <
https://commits.webkit.org/237298@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 427640
[details]
.
Chris Dumez
Comment 14
2021-06-30 08:38:13 PDT
Reverted
r276969
for reason: Causes previous assertion to get released before the new one is taken (asynchronously) Committed
r279412
(
239277@main
): <
https://commits.webkit.org/239277@main
>
Chris Dumez
Comment 15
2021-07-01 12:51:34 PDT
Created
attachment 432716
[details]
Patch
Chris Dumez
Comment 16
2021-07-01 13:07:19 PDT
Created
attachment 432718
[details]
Patch
Chris Dumez
Comment 17
2021-07-01 13:39:15 PDT
Created
attachment 432719
[details]
Patch
Chris Dumez
Comment 18
2021-07-01 15:56:42 PDT
Created
attachment 432740
[details]
Patch
Chris Dumez
Comment 19
2021-07-02 13:43:13 PDT
Created
attachment 432819
[details]
Patch
Chris Dumez
Comment 20
2021-07-02 13:43:41 PDT
Had to rebase because of
Bug 227552
landing.
Chris Dumez
Comment 21
2021-07-02 15:36:13 PDT
Created
attachment 432829
[details]
Patch
Chris Dumez
Comment 22
2021-07-02 17:37:32 PDT
Comment on
attachment 432829
[details]
Patch EWS is happy, patch is ready for review.
Geoffrey Garen
Comment 23
2021-07-06 10:56:00 PDT
Comment on
attachment 432829
[details]
Patch r=me
EWS
Comment 24
2021-07-06 12:01:36 PDT
Committed
r279601
(
239425@main
): <
https://commits.webkit.org/239425@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 432829
[details]
.
Chris Dumez
Comment 25
2021-07-07 15:23:14 PDT
Follow-up in
https://commits.webkit.org/r279679
to address assertions on the iOS debug bots.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug