e46446e7e4
Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
48 lines
2.3 KiB
Diff
48 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
|
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 1b9b2c1ad23bd562b8c1895ceac220248dd70d01..d155e69df2abb9cec5f2153c7cb3c7b45cf46bbc 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
|
|
@@ -726,6 +726,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 a60325e9245af18665e34f56becc65f09fddee68..f179736afc6e675d8207bda025b4fbe1295c1bec 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_impl.h
|
|
+++ b/content/browser/renderer_host/render_widget_host_impl.h
|
|
@@ -835,6 +835,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
|
|
|
base::Optional<blink::VisualProperties> LastComputedVisualProperties() const;
|
|
|
|
+ // 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 3fa31e92b1f49f302cb91b10fd8d7489b7f7cda3..f35127f154754225015d6d8a56f4082f78bf8d3a 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
@@ -605,7 +605,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();
|