-
Notifications
You must be signed in to change notification settings - Fork 16.4k
fix: disable background throttling also in the viz::DisplayScheduler
#38924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
`viz::DisplayScheduler` is responsible for drawing and swapping frames in the `DisplayScheduler::DrawAndSwap` which is called from the `DisplayScheduler::AttemptDrawAndSwap` if the `DisplayScheduler::ShouldDraw` returns true. `ShouldDraw` depends on the `DisplayScheduler` visibility and when it is not visible then it returns false. In order to keep producing frames, disabling `backgroundThrottling` should also prevent changing `DisplayScheduler` visibility to false. `DisplayScheduler` lives in the `ui::Compositor` where every `electron::NativewWindow` has its own `Compositor`. `electron::NativewWindow` may be host of the multiple `electron::api::WebContents` instances which may have different `WebPreferences` settings. Therefore if at least one of the `WebContents` requires disabling throttling then all other `WebContents` using the same window will have it disabled in the `ui::Compositor`. BREAKING CHANGE: `backgroundThrottling` set to false will disable frames throttling in the `BrowserWindow` for all `WebContents` displayed by it. Close: [electron#31016](electron#31016)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good to me.
/cc @electron/wg-upgrades to review the patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that Chromium would accept upstream in any form? it'd be good to have a roadmap for this patch that isn't us floating it indefinitely.
I've addressed all issues and resolved conflict.
same with
I've no access to retry these builds. |
I think this may have lower chances to upstream than |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the patch needs to be updated.
You can update the patch by running:
e sync --3
and then running
e patches all
Patches updated, builds failed on
|
@michal-pichlinski-openfin this has been fixed in latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The breaking change should be documented in https://github.com/electron/electron/blob/main/docs/breaking-changes.md
Linux test runs failed due to: |
@michal-pichlinski-openfin that's a flake that occasionally happens - could you please rebase on main? |
This failure looks unrelated to my change:
|
Addressed in: 4212433 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
API LGTM |
Congrats on merging your first pull request! 🎉🎉🎉 |
Release Notes Persisted
|
Can this be updated to electron26? |
@fanchenio, this change included a breaking change, so it can not be backported to Electron 26. |
electron#38924) * fix: disable background throttling also in the `viz::DisplayScheduler` `viz::DisplayScheduler` is responsible for drawing and swapping frames in the `DisplayScheduler::DrawAndSwap` which is called from the `DisplayScheduler::AttemptDrawAndSwap` if the `DisplayScheduler::ShouldDraw` returns true. `ShouldDraw` depends on the `DisplayScheduler` visibility and when it is not visible then it returns false. In order to keep producing frames, disabling `backgroundThrottling` should also prevent changing `DisplayScheduler` visibility to false. `DisplayScheduler` lives in the `ui::Compositor` where every `electron::NativewWindow` has its own `Compositor`. `electron::NativewWindow` may be host of the multiple `electron::api::WebContents` instances which may have different `WebPreferences` settings. Therefore if at least one of the `WebContents` requires disabling throttling then all other `WebContents` using the same window will have it disabled in the `ui::Compositor`. BREAKING CHANGE: `backgroundThrottling` set to false will disable frames throttling in the `BrowserWindow` for all `WebContents` displayed by it. Close: [electron#31016](electron#31016) * fixup! fix: disable background throttling also in the `viz::DisplayScheduler` * fixup! fix: disable background throttling also in the `viz::DisplayScheduler` * fixup! fix: disable background throttling also in the `viz::DisplayScheduler` --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Description of Change
viz::DisplayScheduler
is responsible for drawing and swapping frames in theDisplayScheduler::DrawAndSwap
which is called from theDisplayScheduler::AttemptDrawAndSwap
if theDisplayScheduler::ShouldDraw
returns true.ShouldDraw
depends on theDisplayScheduler
visibility and when it is not visible then it returns false.In order to keep producing frames, disabling
backgroundThrottling
should also prevent changingDisplayScheduler
visibility to false.DisplayScheduler
lives in theui::Compositor
where everyelectron::NativewWindow
has its ownCompositor
.electron::NativewWindow
may be host of the multipleelectron::api::WebContents
instances which may have differentWebPreferences
settings. Therefore if at least one of theWebContents
requires disabling throttling then all otherWebContents
using the same window will have it disabled in theui::Compositor
.BREAKING CHANGE:
backgroundThrottling
set to false will disable frames throttling in theBrowserWindow
for allWebContents
displayed by it.Closes: #31016
Checklist
npm test
passesRelease Notes
Notes: Fixed generating frames when the window is hidden and
backgroundThrottling
is disabled.