mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
* chore: bump chromium in DEPS to 133.0.6847.0 * chore: bump chromium in DEPS to 133.0.6848.0 * chore: update patches * implement extensions::GlobalShortcutListener::ExecuteCommand stub https://chromium-review.googlesource.com/c/chromium/src/+/5871484 * fix: ismediakey patch, oops * fix: another missing bracket * chore: bump chromium in DEPS to 133.0.6850.0 * chore: update patches * SharedStorageOperationPtr -> SharedStorageModifierMethodPtr https://chromium-review.googlesource.com/c/chromium/src/+/5990970 * build GlobalShortcutListenerLinux https://chromium-review.googlesource.com/c/chromium/src/+/5871484 * chore: bump chromium in DEPS to 133.0.6851.0 * fix: include full type for network::mojom::SharedStorageModifierMethod * chore: update patches * chore: bump chromium in DEPS to 133.0.6852.0 * chore: update patches * build: remove duplicated icudtl.dat and snapshot_blob.bin https://chromium-review.googlesource.com/c/chromium/src/+/5999387 * fix: include static methods in node tests involving call stacks https://chromium-review.googlesource.com/c/v8/v8/+/5907815 * revert: moved code in picture-in-picture.patch --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Samuel Maddock <smaddock@slack-corp.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 b030f5c17cff0b5b75687b4379500fb832506837..6865785e12ea290159828d28bcdddc21bf7d4fe3 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_));
|
|
@@ -550,7 +551,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,
|
|
@@ -1001,6 +1004,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 497f3299ba459da88ff9c2abdefdd27480324b0e..db44edc070d36edb3230a4fde9f41444d9f10064 100644
|
|
--- a/ui/compositor/compositor.h
|
|
+++ b/ui/compositor/compositor.h
|
|
@@ -509,6 +509,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();
|
|
}
|
|
@@ -657,6 +661,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();
|