Add headless chrome option

Using `--headless` chromium-browser option, we run all Brozzler without
requiring an X display.
https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Benchmarks are ~20% faster using `--headless`.

This option was introduced in chromium-browser 59 but was unstable. I've
tested it with v73.0.3683.86 and its running well.

With this PR, we add it as an option that is disabled by default.
This commit is contained in:
Vangelis Banos 2019-05-11 16:08:21 +00:00
parent 16f886259d
commit a8f351f771

View File

@ -134,12 +134,13 @@ class Chrome:
cookie_location, exc_info=True)
return cookie_db
def start(self, proxy=None, cookie_db=None, disk_cache_dir=None,
disk_cache_size=None):
def start(self, headless=False, proxy=None, cookie_db=None,
disk_cache_dir=None, disk_cache_size=None):
'''
Starts chrome/chromium process.
Args:
headless: run in headless mode, without X windows (default: False)
proxy: http proxy 'host:port' (default None)
cookie_db: raw bytes of chrome/chromium sqlite3 cookies database,
which, if supplied, will be written to
@ -176,7 +177,8 @@ class Chrome:
'--homepage=about:blank', '--disable-direct-npapi-requests',
'--disable-web-security', '--disable-notifications',
'--disable-extensions', '--disable-save-password-bubble']
if headless:
chrome_args.append('--headless')
if disk_cache_dir:
chrome_args.append('--disk-cache-dir=%s' % disk_cache_dir)
if disk_cache_size: