[webkit-reviews] review granted: [Bug 184520] [iOS] Add a mechanism for holding Wi-Fi assertions : [Attachment 337756] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Apr 11 18:28:00 PDT 2018
Sam Weinig <sam at webkit.org> has granted Andy Estes <aestes at apple.com>'s request
for review:
Bug 184520: [iOS] Add a mechanism for holding Wi-Fi assertions
https://bugs.webkit.org/show_bug.cgi?id=184520
Attachment 337756: Patch
https://bugs.webkit.org/attachment.cgi?id=337756&action=review
--- Comment #4 from Sam Weinig <sam at webkit.org> ---
Comment on attachment 337756
--> https://bugs.webkit.org/attachment.cgi?id=337756
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=337756&action=review
> Source/WebKit/NetworkProcess/cocoa/WiFiAssertionHolder.cpp:61
> +#include <MobileWiFi/WiFiManagerClient.h>
> +
> +namespace WebKit {
> +
> +static WiFiManagerClientRef ensureWiFiManagerClient()
> +{
> + static WiFiManagerClientRef wiFiManagerClient =
WiFiManagerClientCreate(kCFAllocatorDefault, kWiFiClientTypeNormal);
> + return wiFiManagerClient;
> +}
> +
> +static uint64_t wiFiAssertionCount;
> +
> +WiFiAssertionHolder::WiFiAssertionHolder()
> +{
> + if (wiFiAssertionCount++)
> + return;
> +
> + RELEASE_LOG(WiFiAssertions, "Acquiring Wi-Fi assertion.");
> + WiFiManagerClientSetType(ensureWiFiManagerClient(),
kWiFiClientTypeBackground);
> +}
> +
> +WiFiAssertionHolder::~WiFiAssertionHolder()
> +{
> + ASSERT(wiFiAssertionCount);
> + if (--wiFiAssertionCount)
> + return;
> +
> + RELEASE_LOG(WiFiAssertions, "Releasing Wi-Fi assertion.");
> + WiFiManagerClientSetType(ensureWiFiManagerClient(),
kWiFiClientTypeNormal);
> +}
This should probably be in a HAVE(MOBILE_WIFI) #ifdef.
Also, it's a bit confusing that taking the assertion puts things in
"background' type, and releasing it makes it normal.
More information about the webkit-reviews
mailing list