[iOS] Add a mechanism for holding Wi-Fi assertions
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2018 07:55:11 +0000 (07:55 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2018 07:55:11 +0000 (07:55 +0000)
commit343b530b12b8e2b7cc8655b90da3398a437dda2e
tree53195c88240b76ac746fb15f7522419ae1608e02
parent898308ec1b05af65c30122bad982b4a52f634243
[iOS] Add a mechanism for holding Wi-Fi assertions
https://bugs.webkit.org/show_bug.cgi?id=184520
<rdar://problem/39025726>

Reviewed by Sam Weinig.

Add plumbing for holding a Wi-Fi assertion on iOS as long as there are active
network data tasks. This functionality is turned off by default right now.

* Configurations/Network-iOS.entitlements:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* NetworkProcess/cocoa/WiFiAssertionHolder.cpp: Added.
(WebKit::ensureWiFiManagerClient): Create a global WiFiManagerClient when needed.
(WebKit::WiFiAssertionHolder::WiFiAssertionHolder): If this is the first active
Wi-Fi assertion holder, set the client's type to kWiFiClientTypeBackground.
(WebKit::WiFiAssertionHolder::~WiFiAssertionHolder): If the last active Wi-Fi
assertion holder is being destroyed, set the client's type back to
kWiFiClientTypeNormal.
* NetworkProcess/cocoa/WiFiAssertionHolder.h: Added.
* Platform/Logging.h: Added a logging channel for Wi-Fi assertions.
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* WebKit.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230560 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/Configurations/Network-iOS.entitlements
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit/NetworkProcess/cocoa/WiFiAssertionHolder.cpp [new file with mode: 0644]
Source/WebKit/NetworkProcess/cocoa/WiFiAssertionHolder.h [new file with mode: 0644]
Source/WebKit/Platform/Logging.h
Source/WebKit/Platform/spi/ios/MobileWiFiSPI.h [new file with mode: 0644]
Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/config.h