electron/patches/chromium/disable_hidden.patch
Charles Kerr 305b28e9c7
chore: bump chromium to 129.0.6632.0 (#43184)
* chore: bump chromium in DEPS to 129.0.6632.0

* chore: update build_do_not_depend_on_packed_resource_integrity.patch

apply patch manually due to context shear

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5755242

* chore: e patches all
2024-08-02 13:58:13 -05:00

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 a3e64928c558f0959ff7aa3451f3898cf0d1fb18..389045f400ed0bc0af19047ad318f693a6006910 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -778,6 +778,9 @@ void RenderWidgetHostImpl::WasHidden() {
return;
}
+ if (disable_hidden_)
+ return;
+
RejectPointerLockOrUnlockIfNecessary(
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 42161abd764655cc753fffd8577a507955e72ce4..b222f105dbc13e726bbd70186a596dbb442c1aed 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -1001,6 +1001,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
// Requests a commit and forced redraw in the renderer compositor.
void ForceRedrawForTesting();
+ // 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 92ea6fb1bccffe8626f1656a1009cea4419c5602..07a0a672b51fe67083159a4133b0c36991092f00 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -644,7 +644,7 @@ void RenderWidgetHostViewAura::HideImpl() {
CHECK(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();