Title: [202690] trunk/Source/WebKit2
- Revision
- 202690
- Author
- barraclo...@apple.com
- Date
- 2016-06-30 11:15:47 -0700 (Thu, 30 Jun 2016)
Log Message
Cleanup ProcessAssertion RunInBackground management
https://bugs.webkit.org/show_bug.cgi?id=159284
Reviewed by Chris Dumez.
Factor out code that handles taking a background assertion on the UI app into
ProcessAndUIAssertion::updateRunInBackgroundCount helper.
This patch just cleanup to enable a futher fix.
* UIProcess/ProcessAssertion.h:
(WebKit::ProcessAssertion::state):
- Added ProcessAndUIAssertion::updateRunInBackgroundCount
- Added ProcessAndUIAssertion::m_isHoldingBackgroundAssertionOnApp
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
- helper to manage calls to incrementNeedsToRunInBackgroundCount/decrementNeedsToRunInBackgroundCount
(WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
- call updateRunInBackgroundCount
(WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
changed to use m_isHoldingBackgroundAssertionOnApp
(WebKit::ProcessAndUIAssertion::setState):
- call updateRunInBackgroundCount
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (202689 => 202690)
--- trunk/Source/WebKit2/ChangeLog 2016-06-30 18:13:26 UTC (rev 202689)
+++ trunk/Source/WebKit2/ChangeLog 2016-06-30 18:15:47 UTC (rev 202690)
@@ -1,3 +1,29 @@
+2016-06-29 Gavin Barraclough <barraclo...@apple.com>
+
+ Cleanup ProcessAssertion RunInBackground management
+ https://bugs.webkit.org/show_bug.cgi?id=159284
+
+ Reviewed by Chris Dumez.
+
+ Factor out code that handles taking a background assertion on the UI app into
+ ProcessAndUIAssertion::updateRunInBackgroundCount helper.
+
+ This patch just cleanup to enable a futher fix.
+
+ * UIProcess/ProcessAssertion.h:
+ (WebKit::ProcessAssertion::state):
+ - Added ProcessAndUIAssertion::updateRunInBackgroundCount
+ - Added ProcessAndUIAssertion::m_isHoldingBackgroundAssertionOnApp
+ * UIProcess/ios/ProcessAssertionIOS.mm:
+ (WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
+ - helper to manage calls to incrementNeedsToRunInBackgroundCount/decrementNeedsToRunInBackgroundCount
+ (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
+ - call updateRunInBackgroundCount
+ (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
+ changed to use m_isHoldingBackgroundAssertionOnApp
+ (WebKit::ProcessAndUIAssertion::setState):
+ - call updateRunInBackgroundCount
+
2016-06-30 Carlos Garcia Campos <cgar...@igalia.com>
[Coordinated Graphics] Move CompositingCoordinator from platform to WebKit2 layer
Modified: trunk/Source/WebKit2/UIProcess/ProcessAssertion.h (202689 => 202690)
--- trunk/Source/WebKit2/UIProcess/ProcessAssertion.h 2016-06-30 18:13:26 UTC (rev 202689)
+++ trunk/Source/WebKit2/UIProcess/ProcessAssertion.h 2016-06-30 18:15:47 UTC (rev 202690)
@@ -72,6 +72,13 @@
void setClient(ProcessAssertionClient&);
void setState(AssertionState);
+
+#if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
+private:
+ void updateRunInBackgroundCount();
+
+ bool m_isHoldingBackgroundAssertion { false };
+#endif
};
}
Modified: trunk/Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm (202689 => 202690)
--- trunk/Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm 2016-06-30 18:13:26 UTC (rev 202689)
+++ trunk/Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm 2016-06-30 18:15:47 UTC (rev 202690)
@@ -172,27 +172,37 @@
[m_assertion setFlags:flagsForState(assertionState)];
}
+void ProcessAndUIAssertion::updateRunInBackgroundCount()
+{
+ bool shouldHoldBackgroundAssertion = state() != AssertionState::Suspended;
+
+ if (shouldHoldBackgroundAssertion) {
+ if (!m_isHoldingBackgroundAssertion)
+ [[WKProcessAssertionBackgroundTaskManager shared] incrementNeedsToRunInBackgroundCount];
+ } else {
+ if (m_isHoldingBackgroundAssertion)
+ [[WKProcessAssertionBackgroundTaskManager shared] decrementNeedsToRunInBackgroundCount];
+ }
+
+ m_isHoldingBackgroundAssertion = shouldHoldBackgroundAssertion;
+}
+
ProcessAndUIAssertion::ProcessAndUIAssertion(pid_t pid, AssertionState assertionState)
: ProcessAssertion(pid, assertionState)
{
- if (assertionState != AssertionState::Suspended)
- [[WKProcessAssertionBackgroundTaskManager shared] incrementNeedsToRunInBackgroundCount];
+ updateRunInBackgroundCount();
}
ProcessAndUIAssertion::~ProcessAndUIAssertion()
{
- if (state() != AssertionState::Suspended)
+ if (m_isHoldingBackgroundAssertion)
[[WKProcessAssertionBackgroundTaskManager shared] decrementNeedsToRunInBackgroundCount];
}
void ProcessAndUIAssertion::setState(AssertionState assertionState)
{
- if ((state() == AssertionState::Suspended) && (assertionState != AssertionState::Suspended))
- [[WKProcessAssertionBackgroundTaskManager shared] incrementNeedsToRunInBackgroundCount];
- if ((state() != AssertionState::Suspended) && (assertionState == AssertionState::Suspended))
- [[WKProcessAssertionBackgroundTaskManager shared] decrementNeedsToRunInBackgroundCount];
-
ProcessAssertion::setState(assertionState);
+ updateRunInBackgroundCount();
}
void ProcessAndUIAssertion::setClient(ProcessAssertionClient& newClient)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes