e145fcb3f0
Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net>
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 cf64f7c3c4db9bd287518ad45464d19b5f1d7319..7fd9811b212ef66f685f1fb51eb231092c0a9d6c 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
|
|
@@ -657,6 +657,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 244f352bc97382f025353fb211b7f7b2d1b0ae17..113655ef86f737118f0ad7cfbdf4abc1533fcc4e 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_impl.h
|
|
+++ b/content/browser/renderer_host/render_widget_host_impl.h
|
|
@@ -179,6 +179,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 f7f9dafb97983d05b3d13af3c178aa2f392b09ef..b43d1e528acaa4f0ead02c13d13a072216e2638c 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
@@ -692,7 +692,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_) {
|