Skip to content
Permalink
Browse files

Add a setting for Chromium's low-end device mode

See #4039
See #2377
  • Loading branch information...
The-Compiler committed Sep 17, 2018
1 parent 574d7c6 commit 6fe09c12daccc5f9819603ab7cac5c2195c7792a
@@ -34,6 +34,8 @@ Added
* Opening PDFs on https:// sites now works properly.
- New `qt.process_model` setting which can be used to change Chromium's process
model.
- New `qt.low_end_device_mode` setting which turns on Chromium's low-end device
mode. This mode uses less RAM, but the expense of performance.
Changed
~~~~~~~
@@ -229,6 +229,7 @@
|<<qt.force_platform,qt.force_platform>>|Force a Qt platform to use.
|<<qt.force_software_rendering,qt.force_software_rendering>>|Force software rendering for QtWebEngine.
|<<qt.highdpi,qt.highdpi>>|Turn on Qt HighDPI scaling.
|<<qt.low_end_device_mode,qt.low_end_device_mode>>|Use Chromium's low-end device mode.
|<<qt.process_model,qt.process_model>>|Which Chromium process model to use.
|<<scrolling.bar,scrolling.bar>>|Show a scrollbar.
|<<scrolling.smooth,scrolling.smooth>>|Enable smooth scrolling for web pages.
@@ -2758,6 +2759,24 @@ Type: <<types,Bool>>

Default: +pass:[false]+

[[qt.low_end_device_mode]]
=== qt.low_end_device_mode
Use Chromium's low-end device mode.
This improves the RAM usage of renderer processes, at the expense of performance.
This setting requires a restart.

Type: <<types,String>>

Valid values:

* +force-on+: Always use low-end device mode.
* +auto+: Decide automatically (uses low-end mode with < 1 GB available RAM).
* +force-off+: Never use low-end device mode.

Default: +pass:[auto]+

This setting is only available with the QtWebEngine backend.

[[qt.process_model]]
=== qt.process_model
Which Chromium process model to use.
@@ -210,6 +210,23 @@ qt.process_model:
- https://www.chromium.org/developers/design-documents/process-models
- https://doc.qt.io/qt-5/qtwebengine-features.html#process-models
qt.low_end_device_mode:
type:
name: String
valid_values:
- force-on: Always use low-end device mode.
- auto: Decide automatically (uses low-end mode with < 1 GB available
RAM).
- force-off: Never use low-end device mode.

This comment has been minimized.

Copy link
@mschilli87

mschilli87 Sep 18, 2018

Contributor

Why don't we call the options "always", "never", and "auto" (cf. content.headers.referer)?

This comment has been minimized.

Copy link
@The-Compiler

The-Compiler Sep 18, 2018

Author Collaborator

Good idea! Did so in 46435bc.

default: auto
backend: QtWebEngine
restart: true
desc: >-
Use Chromium's low-end device mode.

This comment has been minimized.

Copy link
@mschilli87

mschilli87 Sep 18, 2018

Contributor

If we switch to "always" and "never", we could standardize this further by starting with "When to use..."

This improves the RAM usage of renderer processes, at the expense of
performance.
qt.highdpi:
type: Bool
default: false
@@ -202,4 +202,15 @@ def qt_args(namespace):
raise utils.Unreachable("Unknown process model {}"
.format(process_model))

low_end_device_mode = config.val.qt.low_end_device_mode
if low_end_device_mode == 'auto':
pass
elif low_end_device_mode == 'force-on':
argv.append('--enable-low-end-device-mode')
elif low_end_device_mode == 'force-off':
argv.append('--disable-low-end-device-mode')
else:
raise utils.Unreachable("Unknown low-end device mode {}"
.format(low_end_device_mode))

return argv
@@ -492,6 +492,26 @@ def test_process_model(self, config_stub, monkeypatch, parser,
assert '--process-per-site-instance' not in args
assert '--process-per-tab' not in args

@pytest.mark.parametrize('low_end_device_mode, arg', [
('auto', None),
('force-on', '--enable-low-end-device-mode'),
('force-off', '--disable-low-end-device-mode'),
])
def test_low_end_device_mode(self, config_stub, monkeypatch, parser,
low_end_device_mode, arg):
monkeypatch.setattr(configinit.objects, 'backend',
usertypes.Backend.QtWebEngine)

config_stub.val.qt.low_end_device_mode = low_end_device_mode
parsed = parser.parse_args([])
args = configinit.qt_args(parsed)

if arg is None:
assert '--enable-low-end-device-mode' not in args
assert '--disable-low-end-device-mode' not in args
else:
assert arg in args


@pytest.mark.parametrize('arg, confval, used', [
# overridden by commandline arg

1 comment on commit 6fe09c1

@The-Compiler

This comment has been minimized.

Copy link
Collaborator Author

The-Compiler commented on 6fe09c1 Sep 17, 2018

@mschilli87 I should probably have opened a PR, but mind looking at the configdata.yml changes here? (2/4)

Please sign in to comment.
You can’t perform that action at this time.