Title: [260960] trunk/Source/WebCore
- Revision
- 260960
- Author
- cdu...@apple.com
- Date
- 2020-04-30 12:43:13 -0700 (Thu, 30 Apr 2020)
Log Message
WebCore::systemHasBattery() is unnecessarily expensive on iOS
https://bugs.webkit.org/show_bug.cgi?id=211240
<rdar://problem/62619971>
Reviewed by Geoffrey Garen.
Update WebCore::systemHasBattery() to return true unconditionally on
PLATFORM(IOS) and PLATFORM(WATCHOS) since iOS devices always have a
battery. Also return false unconditionally for PLATFORM(APPLETV).
* platform/cocoa/SystemBattery.mm:
(WebCore::systemHasBattery):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (260959 => 260960)
--- trunk/Source/WebCore/ChangeLog 2020-04-30 19:19:44 UTC (rev 260959)
+++ trunk/Source/WebCore/ChangeLog 2020-04-30 19:43:13 UTC (rev 260960)
@@ -1,3 +1,18 @@
+2020-04-30 Chris Dumez <cdu...@apple.com>
+
+ WebCore::systemHasBattery() is unnecessarily expensive on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=211240
+ <rdar://problem/62619971>
+
+ Reviewed by Geoffrey Garen.
+
+ Update WebCore::systemHasBattery() to return true unconditionally on
+ PLATFORM(IOS) and PLATFORM(WATCHOS) since iOS devices always have a
+ battery. Also return false unconditionally for PLATFORM(APPLETV).
+
+ * platform/cocoa/SystemBattery.mm:
+ (WebCore::systemHasBattery):
+
2020-04-30 Andres Gonzalez <andresg...@apple.com>
Fix for crash in AXLogger.
Modified: trunk/Source/WebCore/platform/cocoa/SystemBattery.mm (260959 => 260960)
--- trunk/Source/WebCore/platform/cocoa/SystemBattery.mm 2020-04-30 19:19:44 UTC (rev 260959)
+++ trunk/Source/WebCore/platform/cocoa/SystemBattery.mm 2020-04-30 19:43:13 UTC (rev 260960)
@@ -41,6 +41,12 @@
{
if (!hasBattery.hasValue()) {
hasBattery = [] {
+#if PLATFORM(IOS) || PLATFORM(WATCHOS)
+ // Devices running iOS / WatchOS always have a battery.
+ return true;
+#elif PLATFORM(APPLETV)
+ return false;
+#else
RetainPtr<CFTypeRef> powerSourcesInfo = adoptCF(IOPSCopyPowerSourcesInfo());
if (!powerSourcesInfo)
return false;
@@ -54,6 +60,7 @@
return true;
}
return false;
+#endif
}();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes