mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
* chore: bump chromium in DEPS to 143.0.7469.0 * 7021651: [//gpu] Fold handle creation into D3DImageBackingFactory Refs https://chromium-review.googlesource.com/c/chromium/src/+/7021651 * 7013047: Fix various C++23 build errors in //chrome Refs https://chromium-review.googlesource.com/c/chromium/src/+/7013047 * 7010850: [//ui] Port screen_mac.mm's calls to DisplayColorSpaces Refs https://chromium-review.googlesource.com/c/chromium/src/+/7010850 * 7007933: Remove superfluous mojom includes in //content/public headers Refs https://chromium-review.googlesource.com/c/chromium/src/+/7007933 * 7023196: Trim os_crypt/sync visibility list Refs https://chromium-review.googlesource.com/c/chromium/src/+/7023196 * 7008912: Remove GURL::*_piece() method Refs https://chromium-review.googlesource.com/c/chromium/src/+/7008912 * 7003989: Add wrapper struct for CopyFromSurface output Refs https://chromium-review.googlesource.com/c/chromium/src/+/7003989 * 7017889: [MemoryPressureListener] Remove type aliases Refs https://chromium-review.googlesource.com/c/chromium/src/+/7017889 * 7027780: Delete viz::ResourceSizes Refs https://chromium-review.googlesource.com/c/chromium/src/+/7027780 Refs https://chromium-review.googlesource.com/c/chromium/src/+/6989572 * 6495189: [api] Delete old String::Write* APIs Refs https://chromium-review.googlesource.com/c/v8/v8/+/6495189 * chore: update patches * chore: run script/gen-libc++-filenames.js --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
83 lines
3.6 KiB
Diff
83 lines
3.6 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 c0a2f822e38712eaad30c5d1104b149fa28d985d..b967896479c7fd0f71c7b9e5407d63e1d62bfadd 100644
|
|
--- a/ui/compositor/compositor.cc
|
|
+++ b/ui/compositor/compositor.cc
|
|
@@ -358,7 +358,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_));
|
|
@@ -609,7 +610,9 @@ void Compositor::SetVisible(bool visible) {
|
|
// updated then. We need to call this even if the visibility hasn't changed,
|
|
// for the same reason.
|
|
if (display_private_)
|
|
- display_private_->SetDisplayVisible(visible);
|
|
+ // Invisible display is throttling itself.
|
|
+ display_private_->SetDisplayVisible(
|
|
+ background_throttling_ ? visible : true);
|
|
|
|
if (changed) {
|
|
observer_list_.Notify(&CompositorObserver::OnCompositorVisibilityChanged,
|
|
@@ -1073,6 +1076,15 @@ void Compositor::MaybeUpdateObserveBeginFrame() {
|
|
host_begin_frame_observer_->GetBoundRemote());
|
|
}
|
|
|
|
+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);
|
|
+ }
|
|
+}
|
|
+
|
|
#if BUILDFLAG(IS_CHROMEOS)
|
|
void Compositor::SetSeamlessRefreshRates(
|
|
const std::vector<float>& seamless_refresh_rates) {
|
|
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
|
|
index 7f428fe96da978aa951354eb41f9ebec46cc6e9c..7e5a008d7b158c1af9a47f549426818bc22212f5 100644
|
|
--- a/ui/compositor/compositor.h
|
|
+++ b/ui/compositor/compositor.h
|
|
@@ -514,6 +514,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();
|
|
}
|
|
@@ -724,6 +728,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_compositor_metrics_tracker_id_ = 1u;
|
|
struct TrackerState {
|
|
TrackerState();
|