[GLib] Let WebCore know of low power situations
authorgns@gnome.org <gns@gnome.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 07:46:25 +0000 (07:46 +0000)
committergns@gnome.org <gns@gnome.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 07:46:25 +0000 (07:46 +0000)
commit59858d961d9e53adbb136b01dde99c4513cdff97
tree7b0c21c214295f87cd530bf641e82e8d6edf4e61
parent50839b9b620ed7f0bceb0a1c0f9de34c8eb5484c
[GLib] Let WebCore know of low power situations
https://bugs.webkit.org/show_bug.cgi?id=177810

Reviewed by Carlos Garcia Campos.

.:

WebCore can use knowledge of low power situations to throttle timers and avoid expensive
checks, lowering power usage. We can use upower's warning level to let WebCore know we are
in such a situation.

* Source/cmake/OptionsGTK.cmake: depend on upower-glib.
* Source/cmake/FindUPowerGLib.cmake: Added.

Source/WebCore:

WebCore can use knowledge of low power situations to throttle timers and avoid expensive
checks, lowering power usage. We can use upower's warning level to let WebCore know we are
in such a situation.

No tests as there is no way to mock upower.

* PlatformGTK.cmake: add new file.
* PlatformWPE.cmake: add new file.
* platform/LowPowerModeNotifier.cpp: use upower-glib to know about low power situations.
* platform/LowPowerModeNotifier.h: includes upower header as UpClient and UpDevice are not forward
declaration-friendly.
* platform/glib/LowPowerModeNotifierGLib.cpp: Added.
(WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
(WebCore::LowPowerModeNotifier::updateState): update low power mode from warning-level.
(WebCore::LowPowerModeNotifier::warningLevelCallback): track upower's warning-level to know when
a low power situation occurs.
(WebCore::LowPowerModeNotifier::~LowPowerModeNotifier): stop tracking the warning-level signal.
(WebCore::LowPowerModeNotifier::isLowPowerModeEnabled const):

Tools:

* gtk/install-dependencies: add upower-glib dev packages for Debian, Arch and Fedora.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/PlatformGTK.cmake
Source/WebCore/PlatformWPE.cmake
Source/WebCore/platform/LowPowerModeNotifier.cpp
Source/WebCore/platform/LowPowerModeNotifier.h
Source/WebCore/platform/glib/LowPowerModeNotifierGLib.cpp [new file with mode: 0644]
Source/cmake/FindUPowerGLib.cmake [new file with mode: 0644]
Source/cmake/OptionsGTK.cmake
Tools/ChangeLog
Tools/gtk/install-dependencies