Title: [225477] trunk/Source
Revision
225477
Author
mcatanz...@igalia.com
Date
2017-12-04 07:15:43 -0800 (Mon, 04 Dec 2017)

Log Message

Source/WebCore:
[WPE][GTK] Implement PAL::SleepDisabler
https://bugs.webkit.org/show_bug.cgi?id=178485

Reviewed by Carlos Garcia Campos.

Add a comment to warn about some odd use of SleepDisabler in HTMLMediaElement.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldDisableSleep const):

Source/WebCore/PAL:
[WPE][GTK] Implement PAL::SleepDisabler
https://bugs.webkit.org/show_bug.cgi?id=178485

Reviewed by Carlos Garcia Campos.

* pal/PlatformGTK.cmake:
* pal/PlatformWPE.cmake:
* pal/system/SleepDisabler.cpp:
* pal/system/glib/SleepDisablerGLib.cpp: Added.
(PAL::SleepDisabler::create):
(PAL::SleepDisablerGLib::SleepDisablerGLib):
(PAL::SleepDisablerGLib::~SleepDisablerGLib):
(PAL::SleepDisablerGLib::acquireInhibitor):
(PAL::SleepDisablerGLib::releaseInhibitor):
* pal/system/glib/SleepDisablerGLib.h: Added.

Source/WebKit:
[GTK] Implement PAL::SleepDisabler
https://bugs.webkit.org/show_bug.cgi?id=178485

Reviewed by Carlos Garcia Campos.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseDispose):
(webkitWebViewBaseEnterFullScreen):
(webkitWebViewBaseExitFullScreen):
(screenSaverInhibitedCallback): Deleted.
(webkitWebViewBaseSendInhibitMessageToScreenSaver): Deleted.
(screenSaverProxyCreatedCallback): Deleted.
(webkitWebViewBaseInhibitScreenSaver): Deleted.
(webkitWebViewBaseUninhibitScreenSaver): Deleted.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (225476 => 225477)


--- trunk/Source/WebCore/ChangeLog	2017-12-04 11:34:41 UTC (rev 225476)
+++ trunk/Source/WebCore/ChangeLog	2017-12-04 15:15:43 UTC (rev 225477)
@@ -1,3 +1,15 @@
+2017-12-04  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [WPE][GTK] Implement PAL::SleepDisabler
+        https://bugs.webkit.org/show_bug.cgi?id=178485
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add a comment to warn about some odd use of SleepDisabler in HTMLMediaElement.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::shouldDisableSleep const):
+
 2017-12-04  Frederic Wang  <fw...@igalia.com>
 
         Bug 161300 - Move RenderMathMLRoot:RootType and RenderMathMLScripts:ScriptsType to element classes

Modified: trunk/Source/WebCore/PAL/ChangeLog (225476 => 225477)


--- trunk/Source/WebCore/PAL/ChangeLog	2017-12-04 11:34:41 UTC (rev 225476)
+++ trunk/Source/WebCore/PAL/ChangeLog	2017-12-04 15:15:43 UTC (rev 225477)
@@ -1,3 +1,21 @@
+2017-12-04  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [WPE][GTK] Implement PAL::SleepDisabler
+        https://bugs.webkit.org/show_bug.cgi?id=178485
+
+        Reviewed by Carlos Garcia Campos.
+
+        * pal/PlatformGTK.cmake:
+        * pal/PlatformWPE.cmake:
+        * pal/system/SleepDisabler.cpp:
+        * pal/system/glib/SleepDisablerGLib.cpp: Added.
+        (PAL::SleepDisabler::create):
+        (PAL::SleepDisablerGLib::SleepDisablerGLib):
+        (PAL::SleepDisablerGLib::~SleepDisablerGLib):
+        (PAL::SleepDisablerGLib::acquireInhibitor):
+        (PAL::SleepDisablerGLib::releaseInhibitor):
+        * pal/system/glib/SleepDisablerGLib.h: Added.
+
 2017-11-30  Stephan Szabo  <stephan.sz...@sony.com>
 
         Make LegacyCustomProtocolManager optional for network process

Modified: trunk/Source/WebCore/PAL/pal/PlatformGTK.cmake (225476 => 225477)


--- trunk/Source/WebCore/PAL/pal/PlatformGTK.cmake	2017-12-04 11:34:41 UTC (rev 225476)
+++ trunk/Source/WebCore/PAL/pal/PlatformGTK.cmake	2017-12-04 15:15:43 UTC (rev 225477)
@@ -3,6 +3,8 @@
 
     system/ClockGeneric.cpp
 
+    system/glib/SleepDisablerGLib.cpp
+
     system/gtk/SoundGtk.cpp
 
     text/KillRing.cpp

Modified: trunk/Source/WebCore/PAL/pal/PlatformWPE.cmake (225476 => 225477)


--- trunk/Source/WebCore/PAL/pal/PlatformWPE.cmake	2017-12-04 11:34:41 UTC (rev 225476)
+++ trunk/Source/WebCore/PAL/pal/PlatformWPE.cmake	2017-12-04 15:15:43 UTC (rev 225477)
@@ -4,6 +4,8 @@
     system/ClockGeneric.cpp
     system/Sound.cpp
 
+    system/glib/SleepDisablerGLib.cpp
+
     text/KillRing.cpp
 
     unix/LoggingUnix.cpp

Modified: trunk/Source/WebCore/PAL/pal/system/SleepDisabler.cpp (225476 => 225477)


--- trunk/Source/WebCore/PAL/pal/system/SleepDisabler.cpp	2017-12-04 11:34:41 UTC (rev 225476)
+++ trunk/Source/WebCore/PAL/pal/system/SleepDisabler.cpp	2017-12-04 15:15:43 UTC (rev 225477)
@@ -28,12 +28,12 @@
 
 namespace PAL {
 
-#if !PLATFORM(COCOA)
+#if !PLATFORM(COCOA) && !USE(GLIB)
 std::unique_ptr<SleepDisabler> SleepDisabler::create(const char* reason, Type type)
 {
     return std::unique_ptr<SleepDisabler>(new SleepDisabler(reason, type));
 }
-#endif // !PLATFORM(COCOA)
+#endif // !PLATFORM(COCOA) && !USE(GLIB)
 
 SleepDisabler::SleepDisabler(const char*, Type type)
     : m_type(type)

Added: trunk/Source/WebCore/PAL/pal/system/glib/SleepDisablerGLib.cpp (0 => 225477)


--- trunk/Source/WebCore/PAL/pal/system/glib/SleepDisablerGLib.cpp	                        (rev 0)
+++ trunk/Source/WebCore/PAL/pal/system/glib/SleepDisablerGLib.cpp	2017-12-04 15:15:43 UTC (rev 225477)
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "SleepDisablerGLib.h"
+
+#include <gio/gio.h>
+#include <wtf/glib/GUniquePtr.h>
+
+namespace PAL {
+
+std::unique_ptr<SleepDisabler> SleepDisabler::create(const char* reason, Type type)
+{
+    return std::unique_ptr<SleepDisabler>(new SleepDisablerGLib(reason, type));
+}
+
+SleepDisablerGLib::SleepDisablerGLib(const char* reason, Type type)
+    : SleepDisabler(reason, type)
+    , 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;
+
+    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),
+        nullptr, "org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", m_cancellable.get(),
+        [](GObject*, GAsyncResult* result, gpointer userData) {
+            GUniqueOutPtr<GError> error;
+            GRefPtr<GDBusProxy> proxy = adoptGRef(g_dbus_proxy_new_for_bus_finish(result, &error.outPtr()));
+            if (g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED))
+                return;
+
+            auto* self = static_cast<SleepDisablerGLib*>(userData);
+            if (proxy) {
+                GUniquePtr<char> nameOwner(g_dbus_proxy_get_name_owner(proxy.get()));
+                if (nameOwner) {
+                    self->m_screenSaverProxy = WTFMove(proxy);
+                    self->acquireInhibitor();
+                    return;
+                }
+            }
+
+            // Give up. Don't warn the user: this is expected.
+            self->m_cancellable = nullptr;
+        }, this);
+}
+
+SleepDisablerGLib::~SleepDisablerGLib()
+{
+    if (m_cancellable)
+        g_cancellable_cancel(m_cancellable.get());
+    else if (m_screenSaverCookie)
+        releaseInhibitor();
+}
+
+void SleepDisablerGLib::acquireInhibitor()
+{
+    ASSERT(m_screenSaverProxy);
+    g_dbus_proxy_call(m_screenSaverProxy.get(), "Inhibit", g_variant_new("(ss)", g_get_prgname(), m_reason.data()),
+        G_DBUS_CALL_FLAGS_NONE, -1, m_cancellable.get(), [](GObject* proxy, GAsyncResult* result, gpointer userData) {
+            GUniqueOutPtr<GError> error;
+            GRefPtr<GVariant> returnValue = adoptGRef(g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), result, &error.outPtr()));
+            if (g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED))
+                return;
+
+            auto* self = static_cast<SleepDisablerGLib*>(userData);
+            if (error)
+                g_warning("Calling %s.Inhibit failed: %s", g_dbus_proxy_get_interface_name(self->m_screenSaverProxy.get()), error->message);
+            else {
+                ASSERT(returnValue);
+                g_variant_get(returnValue.get(), "(u)", &self->m_screenSaverCookie);
+            }
+            self->m_cancellable = nullptr;
+        }, this);
+}
+
+void SleepDisablerGLib::releaseInhibitor()
+{
+    ASSERT(m_screenSaverCookie);
+    ASSERT(m_screenSaverProxy);
+
+    g_dbus_proxy_call(m_screenSaverProxy.get(), "UnInhibit", g_variant_new("(u)", m_screenSaverCookie),
+        G_DBUS_CALL_FLAGS_NONE, -1, nullptr, [](GObject* proxy, GAsyncResult* result, gpointer) {
+            GUniqueOutPtr<GError> error;
+            GRefPtr<GVariant> returnValue = adoptGRef(g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), result, &error.outPtr()));
+            if (error)
+                g_warning("Calling %s.UnInhibit failed: %s", g_dbus_proxy_get_interface_name(G_DBUS_PROXY(proxy)), error->message);
+    }, nullptr);
+}
+
+} // namespace PAL

Added: trunk/Source/WebCore/PAL/pal/system/glib/SleepDisablerGLib.h (0 => 225477)


--- trunk/Source/WebCore/PAL/pal/system/glib/SleepDisablerGLib.h	                        (rev 0)
+++ trunk/Source/WebCore/PAL/pal/system/glib/SleepDisablerGLib.h	2017-12-04 15:15:43 UTC (rev 225477)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include "SleepDisabler.h"
+
+#include <wtf/glib/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+typedef struct _GDBusProxy GDBusProxy;
+
+namespace PAL {
+
+class SleepDisablerGLib : public SleepDisabler {
+public:
+    SleepDisablerGLib(const char*, Type);
+    virtual ~SleepDisablerGLib();
+
+private:
+    void acquireInhibitor();
+    void releaseInhibitor();
+
+    GRefPtr<GDBusProxy> m_screenSaverProxy;
+    unsigned m_screenSaverCookie { 0 };
+
+    GRefPtr<GCancellable> m_cancellable;
+    CString m_reason;
+};
+
+} // namespace PAL

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (225476 => 225477)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2017-12-04 11:34:41 UTC (rev 225476)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2017-12-04 15:15:43 UTC (rev 225477)
@@ -6607,6 +6607,7 @@
 
 HTMLMediaElement::SleepType HTMLMediaElement::shouldDisableSleep() const
 {
+    // See https://bugs.webkit.org/show_bug.cgi?id=180197 before removing this guard.
 #if !PLATFORM(COCOA)
     return SleepType::None;
 #endif

Modified: trunk/Source/WebKit/ChangeLog (225476 => 225477)


--- trunk/Source/WebKit/ChangeLog	2017-12-04 11:34:41 UTC (rev 225476)
+++ trunk/Source/WebKit/ChangeLog	2017-12-04 15:15:43 UTC (rev 225477)
@@ -1,3 +1,20 @@
+2017-12-04  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [GTK] Implement PAL::SleepDisabler
+        https://bugs.webkit.org/show_bug.cgi?id=178485
+
+        Reviewed by Carlos Garcia Campos.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseDispose):
+        (webkitWebViewBaseEnterFullScreen):
+        (webkitWebViewBaseExitFullScreen):
+        (screenSaverInhibitedCallback): Deleted.
+        (webkitWebViewBaseSendInhibitMessageToScreenSaver): Deleted.
+        (screenSaverProxyCreatedCallback): Deleted.
+        (webkitWebViewBaseInhibitScreenSaver): Deleted.
+        (webkitWebViewBaseUninhibitScreenSaver): Deleted.
+
 2017-12-03  Yusuke Suzuki  <utatane....@gmail.com>
 
         WTF shouldn't have both Thread and ThreadIdentifier

Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (225476 => 225477)


--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp	2017-12-04 11:34:41 UTC (rev 225476)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp	2017-12-04 15:15:43 UTC (rev 225477)
@@ -63,6 +63,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n-lib.h>
 #include <memory>
+#include <pal/system/SleepDisabler.h>
 #include <wtf/HashMap.h>
 #include <wtf/glib/GRefPtr.h>
 #include <wtf/glib/WTFGType.h>
@@ -190,9 +191,7 @@
 
 #if ENABLE(FULLSCREEN_API)
     bool fullScreenModeActive { false };
-    GRefPtr<GDBusProxy> screenSaverProxy;
-    GRefPtr<GCancellable> screenSaverInhibitCancellable;
-    unsigned screenSaverCookie { 0 };
+    std::unique_ptr<PAL::SleepDisabler> sleepDisabler;
 #endif
 
     std::unique_ptr<AcceleratedBackingStore> acceleratedBackingStore;
@@ -500,10 +499,10 @@
 static void webkitWebViewBaseDispose(GObject* gobject)
 {
     WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(gobject);
-    g_cancellable_cancel(webView->priv->screenSaverInhibitCancellable.get());
     webkitWebViewBaseSetToplevelOnScreenWindow(webView, nullptr);
     webView->priv->pageProxy->close();
     webView->priv->acceleratedBackingStore = nullptr;
+    webView->priv->sleepDisabler = nullptr;
     G_OBJECT_CLASS(webkit_web_view_base_parent_class)->dispose(gobject);
 }
 
@@ -1231,75 +1230,6 @@
     webkitWebViewBase->priv->shouldForwardNextWheelEvent = true;
 }
 
-#if ENABLE(FULLSCREEN_API)
-static void screenSaverInhibitedCallback(GDBusProxy* screenSaverProxy, GAsyncResult* result, WebKitWebViewBase* webViewBase)
-{
-    GRefPtr<GVariant> returnValue = adoptGRef(g_dbus_proxy_call_finish(screenSaverProxy, result, nullptr));
-    if (returnValue)
-        g_variant_get(returnValue.get(), "(u)", &webViewBase->priv->screenSaverCookie);
-    webViewBase->priv->screenSaverInhibitCancellable = nullptr;
-}
-
-static void webkitWebViewBaseSendInhibitMessageToScreenSaver(WebKitWebViewBase* webViewBase)
-{
-    WebKitWebViewBasePrivate* priv = webViewBase->priv;
-    ASSERT(priv->screenSaverProxy);
-    priv->screenSaverCookie = 0;
-    if (!priv->screenSaverInhibitCancellable)
-        priv->screenSaverInhibitCancellable = adoptGRef(g_cancellable_new());
-    g_dbus_proxy_call(priv->screenSaverProxy.get(), "Inhibit", g_variant_new("(ss)", g_get_prgname(), _("Website running in fullscreen mode")),
-        G_DBUS_CALL_FLAGS_NONE, -1, priv->screenSaverInhibitCancellable.get(), reinterpret_cast<GAsyncReadyCallback>(screenSaverInhibitedCallback), webViewBase);
-}
-
-static void screenSaverProxyCreatedCallback(GObject*, GAsyncResult* result, WebKitWebViewBase* webViewBase)
-{
-    // WebKitWebViewBase cancels the proxy creation on dispose, which means this could be called
-    // after the web view has been destroyed and g_dbus_proxy_new_for_bus_finish will return nullptr.
-    // So, make sure we don't use the web view unless we have a valid proxy.
-    // See https://bugs.webkit.org/show_bug.cgi?id=151653.
-    GRefPtr<GDBusProxy> proxy = adoptGRef(g_dbus_proxy_new_for_bus_finish(result, nullptr));
-    if (!proxy)
-        return;
-
-    webViewBase->priv->screenSaverProxy = proxy;
-    webkitWebViewBaseSendInhibitMessageToScreenSaver(webViewBase);
-}
-
-static void webkitWebViewBaseInhibitScreenSaver(WebKitWebViewBase* webViewBase)
-{
-    WebKitWebViewBasePrivate* priv = webViewBase->priv;
-    if (priv->screenSaverCookie) {
-        // Already inhibited.
-        return;
-    }
-
-    if (priv->screenSaverProxy) {
-        webkitWebViewBaseSendInhibitMessageToScreenSaver(webViewBase);
-        return;
-    }
-
-    priv->screenSaverInhibitCancellable = adoptGRef(g_cancellable_new());
-    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),
-        nullptr, "org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", priv->screenSaverInhibitCancellable.get(),
-        reinterpret_cast<GAsyncReadyCallback>(screenSaverProxyCreatedCallback), webViewBase);
-}
-
-static void webkitWebViewBaseUninhibitScreenSaver(WebKitWebViewBase* webViewBase)
-{
-    WebKitWebViewBasePrivate* priv = webViewBase->priv;
-    if (!priv->screenSaverCookie) {
-        // Not inhibited or it's being inhibited.
-        g_cancellable_cancel(priv->screenSaverInhibitCancellable.get());
-        return;
-    }
-
-    // If we have a cookie we should have a proxy.
-    ASSERT(priv->screenSaverProxy);
-    g_dbus_proxy_call(priv->screenSaverProxy.get(), "UnInhibit", g_variant_new("(u)", priv->screenSaverCookie), G_DBUS_CALL_FLAGS_NONE, -1, nullptr, nullptr, nullptr);
-    priv->screenSaverCookie = 0;
-}
-#endif
-
 void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase* webkitWebViewBase)
 {
 #if ENABLE(FULLSCREEN_API)
@@ -1314,7 +1244,7 @@
         gtk_window_fullscreen(GTK_WINDOW(topLevelWindow));
     fullScreenManagerProxy->didEnterFullScreen();
     priv->fullScreenModeActive = true;
-    webkitWebViewBaseInhibitScreenSaver(webkitWebViewBase);
+    priv->sleepDisabler = PAL::SleepDisabler::create(_("Website running in fullscreen mode"), PAL::SleepDisabler::Type::Display);
 #endif
 }
 
@@ -1332,7 +1262,7 @@
         gtk_window_unfullscreen(GTK_WINDOW(topLevelWindow));
     fullScreenManagerProxy->didExitFullScreen();
     priv->fullScreenModeActive = false;
-    webkitWebViewBaseUninhibitScreenSaver(webkitWebViewBase);
+    priv->sleepDisabler = nullptr;
 #endif
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to