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 499d2ce54fa960f61bd91c040baa8a989d9b3dc1..f25796e28c6381cc1a844026f9a81e0ce9ddef0f 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -744,6 +744,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 fc32f198f1aa66d11fc51a793e9d0e495f5acc36..f508236c9ae6f85a90f2e14269ee8ae7bd3625bd 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -855,6 +855,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 d8365d0848719b16c8a068dd62861d37e2b10938..f9accc80b305d361dae0874da774e05067438059 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -595,7 +595,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();