Title: [217959] trunk/Source/WebCore
Revision
217959
Author
[email protected]
Date
2017-06-08 19:59:41 -0700 (Thu, 08 Jun 2017)

Log Message

[iOS] LowPowerModeNotifier notifies client on non-main thread
https://bugs.webkit.org/show_bug.cgi?id=173115
<rdar://problem/32644703>

Reviewed by Ryosuke Niwa.

Update iOS's implementation of the LowPowerModeNotifier to make sure
we notify the client of low power mode changes on the main thread.

* platform/ios/LowPowerModeNotifierIOS.mm:
(-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (217958 => 217959)


--- trunk/Source/WebCore/ChangeLog	2017-06-09 02:13:06 UTC (rev 217958)
+++ trunk/Source/WebCore/ChangeLog	2017-06-09 02:59:41 UTC (rev 217959)
@@ -1,3 +1,17 @@
+2017-06-08  Chris Dumez  <[email protected]>
+
+        [iOS] LowPowerModeNotifier notifies client on non-main thread
+        https://bugs.webkit.org/show_bug.cgi?id=173115
+        <rdar://problem/32644703>
+
+        Reviewed by Ryosuke Niwa.
+
+        Update iOS's implementation of the LowPowerModeNotifier to make sure
+        we notify the client of low power mode changes on the main thread.
+
+        * platform/ios/LowPowerModeNotifierIOS.mm:
+        (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
+
 2017-06-08  Ryosuke Niwa  <[email protected]>
 
         Crash inside InsertNodeBeforeCommand via InsertParagraphSeparatorCommand

Modified: trunk/Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm (217958 => 217959)


--- trunk/Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm	2017-06-09 02:13:06 UTC (rev 217958)
+++ trunk/Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm	2017-06-09 02:59:41 UTC (rev 217959)
@@ -30,6 +30,7 @@
 
 #import "Logging.h"
 #import <Foundation/NSProcessInfo.h>
+#import <wtf/MainThread.h>
 
 @interface WebLowPowerModeObserver : NSObject
 @property (nonatomic) WebCore::LowPowerModeNotifier* notifier;
@@ -60,7 +61,10 @@
 - (void)_didReceiveLowPowerModeChange
 {
     _isLowPowerModeEnabled = [NSProcessInfo processInfo].lowPowerModeEnabled;
-    notifyLowPowerModeChanged(_notifier, _isLowPowerModeEnabled);
+    // We need to make sure we notify the client on the main thread.
+    callOnMainThread([notifier = _notifier, isLowPowerModeEnabled = _isLowPowerModeEnabled] {
+        notifyLowPowerModeChanged(notifier, isLowPowerModeEnabled);
+    });
 }
 
 @end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to