electron/patches/chromium/disable_compositor_recycling.patch
electron-roller[bot] 1eb19f3078
chore: bump chromium to 116.0.5845.0 (main) (#38827)
* chore: bump chromium in DEPS to 116.0.5835.0

* chore: update patches

* chore: bump chromium in DEPS to 116.0.5837.0

* chore: bump chromium in DEPS to 116.0.5839.0

* chore: bump chromium in DEPS to 116.0.5841.0

* chore: bump chromium in DEPS to 116.0.5843.0

* Update patches

CLs that affected printing.patch:
- 4616791: Refactor PrintViewManagerBase::PrintNow()
  https://chromium-review.googlesource.com/c/chromium/src/+/4616791
- 4602776: Make PrintNodeUnderContextMenu operation go through PrintViewManager
  https://chromium-review.googlesource.com/c/chromium/src/+/4602776

* 4506614: geolocation: Add LocationProvider::FillDiagnostics
https://chromium-review.googlesource.com/c/chromium/src/+/4506614

* chore: bump chromium in DEPS to 116.0.5845.0

* chore: update patches

* fixup! 4506614: geolocation: Add LocationProvider::FillDiagnostics https://chromium-review.googlesource.com/c/chromium/src/+/4506614

* 4609704: Remove gnome-keyring
https://chromium-review.googlesource.com/c/chromium/src/+/4609704

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2023-06-22 10:51:15 +02:00

24 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andy Locascio <andy@slack-corp.com>
Date: Wed, 21 Aug 2019 12:09:10 -0700
Subject: fix: disabling compositor recycling
Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron.
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 4dce73888703a5db8fe7ae2a0e0745ee813ab9b0..e995e9b652397a67ca0b89e107975ab04bae7725 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -528,7 +528,11 @@
return;
host()->WasHidden();
- browser_compositor_->SetRenderWidgetHostIsHidden(true);
+ // Consider the RWHV occluded only if it is not attached to a window
+ // (e.g. unattached BrowserView). Otherwise we treat it as visible to
+ // prevent unnecessary compositor recycling.
+ const bool unattached = ![GetInProcessNSView() window];
+ browser_compositor_->SetRenderWidgetHostIsHidden(unattached);
}
void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) {