Title: [222723] trunk/Source/WebCore
- Revision
- 222723
- Author
- [email protected]
- Date
- 2017-10-02 11:08:06 -0700 (Mon, 02 Oct 2017)
Log Message
[GLib] NetworkStateNotifier implementation missing
https://bugs.webkit.org/show_bug.cgi?id=177741
Patch by Gustavo Noronha Silva <[email protected]> on 2017-10-02
Reviewed by Carlos Garcia Campos.
No new tests. The DOM support is already being tested, but we would need a way
of simulating a network outage to test GNetworkMonitor.
* PlatformGTK.cmake: add new file.
* PlatformWPE.cmake: add new file.
* platform/network/NetworkStateNotifier.cpp: no longer need the empty implementations, all platforms covered.
* platform/network/NetworkStateNotifier.h:
* platform/network/glib/NetworkStateNotifierGLib.cpp: Added.
(WebCore::NetworkStateNotifier::updateStateWithoutNotifying): update the network state using GNetworkMonitor's availability.
(WebCore::NetworkStateNotifier::networkChangedCallback): when network-changed is emitted, trigger a state update.
(WebCore::NetworkStateNotifier::startObserving): watch GNetworkMonitor's network-changed signal.
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (222722 => 222723)
--- trunk/Source/WebCore/ChangeLog 2017-10-02 18:04:01 UTC (rev 222722)
+++ trunk/Source/WebCore/ChangeLog 2017-10-02 18:08:06 UTC (rev 222723)
@@ -1,3 +1,22 @@
+2017-10-02 Gustavo Noronha Silva <[email protected]>
+
+ [GLib] NetworkStateNotifier implementation missing
+ https://bugs.webkit.org/show_bug.cgi?id=177741
+
+ Reviewed by Carlos Garcia Campos.
+
+ No new tests. The DOM support is already being tested, but we would need a way
+ of simulating a network outage to test GNetworkMonitor.
+
+ * PlatformGTK.cmake: add new file.
+ * PlatformWPE.cmake: add new file.
+ * platform/network/NetworkStateNotifier.cpp: no longer need the empty implementations, all platforms covered.
+ * platform/network/NetworkStateNotifier.h:
+ * platform/network/glib/NetworkStateNotifierGLib.cpp: Added.
+ (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): update the network state using GNetworkMonitor's availability.
+ (WebCore::NetworkStateNotifier::networkChangedCallback): when network-changed is emitted, trigger a state update.
+ (WebCore::NetworkStateNotifier::startObserving): watch GNetworkMonitor's network-changed signal.
+
2017-10-02 Olivier Blin <[email protected]>
Fix build with MathML disabled
Modified: trunk/Source/WebCore/PlatformGTK.cmake (222722 => 222723)
--- trunk/Source/WebCore/PlatformGTK.cmake 2017-10-02 18:04:01 UTC (rev 222722)
+++ trunk/Source/WebCore/PlatformGTK.cmake 2017-10-02 18:08:06 UTC (rev 222723)
@@ -107,6 +107,8 @@
platform/gtk/ScrollAnimatorGtk.cpp
platform/gtk/SelectionData.cpp
+ platform/network/glib/NetworkStateNotifierGLib.cpp
+
platform/network/soup/AuthenticationChallengeSoup.cpp
platform/network/soup/CertificateInfo.cpp
platform/network/soup/CookieJarSoup.cpp
Modified: trunk/Source/WebCore/PlatformWPE.cmake (222722 => 222723)
--- trunk/Source/WebCore/PlatformWPE.cmake 2017-10-02 18:04:01 UTC (rev 222722)
+++ trunk/Source/WebCore/PlatformWPE.cmake 2017-10-02 18:08:06 UTC (rev 222723)
@@ -97,6 +97,8 @@
platform/graphics/wpe/PlatformDisplayWPE.cpp
+ platform/network/glib/NetworkStateNotifierGLib.cpp
+
platform/network/soup/AuthenticationChallengeSoup.cpp
platform/network/soup/CertificateInfo.cpp
platform/network/soup/CookieJarSoup.cpp
Modified: trunk/Source/WebCore/platform/network/NetworkStateNotifier.cpp (222722 => 222723)
--- trunk/Source/WebCore/platform/network/NetworkStateNotifier.cpp 2017-10-02 18:04:01 UTC (rev 222722)
+++ trunk/Source/WebCore/platform/network/NetworkStateNotifier.cpp 2017-10-02 18:08:06 UTC (rev 222723)
@@ -75,18 +75,4 @@
m_updateStateTimer.startOneShot(updateStateSoonInterval);
}
-#if !PLATFORM(IOS) && !PLATFORM(MAC) && !PLATFORM(WIN)
-
-// Empty stubs for platforms where monitoring of network state is not yet implemented.
-
-void NetworkStateNotifier::updateStateWithoutNotifying()
-{
-}
-
-void NetworkStateNotifier::startObserving()
-{
-}
-
-#endif
-
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/NetworkStateNotifier.h (222722 => 222723)
--- trunk/Source/WebCore/platform/network/NetworkStateNotifier.h 2017-10-02 18:04:01 UTC (rev 222722)
+++ trunk/Source/WebCore/platform/network/NetworkStateNotifier.h 2017-10-02 18:08:06 UTC (rev 222723)
@@ -67,6 +67,10 @@
static void CALLBACK addressChangeCallback(void*, BOOLEAN timedOut);
#endif
+#if PLATFORM(GTK) || PLATFORM(WPE)
+ static void networkChangedCallback(NetworkStateNotifier*);
+#endif
+
std::optional<bool> m_isOnLine;
Vector<WTF::Function<void(bool)>> m_listeners;
Timer m_updateStateTimer;
Added: trunk/Source/WebCore/platform/network/glib/NetworkStateNotifierGLib.cpp (0 => 222723)
--- trunk/Source/WebCore/platform/network/glib/NetworkStateNotifierGLib.cpp (rev 0)
+++ trunk/Source/WebCore/platform/network/glib/NetworkStateNotifierGLib.cpp 2017-10-02 18:08:06 UTC (rev 222723)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "NetworkStateNotifier.h"
+
+#include <gio/gio.h>
+
+namespace WebCore {
+
+void NetworkStateNotifier::updateStateWithoutNotifying()
+{
+ m_isOnLine = g_network_monitor_get_network_available(g_network_monitor_get_default());
+}
+
+void NetworkStateNotifier::networkChangedCallback(NetworkStateNotifier* networkStateNotifier)
+{
+ networkStateNotifier->singleton().updateStateSoon();
+}
+
+void NetworkStateNotifier::startObserving()
+{
+ g_signal_connect_swapped(g_network_monitor_get_default(), "network-changed", G_CALLBACK(networkChangedCallback), this);
+}
+
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes