Commit fa5ebed3 authored by Sebastien Marchand's avatar Sebastien Marchand Committed by Commit Bot

Allow urgent discarding of tabs sharing a browsing instance

This protection should only apply to the proactive discarding scenario.

Change-Id: I081422d406dce2eef2a9e56f03bce50c7038a14d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1857042Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705983}
parent 0ea9325e
...@@ -979,20 +979,20 @@ void TabLifecycleUnitSource::TabLifecycleUnit::CheckIfTabIsUsedInBackground( ...@@ -979,20 +979,20 @@ void TabLifecycleUnitSource::TabLifecycleUnit::CheckIfTabIsUsedInBackground(
// Do not freeze tabs that are casting/mirroring/playing audio. // Do not freeze tabs that are casting/mirroring/playing audio.
IsMediaTabImpl(decision_details); IsMediaTabImpl(decision_details);
if (GetStaticProactiveTabFreezeAndDiscardParams() if (intervention_type == InterventionType::kProactive) {
.should_protect_tabs_sharing_browsing_instance) { if (GetStaticProactiveTabFreezeAndDiscardParams()
if (web_contents()->GetSiteInstance()->GetRelatedActiveContentsCount() > .should_protect_tabs_sharing_browsing_instance) {
1U) { if (web_contents()->GetSiteInstance()->GetRelatedActiveContentsCount() >
decision_details->AddReason( 1U) {
DecisionFailureReason::LIVE_STATE_SHARING_BROWSING_INSTANCE); decision_details->AddReason(
DecisionFailureReason::LIVE_STATE_SHARING_BROWSING_INSTANCE);
}
} }
}
// Consult the local database to see if this tab could try to communicate with // Consult the local database to see if this tab could try to communicate
// the user while in background (don't check for the visibility here as // with the user while in background (don't check for the visibility here as
// there's already a check for that above). Only do this for proactive // there's already a check for that above). Only do this for proactive
// interventions. // interventions.
if (intervention_type == InterventionType::kProactive) {
CheckIfTabCanCommunicateWithUserWhileInBackground(web_contents(), CheckIfTabCanCommunicateWithUserWhileInBackground(web_contents(),
decision_details); decision_details);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment