Skip to content

fix: backgroundThrottling rwh assignment - #21037

Merged
deepak1556 merged 3 commits into
masterfrom
fix-web-contents-throttling
Dec 2, 2019
Merged

deepak1556 merged 3 commits into
masterfrom
fix-web-contents-throttling

Conversation

@codebytere

@codebytere codebytere commented Nov 7, 2019 •

Copy link
Copy Markdown
Member

Description of Change

Closes #20974.
Follow-up to #20239

Previously when a render view was created the corresponding RenderWidgetHost was fetched with the wrong routing ID which meant that the backgroundThrottling option was not properly set for the RWH and thus the API had no effect.

This PR fixes that.

cc @miniak

Checklist

Release Notes

Notes: Fixed throttling in webContents.setBackgroundThrottling.

@codebytere
codebytere requested a review from miniak November 7, 2019 16:07
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Nov 7, 2019

@deepak1556 deepak1556 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with minor change to fix build error.

@codebytere

Copy link
Copy Markdown
Member Author

hmm - looks like this is causing a CHECK failure now 🤔

@deepak1556

Copy link
Copy Markdown
Member

Based on https://cs.chromium.org/chromium/src/content/browser/renderer_host/render_widget_host_impl.h?l=818-822 it would make sense that our version would crash given it doesn't check for a valid process when extracting the widget associated with the view.

I think the solution here would be fix the underlying routing id issue by extracting the widget from RenderFrameHost. /cc @zcbenz for second opinion.

@miniak

miniak commented Nov 7, 2019 •

Copy link
Copy Markdown
Contributor

This PR still does not fix #20974. It only fixes requestAnimationFrame throttling. setTimeout is still affected.

@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Nov 8, 2019
return;
}

auto* render_process_host = render_view_host->GetProcess();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

render_process_host is not used anymore, please remove

@@ -1286,31 +1286,26 @@ void WebContents::SetBackgroundThrottling(bool allowed) {
background_throttling_ = allowed;

auto* contents = web_contents();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also not necessary, we don't check the return value of web_contents() anywhere else

@deepak1556

Copy link
Copy Markdown
Member

@miniak I think this PR needs to address #21037 (comment) before making any further changes.

@miniak

miniak commented Nov 26, 2019

Copy link
Copy Markdown
Contributor

@deepak1556, @codebytere this issue is quite high priority for us

@deepak1556

Copy link
Copy Markdown
Member

@miniak I am working on this today.

@deepak1556

Copy link
Copy Markdown
Member

Update: The reason timers aren't affected by this change is because they are controlled separately on the blink end using blink::PageScheduler and they throttle based on the page visibility, you can disable this throttling by using --disable-features="WebContentsOcclusion" but this will also affect the value of document.visibilityState.

I will update the disable_hidden.patch to account for this code path as well without impacting the value of document.visibilityState

@deepak1556 deepak1556 self-assigned this Nov 28, 2019
@deepak1556
deepak1556 force-pushed the fix-web-contents-throttling branch from a535f05 to 5b3db00 Compare November 30, 2019 00:12
@codebytere
codebytere requested a review from a team as a code owner November 30, 2019 00:12
@deepak1556
deepak1556 force-pushed the fix-web-contents-throttling branch 2 times, most recently from 8047ae1 to b7bd665 Compare November 30, 2019 00:22
@deepak1556
deepak1556 requested a review from miniak November 30, 2019 00:25
@deepak1556
deepak1556 force-pushed the fix-web-contents-throttling branch 3 times, most recently from 7a51884 to 117fa5f Compare November 30, 2019 06:11
@deepak1556
deepak1556 force-pushed the fix-web-contents-throttling branch from 117fa5f to 0764f45 Compare November 30, 2019 22:30
@deepak1556

Copy link
Copy Markdown
Member

Please merge this after merging #21343 for a clean backport on all tags listed here.

@deepak1556 deepak1556 closed this Dec 2, 2019
@deepak1556 deepak1556 reopened this Dec 2, 2019
@deepak1556

Copy link
Copy Markdown
Member

failing tests are not related, merging.

@deepak1556
deepak1556 merged commit c7cbc2e into master Dec 2, 2019
@release-clerk

release-clerk Bot commented Dec 2, 2019

Copy link
Copy Markdown

Release Notes Persisted

Fixed throttling in webContents.setBackgroundThrottling.

@trop

trop Bot commented Dec 2, 2019

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "7-1-x", please check out #21357

@trop

trop Bot commented Dec 2, 2019

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "8-x-y", please check out #21358

@trop

trop Bot commented Dec 2, 2019

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "6-1-x", please check out #21359

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

backgroundThrottling: false not obeyed in Electron 4+

5 participants