From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:45:47 -0700 Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index cb19c7f0fb1fbda6e0b84062e4754622123e05e8..dc7169488b75972a22ed82eef564f8290be4ba36 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -614,6 +614,9 @@ void RenderWidgetHostImpl::WasHidden() { if (is_hidden_) return; + if (disable_hidden_) + return; + RejectMouseLockOrUnlockIfNecessary(); TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::WasHidden"); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index ff2505c99eff7a72528582753a1a161cd26264cc..0ae5bb7f78c3a29cbc146c69c7e7760092875f3e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -176,6 +176,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl // RenderWidgetHostImpl. static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); + // Electron: Prevents the widget from getting hidden. + bool disable_hidden_ = false; + void set_hung_renderer_delay(const base::TimeDelta& delay) { hung_renderer_delay_ = delay; }