First cut of this will only handle the case where the assertion is invalid from the start; Chris is going to add code to listen for the assertion becoming invalid.
Created attachment 282391 [details] WIP
Comment on attachment 282391 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=282391&action=review > Source/WebKit2/UIProcess/ProcessAssertion.h:61 > + bool isValid(); Could be const? > Source/WebKit2/UIProcess/ProcessAssertion.h:85 > + bool m_isHoldingBackgroundAssertionOnApp : false; { false } Also, do we need the "OnApp" suffix? > Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm:177 > + return m_assertion->valid; m_assertion.get().valid
Comment on attachment 282391 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=282391&action=review >> Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm:177 >> + return m_assertion->valid; > > m_assertion.get().valid Also, for this to build with public SDK, I think we'll need to add the following to BKSProcessAssertion @interface in ApplicationServicesSPI.h: @property (nonatomic, readonly) BOOL valid;
Comment on attachment 282391 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=282391&action=review >>> Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm:177 >>> + return m_assertion->valid; >> >> m_assertion.get().valid > > Also, for this to build with public SDK, I think we'll need to add the following to BKSProcessAssertion @interface in ApplicationServicesSPI.h: > @property (nonatomic, readonly) BOOL valid; Unfortunately, this causes some problems because valid is false until the assertion is actually acquired.
Comment on attachment 282391 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=282391&action=review >>>> Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm:177 >>>> + return m_assertion->valid; >>> >>> m_assertion.get().valid >> >> Also, for this to build with public SDK, I think we'll need to add the following to BKSProcessAssertion @interface in ApplicationServicesSPI.h: >> @property (nonatomic, readonly) BOOL valid; > > Unfortunately, this causes some problems because valid is false until the assertion is actually acquired. In particular, isValid() always returns false when updateRunInBackgroundCount() is called from the ProcessAndUIAssertion() constructor.
Created attachment 282450 [details] Fix
Comment on attachment 282450 [details] Fix View in context: https://bugs.webkit.org/attachment.cgi?id=282450&action=review r=me > Source/WebKit2/ChangeLog:3 > + ProcessAssertion shouldn't keep UI app runnable if BKSProcessAssertion is invalid Maybe we want to update the title given the smaller scope of the change now? > Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm:181 > + if (m_isHoldingBackgroundAssertion && !shouldHoldBackgroundAssertion) else if ?
Committed revision 202690.