Title: [270406] trunk/Source
Revision
270406
Author
[email protected]
Date
2020-12-03 13:14:53 -0800 (Thu, 03 Dec 2020)

Log Message

Refactor macros for low power mode code
https://bugs.webkit.org/show_bug.cgi?id=219497

Reviewed by Geoffrey Garen.

Source/WebCore:

Use HAVE(APPLE_LOW_POWER_MODE_SUPPORT) instead of PLATFORM(IOS_FAMILY), which is equivalent.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/LowPowerModeNotifier.h:
* platform/cocoa/LowPowerModeNotifier.mm: Renamed from Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm.
(-[WebLowPowerModeObserver initWithNotifier:]):
(-[WebLowPowerModeObserver dealloc]):
(-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
(WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
(WebCore::LowPowerModeNotifier::~LowPowerModeNotifier):
(WebCore::LowPowerModeNotifier::isLowPowerModeEnabled const):
(WebCore::LowPowerModeNotifier::notifyLowPowerModeChanged):
(WebCore::notifyLowPowerModeChanged):

Source/WTF:

Add new HAVE_APPLE_LOW_POWER_MODE_SUPPORT macro, enabled on iOS_FAMILY.

* wtf/PlatformHave.h:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (270405 => 270406)


--- trunk/Source/WTF/ChangeLog	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WTF/ChangeLog	2020-12-03 21:14:53 UTC (rev 270406)
@@ -1,3 +1,14 @@
+2020-12-03  Chris Dumez  <[email protected]>
+
+        Refactor macros for low power mode code
+        https://bugs.webkit.org/show_bug.cgi?id=219497
+
+        Reviewed by Geoffrey Garen.
+
+        Add new HAVE_APPLE_LOW_POWER_MODE_SUPPORT macro, enabled on iOS_FAMILY.
+
+        * wtf/PlatformHave.h:
+
 2020-12-03  Fujii Hironori  <[email protected]>
 
         Remove GraphicsContextGLOpenGL::setRenderbufferStorageFromDrawable declaration

Modified: trunk/Source/WTF/wtf/PlatformHave.h (270405 => 270406)


--- trunk/Source/WTF/wtf/PlatformHave.h	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2020-12-03 21:14:53 UTC (rev 270406)
@@ -777,3 +777,7 @@
 #if (PLATFORM(IOS) && !PLATFORM(IOS_FAMILY_SIMULATOR)) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
 #define HAVE_COREVIDEO_COMPRESSED_PIXEL_FORMAT_TYPES 1
 #endif
+
+#if PLATFORM(IOS_FAMILY)
+#define HAVE_APPLE_LOW_POWER_MODE_SUPPORT 1
+#endif

Modified: trunk/Source/WebCore/ChangeLog (270405 => 270406)


--- trunk/Source/WebCore/ChangeLog	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WebCore/ChangeLog	2020-12-03 21:14:53 UTC (rev 270406)
@@ -1,3 +1,25 @@
+2020-12-03  Chris Dumez  <[email protected]>
+
+        Refactor macros for low power mode code
+        https://bugs.webkit.org/show_bug.cgi?id=219497
+
+        Reviewed by Geoffrey Garen.
+
+        Use HAVE(APPLE_LOW_POWER_MODE_SUPPORT) instead of PLATFORM(IOS_FAMILY), which is equivalent.
+
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/LowPowerModeNotifier.h:
+        * platform/cocoa/LowPowerModeNotifier.mm: Renamed from Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm.
+        (-[WebLowPowerModeObserver initWithNotifier:]):
+        (-[WebLowPowerModeObserver dealloc]):
+        (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
+        (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
+        (WebCore::LowPowerModeNotifier::~LowPowerModeNotifier):
+        (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled const):
+        (WebCore::LowPowerModeNotifier::notifyLowPowerModeChanged):
+        (WebCore::notifyLowPowerModeChanged):
+
 2020-12-03  Alicia Boya GarcĂ­a  <[email protected]>
 
         [GStreamer] Fix video losing size at the end of the stream

Modified: trunk/Source/WebCore/SourcesCocoa.txt (270405 => 270406)


--- trunk/Source/WebCore/SourcesCocoa.txt	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2020-12-03 21:14:53 UTC (rev 270406)
@@ -237,6 +237,7 @@
 platform/cocoa/FileMonitorCocoa.mm
 platform/cocoa/KeyEventCocoa.mm
 platform/cocoa/LocalizedStringsCocoa.mm
+platform/cocoa/LowPowerModeNotifier.mm
 platform/cocoa/MIMETypeRegistryCocoa.mm
 platform/cocoa/MediaUtilities.cpp
 platform/cocoa/NetworkExtensionContentFilter.mm
@@ -436,7 +437,6 @@
 platform/ios/LocalCurrentGraphicsContextIOS.mm
 platform/ios/LocalCurrentTraitCollection.mm
 platform/ios/LocalizedDeviceModel.mm
-platform/ios/LowPowerModeNotifierIOS.mm
 platform/ios/PasteboardIOS.mm
 platform/ios/PlatformEventFactoryIOS.mm @no-unify
 platform/ios/PlatformPasteboardIOS.mm

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (270405 => 270406)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-12-03 21:14:53 UTC (rev 270406)
@@ -7801,7 +7801,6 @@
 		419E6EC72566D214002B5010 /* RTCPeerConnectionIceErrorEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTCPeerConnectionIceErrorEvent.h; sourceTree = "<group>"; };
 		419E6ED22567BF69002B5010 /* RTCRtpScriptTransformerContext.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCRtpScriptTransformerContext.idl; sourceTree = "<group>"; };
 		419E6ED52567BF6A002B5010 /* RTCRtpScriptTransformerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCRtpScriptTransformerContext.h; sourceTree = "<group>"; };
-		419E6ED82567D8D9002B5010 /* LibWebRTCRtpTransformableFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCRtpTransformableFrame.cpp; path = libwebrtc/LibWebRTCRtpTransformableFrame.cpp; sourceTree = "<group>"; };
 		419FAFAD1ABABCD5005B3572 /* ReadableStreamBYOBReader.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStreamBYOBReader.idl; sourceTree = "<group>"; };
 		419FAFAD1ABABCD5005B828B /* ReadableStreamDefaultReader.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStreamDefaultReader.idl; sourceTree = "<group>"; };
 		41A023ED1A39DB7900F722CF /* ReadableStream.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStream.idl; sourceTree = "<group>"; };
@@ -8178,7 +8177,7 @@
 		46EF14261F97B7BA00C2A524 /* ServiceWorkerWindowClient.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ServiceWorkerWindowClient.idl; sourceTree = "<group>"; };
 		46EF14271F97B7BA00C2A524 /* ServiceWorkerClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerClient.cpp; sourceTree = "<group>"; };
 		46EF14281F97B7BA00C2A524 /* ServiceWorkerClient.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ServiceWorkerClient.idl; sourceTree = "<group>"; };
-		46EFAF0D1E5FB9C200E7F34B /* LowPowerModeNotifierIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LowPowerModeNotifierIOS.mm; sourceTree = "<group>"; };
+		46EFAF0D1E5FB9C200E7F34B /* LowPowerModeNotifier.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LowPowerModeNotifier.mm; sourceTree = "<group>"; };
 		46EFAF0F1E5FB9E100E7F34B /* LowPowerModeNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LowPowerModeNotifier.cpp; sourceTree = "<group>"; };
 		46EFAF101E5FB9E100E7F34B /* LowPowerModeNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LowPowerModeNotifier.h; sourceTree = "<group>"; };
 		46F91BC91FCDD0FE001599C3 /* JSWorkerNavigatorCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerNavigatorCustom.cpp; sourceTree = "<group>"; };
@@ -24308,7 +24307,6 @@
 				1C43DE6A22AB4B8A001527D9 /* LocalCurrentTraitCollection.mm */,
 				E35B907C23F60677000011FF /* LocalizedDeviceModel.h */,
 				E35B907E23F60677000011FF /* LocalizedDeviceModel.mm */,
-				46EFAF0D1E5FB9C200E7F34B /* LowPowerModeNotifierIOS.mm */,
 				E39628C02395743000658ECD /* MotionManagerClient.h */,
 				E45390190EAFCACA003695C8 /* PasteboardIOS.mm */,
 				26601EBD14B3B9AD0012C0FE /* PlatformEventFactoryIOS.h */,
@@ -24467,6 +24465,7 @@
 				A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */,
 				06E81ED60AB5D5E900C87837 /* LocalCurrentGraphicsContext.h */,
 				1A4832B21A953BA6008B4DFE /* LocalizedStringsCocoa.mm */,
+				46EFAF0D1E5FB9C200E7F34B /* LowPowerModeNotifier.mm */,
 				939C0D282564E7F200B3211B /* MediaUtilities.cpp */,
 				939C0D292564E7F200B3211B /* MediaUtilities.h */,
 				C53D39331C97892D007F3AE9 /* MIMETypeRegistryCocoa.mm */,

Modified: trunk/Source/WebCore/platform/LowPowerModeNotifier.cpp (270405 => 270406)


--- trunk/Source/WebCore/platform/LowPowerModeNotifier.cpp	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WebCore/platform/LowPowerModeNotifier.cpp	2020-12-03 21:14:53 UTC (rev 270406)
@@ -28,7 +28,7 @@
 
 namespace WebCore {
 
-#if !PLATFORM(IOS_FAMILY) && !USE(GLIB)
+#if !HAVE(APPLE_LOW_POWER_MODE_SUPPORT) && !USE(GLIB)
 
 LowPowerModeNotifier::LowPowerModeNotifier(LowPowerModeChangeCallback&&)
 {

Modified: trunk/Source/WebCore/platform/LowPowerModeNotifier.h (270405 => 270406)


--- trunk/Source/WebCore/platform/LowPowerModeNotifier.h	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WebCore/platform/LowPowerModeNotifier.h	2020-12-03 21:14:53 UTC (rev 270406)
@@ -27,7 +27,7 @@
 
 #include <wtf/Function.h>
 
-#if PLATFORM(IOS_FAMILY)
+#if HAVE(APPLE_LOW_POWER_MODE_SUPPORT)
 #include <wtf/RetainPtr.h>
 OBJC_CLASS WebLowPowerModeObserver;
 #endif
@@ -49,7 +49,7 @@
     WEBCORE_EXPORT bool isLowPowerModeEnabled() const;
 
 private:
-#if PLATFORM(IOS_FAMILY)
+#if HAVE(APPLE_LOW_POWER_MODE_SUPPORT)
     void notifyLowPowerModeChanged(bool);
     friend void notifyLowPowerModeChanged(LowPowerModeNotifier&, bool);
 

Copied: trunk/Source/WebCore/platform/cocoa/LowPowerModeNotifier.mm (from rev 270404, trunk/Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm) (0 => 270406)


--- trunk/Source/WebCore/platform/cocoa/LowPowerModeNotifier.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/LowPowerModeNotifier.mm	2020-12-03 21:14:53 UTC (rev 270406)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#if HAVE(APPLE_LOW_POWER_MODE_SUPPORT)
+#import "LowPowerModeNotifier.h"
+
+#import "Logging.h"
+#import <Foundation/NSProcessInfo.h>
+#import <wtf/MainThread.h>
+
+@interface WebLowPowerModeObserver : NSObject
+@property (nonatomic) WebCore::LowPowerModeNotifier* notifier;
+@property (nonatomic, readonly) BOOL isLowPowerModeEnabled;
+@end
+
+@implementation WebLowPowerModeObserver {
+}
+
+- (WebLowPowerModeObserver *)initWithNotifier:(WebCore::LowPowerModeNotifier&)notifier
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _notifier = &notifier;
+    _isLowPowerModeEnabled = [NSProcessInfo processInfo].lowPowerModeEnabled;
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didReceiveLowPowerModeChange) name:NSProcessInfoPowerStateDidChangeNotification object:nil];
+    return self;
+}
+
+- (void)dealloc
+{
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:NSProcessInfoPowerStateDidChangeNotification object:nil];
+    [super dealloc];
+}
+
+- (void)_didReceiveLowPowerModeChange
+{
+    _isLowPowerModeEnabled = [NSProcessInfo processInfo].lowPowerModeEnabled;
+    // We need to make sure we notify the client on the main thread.
+    callOnMainThread([self, protectedSelf = RetainPtr<WebLowPowerModeObserver>(self)] {
+        if (_notifier)
+            notifyLowPowerModeChanged(*_notifier, _isLowPowerModeEnabled);
+    });
+}
+
+@end
+
+namespace WebCore {
+
+LowPowerModeNotifier::LowPowerModeNotifier(LowPowerModeChangeCallback&& callback)
+    : m_observer(adoptNS([[WebLowPowerModeObserver alloc] initWithNotifier:*this]))
+    , m_callback(WTFMove(callback))
+{
+}
+
+LowPowerModeNotifier::~LowPowerModeNotifier()
+{
+    m_observer.get().notifier = nil;
+}
+
+bool LowPowerModeNotifier::isLowPowerModeEnabled() const
+{
+    return m_observer.get().isLowPowerModeEnabled;
+}
+
+void LowPowerModeNotifier::notifyLowPowerModeChanged(bool enabled)
+{
+    m_callback(enabled);
+}
+
+void notifyLowPowerModeChanged(LowPowerModeNotifier& notifier, bool enabled)
+{
+    RELEASE_LOG(PerformanceLogging, "Low power mode state has changed to %d", enabled);
+    notifier.notifyLowPowerModeChanged(enabled);
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(APPLE_LOW_POWER_MODE_SUPPORT)

Modified: trunk/Source/WebCore/platform/gamepad/mac/MultiGamepadProvider.h (270405 => 270406)


--- trunk/Source/WebCore/platform/gamepad/mac/MultiGamepadProvider.h	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WebCore/platform/gamepad/mac/MultiGamepadProvider.h	2020-12-03 21:14:53 UTC (rev 270406)
@@ -29,6 +29,7 @@
 
 #include "GamepadProvider.h"
 #include "GamepadProviderClient.h"
+#include "PlatformGamepad.h"
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
 

Modified: trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.mm (270405 => 270406)


--- trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.mm	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.mm	2020-12-03 21:14:53 UTC (rev 270406)
@@ -36,6 +36,7 @@
 #import "FloatConversion.h"
 #import "GraphicsContextCG.h"
 #import "ImageBuffer.h"
+#import "Logging.h"
 #import "PlatformImageBuffer.h"
 #import "SourceGraphic.h"
 #import <CoreImage/CIContext.h>

Deleted: trunk/Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm (270405 => 270406)


--- trunk/Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm	2020-12-03 21:14:06 UTC (rev 270405)
+++ trunk/Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm	2020-12-03 21:14:53 UTC (rev 270406)
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-
-#if PLATFORM(IOS_FAMILY)
-
-#import "LowPowerModeNotifier.h"
-
-#import "Logging.h"
-#import <Foundation/NSProcessInfo.h>
-#import <wtf/MainThread.h>
-
-@interface WebLowPowerModeObserver : NSObject
-@property (nonatomic) WebCore::LowPowerModeNotifier* notifier;
-@property (nonatomic, readonly) BOOL isLowPowerModeEnabled;
-@end
-
-@implementation WebLowPowerModeObserver {
-}
-
-- (WebLowPowerModeObserver *)initWithNotifier:(WebCore::LowPowerModeNotifier&)notifier
-{
-    self = [super init];
-    if (!self)
-        return nil;
-
-    _notifier = &notifier;
-    _isLowPowerModeEnabled = [NSProcessInfo processInfo].lowPowerModeEnabled;
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didReceiveLowPowerModeChange) name:NSProcessInfoPowerStateDidChangeNotification object:nil];
-    return self;
-}
-
-- (void)dealloc
-{
-    [[NSNotificationCenter defaultCenter] removeObserver:self name:NSProcessInfoPowerStateDidChangeNotification object:nil];
-    [super dealloc];
-}
-
-- (void)_didReceiveLowPowerModeChange
-{
-    _isLowPowerModeEnabled = [NSProcessInfo processInfo].lowPowerModeEnabled;
-    // We need to make sure we notify the client on the main thread.
-    callOnMainThread([self, protectedSelf = RetainPtr<WebLowPowerModeObserver>(self)] {
-        if (_notifier)
-            notifyLowPowerModeChanged(*_notifier, _isLowPowerModeEnabled);
-    });
-}
-
-@end
-
-namespace WebCore {
-
-LowPowerModeNotifier::LowPowerModeNotifier(LowPowerModeChangeCallback&& callback)
-    : m_observer(adoptNS([[WebLowPowerModeObserver alloc] initWithNotifier:*this]))
-    , m_callback(WTFMove(callback))
-{
-}
-
-LowPowerModeNotifier::~LowPowerModeNotifier()
-{
-    m_observer.get().notifier = nil;
-}
-
-bool LowPowerModeNotifier::isLowPowerModeEnabled() const
-{
-    return m_observer.get().isLowPowerModeEnabled;
-}
-
-void LowPowerModeNotifier::notifyLowPowerModeChanged(bool enabled)
-{
-    m_callback(enabled);
-}
-
-void notifyLowPowerModeChanged(LowPowerModeNotifier& notifier, bool enabled)
-{
-    RELEASE_LOG(PerformanceLogging, "Low power mode state has changed to %d", enabled);
-    notifier.notifyLowPowerModeChanged(enabled);
-}
-
-} // namespace WebCore
-
-#endif // PLATFORM(IOS_FAMILY)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to