48 lines
2.2 KiB
Diff
48 lines
2.2 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 e8fb8793645821940bc41ced7cc14af404a1e229..ffe62ea1114943d1535a806fa515122c47072372 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
|
|
@@ -689,6 +689,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 111ffbd4ee5d6a7093c32f9c1b1f827dc802f4fa..af5d67ff3ebc74c022800fd8ae3c139fc5806639 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_impl.h
|
|
+++ b/content/browser/renderer_host/render_widget_host_impl.h
|
|
@@ -174,6 +174,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
|
// RenderWidgetHostImpl.
|
|
static RenderWidgetHostImpl* From(RenderWidgetHost* rwh);
|
|
|
|
+ // Electron: Prevents the widget from getting hidden.
|
|
+ bool disable_hidden_ = false;
|
|
+
|
|
void set_new_content_rendering_delay_for_testing(
|
|
const base::TimeDelta& delay) {
|
|
new_content_rendering_delay_ = delay;
|
|
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 f32ba1d31ddb1ca68e889f0ae0cc7a5b3357f58c..08122746971e88792481af96b9270c5ff503c3b2 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
@@ -625,7 +625,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();
|
|
if (delegated_frame_host_) {
|