From 5ed6fcce64d444d09eb393634ed5c29ac08163aa Mon Sep 17 00:00:00 2001 From: Alexander Saltanov Date: Tue, 13 Jun 2023 01:07:09 +0300 Subject: [PATCH] Make --disable-gpu not hard coded Default is `false`, so this commit doesn't break current use cases. --- src/browser/process.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/browser/process.rs b/src/browser/process.rs index 21094505..dfff8600 100644 --- a/src/browser/process.rs +++ b/src/browser/process.rs @@ -87,6 +87,10 @@ pub struct LaunchOptions<'a> { #[builder(default = "true")] pub sandbox: bool, + /// Determines whether to enable GPU or not. Default to false. + #[builder(default = "false")] + pub enable_gpu: bool, + /// Determines whether to run the browser with logging enabled /// (this can cause unwanted new shell window in Windows 10 and above). /// Check @@ -165,6 +169,7 @@ impl<'a> Default for LaunchOptions<'a> { LaunchOptions { headless: true, sandbox: true, + enable_gpu: false, enable_logging: false, idle_browser_timeout: Duration::from_secs(30), window_size: None, @@ -316,7 +321,6 @@ impl Process { let mut args = vec![ port_option.as_str(), - "--disable-gpu", "--verbose", "--log-level=0", "--no-first-run", @@ -353,6 +357,10 @@ impl Process { args.extend(["--enable-logging"]); } + if !launch_options.enable_gpu { + args.extend(["--disable-gpu"]); + } + let proxy_server_option = if let Some(proxy_server) = launch_options.proxy_server { format!("--proxy-server={proxy_server}") } else {