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 75d7780ab829ec817d8f956fc1cef3d161849179..c4db072350e60db8323e9d275a28222ac9d18b3e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -709,6 +709,9 @@ void RenderWidgetHostImpl::WasHidden() { if (is_hidden_) return; + if (disable_hidden_) + return; + RejectMouseLockOrUnlockIfNecessary( blink::mojom::PointerLockResult::kWrongDocument); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 25b10d1d867a7d4052e0daba7b83f62e4e522638..1d7a6bf0994b6529a42b3db505cd28fd33fe579a 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -834,6 +834,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl mojom::CreateFrameWidgetParamsPtr BindAndGenerateCreateFrameWidgetParamsForNewWindow(); + // Electron: Prevents the widget from getting hidden. + bool disable_hidden_ = false; + protected: // |routing_id| must not be MSG_ROUTING_NONE. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 351e15aeabf320951681646251a04802cda79bde..60263de834e57311ba1e506f6a3eed104a550792 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -597,7 +597,7 @@ void RenderWidgetHostViewAura::HideImpl() { DCHECK(visibility_ == Visibility::HIDDEN || visibility_ == Visibility::OCCLUDED); - if (!host()->is_hidden()) { + if (!host()->is_hidden() && !host()->disable_hidden_) { host()->WasHidden(); aura::WindowTreeHost* host = window_->GetHost(); aura::Window* parent = window_->parent();