[GTK] Environment variables for enabling/disabling AC mode should take precedence...
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jan 2017 08:57:21 +0000 (08:57 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jan 2017 08:57:21 +0000 (08:57 +0000)
commit87218e07448da831b172a49b556127a9eb6421dd
tree433599baa3653b44a13b666f2f9348d9c0be078b
parentd4e641289664820d6f643cff6afdd6779fbab8a8
[GTK] Environment variables for enabling/disabling AC mode should take precedence over the API.
https://bugs.webkit.org/show_bug.cgi?id=167605

Reviewed by Žan Doberšek.

Add HardwareAccelerationManager singleton helper to handle the global values for enabling, disabling or forcing
accelerated compositing. This is used by WebPreferences to initialize the values like always, but also by
WebKitSettings to ensure those values are honored and are not changed when it's not possible. This new class can
be used in the future to implement the GPU blacklist.

* PlatformGTK.cmake: Add new files to compilation.
* UIProcess/API/gtk/WebKitSettings.cpp:
(webkit_settings_class_init): Document that the setting depends on actual hardware capabilities.
(webkit_settings_set_hardware_acceleration_policy): Check HardwareAccelerationManager before trying to change
the settings.
* UIProcess/gtk/HardwareAccelerationManager.cpp: Added.
(WebKit::HardwareAccelerationManager::singleton):
(WebKit::HardwareAccelerationManager::HardwareAccelerationManager): Initialize m_canUseHardwareAcceleration and
m_forceHardwareAcceleration dependoing on hardware and system capabilites and
WEBKIT_DISABLE_COMPOSITING_MODE/WEBKIT_FORCE_COMPOSITING_MODE variables.
* UIProcess/gtk/HardwareAccelerationManager.h: Added.
(WebKit::HardwareAccelerationManager::canUseHardwareAcceleration):
(WebKit::HardwareAccelerationManager::forceHardwareAcceleration):
* UIProcess/gtk/WebPreferencesGtk.cpp:
(WebKit::WebPreferences::platformInitializeStore): Use HardwareAccelerationManager to set the initial values.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211412 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
Source/WebKit2/UIProcess/gtk/HardwareAccelerationManager.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/gtk/HardwareAccelerationManager.h [new file with mode: 0644]
Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp