electron/patches/chromium/disable_compositor_recycling.patch
electron-roller[bot] d9ba26273a
chore: bump chromium to 118.0.5991.0 (main) (#39714)
* chore: bump chromium in DEPS to 118.0.5982.0

* chore: bump chromium in DEPS to 118.0.5983.0

* chore: bump chromium in DEPS to 118.0.5985.0

* chore: bump chromium in DEPS to 118.0.5987.0

* chore: update v8 patches

* chore: update chromium patches

* chore: update patches

* [PEPC] Add new structs to contain permission request data

Refs https://chromium-review.googlesource.com/c/chromium/src/+/4756727

* Add ThumbnailCapturer interface

Refs https://chromium-review.googlesource.com/c/chromium/src/+/4812256

* Reland "[ChromeRefresh2023] Update document pip windows for Chrome Refresh"

Refs https://chromium-review.googlesource.com/c/chromium/src/+/4814275

* chore: bump chromium in DEPS to 118.0.5989.0

* chore: bump chromium in DEPS to 118.0.5991.0

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-09-05 21:17:56 -04: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 3fb6ed640ee9d857f19b4d60b12047133e68f920..0e035eae2094ef5351e4a35dc6ccc9866efe43ba 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -557,7 +557,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) {