Title: [241290] trunk/Source/WebCore/PAL
Revision
241290
Author
[email protected]
Date
2019-02-12 01:29:46 -0800 (Tue, 12 Feb 2019)

Log Message

[WPE][GTK] Sleep disabler code should inhibit idle when a "System" sleep disabler is requested
https://bugs.webkit.org/show_bug.cgi?id=194500

Reviewed by Carlos Garcia Campos.

There are three things wrong with the comment at the top of SleepDisablerGLib's constructor:

(1) Nowadays, GNOME suspends the computer automatically on inactivity, and we actually do
    want to prevent that.

(2) Inhibiting idle does affect the autosuspend countdown. So the current code should
    prevent automatic suspend, just not manual suspend. (I think I stand by my comment that
    we do not want to inhibit normal suspend, since that would just be annoying.)

(3) I don't know why I thought HTMLMediaElement::shouldDisableSleep was suspicious.

Anyway, the behavior we want is to ignore the Type argument and just always inhibit idle.
That is, treat type=System the same way we current treat type=Display.

* pal/system/glib/SleepDisablerGLib.cpp:
(PAL::SleepDisablerGLib::SleepDisablerGLib):

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (241289 => 241290)


--- trunk/Source/WebCore/PAL/ChangeLog	2019-02-12 09:28:44 UTC (rev 241289)
+++ trunk/Source/WebCore/PAL/ChangeLog	2019-02-12 09:29:46 UTC (rev 241290)
@@ -1,3 +1,27 @@
+2019-02-12  Michael Catanzaro  <[email protected]>
+
+        [WPE][GTK] Sleep disabler code should inhibit idle when a "System" sleep disabler is requested
+        https://bugs.webkit.org/show_bug.cgi?id=194500
+
+        Reviewed by Carlos Garcia Campos.
+
+        There are three things wrong with the comment at the top of SleepDisablerGLib's constructor:
+
+        (1) Nowadays, GNOME suspends the computer automatically on inactivity, and we actually do
+            want to prevent that.
+
+        (2) Inhibiting idle does affect the autosuspend countdown. So the current code should
+            prevent automatic suspend, just not manual suspend. (I think I stand by my comment that
+            we do not want to inhibit normal suspend, since that would just be annoying.)
+
+        (3) I don't know why I thought HTMLMediaElement::shouldDisableSleep was suspicious.
+
+        Anyway, the behavior we want is to ignore the Type argument and just always inhibit idle.
+        That is, treat type=System the same way we current treat type=Display.
+
+        * pal/system/glib/SleepDisablerGLib.cpp:
+        (PAL::SleepDisablerGLib::SleepDisablerGLib):
+
 2019-02-11  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Ask platform for generic font family mappings

Modified: trunk/Source/WebCore/PAL/pal/system/glib/SleepDisablerGLib.cpp (241289 => 241290)


--- trunk/Source/WebCore/PAL/pal/system/glib/SleepDisablerGLib.cpp	2019-02-12 09:28:44 UTC (rev 241289)
+++ trunk/Source/WebCore/PAL/pal/system/glib/SleepDisablerGLib.cpp	2019-02-12 09:29:46 UTC (rev 241290)
@@ -41,15 +41,13 @@
     , m_cancellable(adoptGRef(g_cancellable_new()))
     , m_reason(reason)
 {
-    // We don't support suspend ("System") inhibitors, only idle inhibitors.
-    // To get suspend inhibitors, we'd need to use the fancy GNOME
-    // SessionManager API, which requires registering as a client application,
-    // which is not practical from the web process. Secondly, because the only
-    // current use of a suspend inhibitor in WebKit,
-    // HTMLMediaElement::shouldDisableSleep, is suspicious. There's really no
-    // valid reason for WebKit to ever block suspend, only idle.
-    if (type != SleepDisabler::Type::Display)
-        return;
+    // We ignore Type because we always want to inhibit both screen lock and
+    // suspend, but only when idle. There is no reason for WebKit to ever block
+    // a user from manually suspending the computer, so inhibiting idle
+    // suffices. There's also probably no good reason for code taking a sleep
+    // disabler to differentiate between lock and suspend on our platform. If we
+    // ever need this distinction, which seems unlikely, then we'll need to
+    // audit all use of SleepDisabler.
 
     // First, try to use the ScreenSaver API.
     g_dbus_proxy_new_for_bus(G_BUS_TYPE_SESSION, static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS),
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to