mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
* chore: bump chromium in DEPS to 124.0.6355.0 * 5341411: view-transition: Ensure resources are cleaned up in all cases. https://chromium-review.googlesource.com/c/chromium/src/+/5341411 * chore: fixup patch indices * 5354013: Return nullopt on error from ProcessMetrics CPU measurements https://chromium-review.googlesource.com/c/chromium/src/+/5354013 * chore: bump chromium in DEPS to 124.0.6357.0 * chore: update patches * 5368769: Reland "[mojo] Use large worker for mojom_parser action" https://chromium-review.googlesource.com/c/chromium/src/+/5368769 * 5336171: [Extensions] Introduce a CoreExtensionsRendererAPIProvider https://chromium-review.googlesource.com/c/chromium/src/+/5336171 * 5367334: [FS Shortcut] Refactor ExclusiveAccessManager https://chromium-review.googlesource.com/c/chromium/src/+/5367334 * 5354161: Rename GeolocationManager to GeolocationSystemPermissionManager https://chromium-review.googlesource.com/c/chromium/src/+/5354161 * fixup: [Extensions] Introduce a CoreExtensionsRendererAPIProvider * chore: bump chromium in DEPS to 124.0.6359.0 * chore: update patches * 5371370: [Extensions] Move core NativeHandler registration https://chromium-review.googlesource.com/c/chromium/src/+/5371370 * 5370702: [Extensions] Introduce ShellExtensionsRendererAPIProvider https://chromium-review.googlesource.com/c/chromium/src/+/5370702 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
84 lines
3.5 KiB
Diff
84 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Michal Pichlinski <michal.pichlinski@openfin.co>
|
|
Date: Thu, 15 Jun 2023 23:04:48 +0200
|
|
Subject: allow disabling throttling in the `viz::DisplayScheduler` per
|
|
`ui::Compositor`
|
|
|
|
In Chromium when the `viz::DisplayScheduler` is invisible it throttles
|
|
its work by dropping frame draws and swaps.
|
|
|
|
This patch allows disbling this throttling by preventing transition to
|
|
invisible state of the `viz::DisplayScheduler` owned
|
|
by the `ui::Compositor`.
|
|
|
|
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
|
|
index 58c898eae10ecca9741d89e5a211b7c25c6d5a0b..ddd00f284e3e1efb810bf0202eb3b7838ac4d7e6 100644
|
|
--- a/ui/compositor/compositor.cc
|
|
+++ b/ui/compositor/compositor.cc
|
|
@@ -339,7 +339,8 @@ void Compositor::SetLayerTreeFrameSink(
|
|
if (display_private_) {
|
|
disabled_swap_until_resize_ = false;
|
|
display_private_->Resize(size());
|
|
- display_private_->SetDisplayVisible(host_->IsVisible());
|
|
+ // Invisible display is throttling itself.
|
|
+ display_private_->SetDisplayVisible(background_throttling_ ? host_->IsVisible() : true);
|
|
display_private_->SetDisplayColorSpaces(display_color_spaces_);
|
|
display_private_->SetDisplayColorMatrix(
|
|
gfx::SkM44ToTransform(display_color_matrix_));
|
|
@@ -531,8 +532,11 @@ void Compositor::SetVisible(bool visible) {
|
|
host_->SetVisible(visible);
|
|
// Visibility is reset when the output surface is lost, so this must also be
|
|
// updated then.
|
|
- if (display_private_)
|
|
- display_private_->SetDisplayVisible(visible);
|
|
+ if (display_private_) {
|
|
+ // Invisible display is throttling itself.
|
|
+ display_private_->SetDisplayVisible(
|
|
+ background_throttling_ ? visible : true);
|
|
+ }
|
|
}
|
|
|
|
bool Compositor::IsVisible() {
|
|
@@ -959,4 +963,13 @@ const cc::LayerTreeSettings& Compositor::GetLayerTreeSettings() const {
|
|
return host_->GetSettings();
|
|
}
|
|
|
|
+void Compositor::SetBackgroundThrottling(bool background_throttling_enabled) {
|
|
+ background_throttling_ = background_throttling_enabled;
|
|
+ if (display_private_) {
|
|
+ // Invisible display is throttling itself.
|
|
+ display_private_->SetDisplayVisible(
|
|
+ background_throttling_ ? host_->IsVisible() : true);
|
|
+ }
|
|
+}
|
|
+
|
|
} // namespace ui
|
|
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
|
|
index 579b7f45fabdbf326995e3a20b5e509c859f178f..c6b9846574afdf6d6badaca8263221894b4763f8 100644
|
|
--- a/ui/compositor/compositor.h
|
|
+++ b/ui/compositor/compositor.h
|
|
@@ -508,6 +508,10 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver,
|
|
|
|
const cc::LayerTreeSettings& GetLayerTreeSettings() const;
|
|
|
|
+ // Sets |background_throttling_| responsible for suspending drawing
|
|
+ // and switching frames.
|
|
+ void SetBackgroundThrottling(bool background_throttling_enabled);
|
|
+
|
|
size_t saved_events_metrics_count_for_testing() const {
|
|
return host_->saved_events_metrics_count_for_testing();
|
|
}
|
|
@@ -625,6 +629,12 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver,
|
|
// See go/report-ux-metrics-at-painting for details.
|
|
bool animation_started_ = false;
|
|
|
|
+ // Background throttling is a default Chromium behaviour. It occurs
|
|
+ // when the |display_private_| is not visible by prevent drawing and swapping
|
|
+ // frames. When it is disabled we are keeping |display_private_| always
|
|
+ // visible in order to keep generating frames.
|
|
+ bool background_throttling_ = true;
|
|
+
|
|
TrackerId next_throughput_tracker_id_ = 1u;
|
|
struct TrackerState {
|
|
TrackerState();
|