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 7436238cd110ef8c414e8be3d8ff07511b6223f4..4b0b2b0dc0900627aee38de021ec10cbdc9b3cb4 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -803,6 +803,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 785cf70788ddb65712c45bc32281141e8a623b13..831a85653eb89b79ccc638400be6cfe10369b14b 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -874,6 +874,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl void OnLocalSurfaceIdChanged( const cc::RenderFrameMetadata& metadata) override; + // 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 20d613c480ce54f99e04dd49fe27af10056beee4..4a421fc2c244cf56d329ff66d0e9e17b0f0a5987 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();