[Extensions] Filter profiles for tabs.discard appropriately [chromium/src : main]

0 views
Skip to first unread message

Tim (Gerrit)

unread,
Jun 3, 2026, 7:21:20 PMJun 3
to Francois Pierre Doray, android-bu...@system.gserviceaccount.com, Devlin Cronin, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, chrome-gr...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Devlin Cronin and Francois Pierre Doray

Tim added 3 comments

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Tim . resolved

Adding in fdoray@ for the changes in `chrome/browser/performance_manager/policies/` and `chrome/browser/resource_coordinator/`. Could you take a look at the additions in those and see if you are okay with them?

File chrome/browser/extensions/api/tabs/tabs_api.cc
Line 4052, Patchset 2:
// Verify that the extension is allowed to see the discarded tab.
// We use profile matching instead of just checking IsOffTheRecord() to
// properly handle incognito 'split' mode. In split mode, the incognito
// background script needs to see its own incognito tabs but shouldn't see
// regular tabs. 'spanning' mode extensions with incognito access will pass
// the IsSameOrParent() check.
Profile* profile = Profile::FromBrowserContext(browser_context());
Profile* tab_profile =
Profile::FromBrowserContext(contents->GetBrowserContext());
bool can_see_tab =
profile == tab_profile ||
(include_incognito_information() && profile->IsSameOrParent(tab_profile));

if (!can_see_tab) {
return RespondNow(NoArguments());
}
Devlin Cronin . resolved

oh, hmm... so this can discard a tab not just from the off the record profile, but from a different profile entirely?

It's good we fix whether the extension can see that, but that still seems undesirable.

Would it be possible to instead tweak DiscardLeastImportantTab() to restrict it to a given browser context? That would potentially be a nicer change and also solve this bug. But that might be a larger change -- WDYT?

Tim

Yeah, that makes a lot of sense. Subtle things would have also been able to be inferred based on if there was an error vs a silent return with the other approach. Adding full profile filtering wasn't much more overhead.

File chrome/browser/performance_manager/policies/page_discarding_helper.cc
Line 131, Patchset 5 (Latest): DiscardEligibilityPolicy::DiscardReason discard_reason,
base::TimeDelta minimum_time_in_background) {
Tim . unresolved

Note: There's an argument for keeping this surface (and maybe ImmediatelyDiscardMultiplePages) uniform and also take an allowed_browser_context_ids set, but I thought it was better to only add it where we need it for now (DiscardAPage).

Open in Gerrit

Related details

Attention is currently required from:
  • Devlin Cronin
  • Francois Pierre Doray
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
Gerrit-Change-Number: 7866020
Gerrit-PatchSet: 5
Gerrit-Owner: Tim <tjud...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
Gerrit-Reviewer: Tim <tjud...@chromium.org>
Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Attention: Francois Pierre Doray <fdo...@chromium.org>
Gerrit-Comment-Date: Wed, 03 Jun 2026 23:20:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Tim (Gerrit)

unread,
Jun 3, 2026, 11:55:53 PMJun 3
to Francois Pierre Doray, android-bu...@system.gserviceaccount.com, Devlin Cronin, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, chrome-gr...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Devlin Cronin and Francois Pierre Doray

Tim added 1 comment

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Tim . resolved

Sorry for the test failures folk, I forgot about having to use BrowserWindowInterface instead of Browser to avoid issues on the desktop-android bots. Should be good now.

Open in Gerrit

Related details

Attention is currently required from:
  • Devlin Cronin
  • Francois Pierre Doray
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
Gerrit-Change-Number: 7866020
Gerrit-PatchSet: 7
Gerrit-Owner: Tim <tjud...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
Gerrit-Reviewer: Tim <tjud...@chromium.org>
Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Attention: Francois Pierre Doray <fdo...@chromium.org>
Gerrit-Comment-Date: Thu, 04 Jun 2026 03:55:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Devlin Cronin (Gerrit)

unread,
Jun 4, 2026, 1:29:27 PMJun 4
to Tim, Devlin Cronin, Francois Pierre Doray, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, chrome-gr...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Francois Pierre Doray and Tim

Devlin Cronin voted and added 6 comments

Votes added by Devlin Cronin

Code-Review+1

6 comments

Patchset-level comments
Devlin Cronin . resolved

LGTM! Thank you, Tim!

File chrome/browser/extensions/api/tabs/tabs_api.cc
Line 4087, Patchset 7 (Latest): if (include_incognito_information() && !profile->IsOffTheRecord()) {
Devlin Cronin . unresolved

this check isn't necessary, I think -- include_incognito_information() is only true for spanning mode extensions

Line 4088, Patchset 7 (Latest): for (Profile* otr_profile : profile->GetAllOffTheRecordProfiles()) {
Devlin Cronin . unresolved

we generally only use the primary OTR profile for extensions. This theoretically isn't *that* big of a deal (yet), but I thikn we should be consistent

File chrome/browser/extensions/api/tabs/tabs_test.cc
Line 2128, Patchset 7 (Latest): // than silently discarding incognito tabs.
Devlin Cronin . unresolved

is it non-deterministic how many tabs get discarded?

Line 2129, Patchset 7 (Latest): std::vector<base::DictValue> results;
for (int i = 0; i < 4; ++i) {
auto discard_no_id = base::MakeRefCounted<TabsDiscardFunction>();
discard_no_id->set_extension(extension.get());
if (api_test_utils::RunFunction(discard_no_id.get(), "[]", profile(),
api_test_utils::FunctionMode::kNone)) {
if (discard_no_id->GetResultListForTest() &&
!discard_no_id->GetResultListForTest()->empty()) {
results.push_back(utils::ToDict(
discard_no_id->GetResultListForTest()->front().Clone()));
}
} else {
EXPECT_EQ("Cannot find a tab to discard.", discard_no_id->GetError());
}
}

// We should have at least one result from the discardable normal tab.
EXPECT_GT(results.size(), 0u);
for (const auto& result : results) {
// Check that the returned tab does not have sensitive incognito
// information. It must be a normal tab. Since the extension has "tabs"
// permission, it should include url and title for the normal tab.
EXPECT_FALSE(api_test_utils::GetBoolean(result, "incognito"));
EXPECT_TRUE(result.contains("url"));
EXPECT_TRUE(result.contains("title"));
}
Devlin Cronin . unresolved

optional: here and below, do you think any of these tests would be easier / cleaner with a TestExtensionDir and executing script in the SW with chrome.test?

(I'm fine either way)

File chrome/browser/resource_coordinator/utils.h
Line 52, Patchset 7 (Latest):// specific set of browser contexts.
Devlin Cronin . unresolved

nit: put this below `urgent_protection_time` docs, since it's after in the param list

Open in Gerrit

Related details

Attention is currently required from:
  • Francois Pierre Doray
  • Tim
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
    Gerrit-Change-Number: 7866020
    Gerrit-PatchSet: 7
    Gerrit-Owner: Tim <tjud...@chromium.org>
    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
    Gerrit-Reviewer: Tim <tjud...@chromium.org>
    Gerrit-Attention: Tim <tjud...@chromium.org>
    Gerrit-Attention: Francois Pierre Doray <fdo...@chromium.org>
    Gerrit-Comment-Date: Thu, 04 Jun 2026 17:29:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Tim (Gerrit)

    unread,
    Jun 8, 2026, 8:14:04 PMJun 8
    to Devlin Cronin, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, chrome-gr...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Joe Mason

    Tim added 6 comments

    Patchset-level comments
    File-level comment, Patchset 7:
    Tim . resolved

    Swapping in joenotcharles as fdoray is OO till August.
    joenotcharles@: Could you look at the changes in chrome/browser/performance_manager/policies/ and chrome/browser/resource_coordinator/?

    File chrome/browser/extensions/api/tabs/tabs_api.cc
    Line 4087, Patchset 7: if (include_incognito_information() && !profile->IsOffTheRecord()) {
    Devlin Cronin . resolved

    this check isn't necessary, I think -- include_incognito_information() is only true for spanning mode extensions

    Tim

    Done

    Line 4088, Patchset 7: for (Profile* otr_profile : profile->GetAllOffTheRecordProfiles()) {
    Devlin Cronin . resolved

    we generally only use the primary OTR profile for extensions. This theoretically isn't *that* big of a deal (yet), but I thikn we should be consistent

    Tim

    Done

    File chrome/browser/extensions/api/tabs/tabs_test.cc
    Line 2128, Patchset 7: // than silently discarding incognito tabs.
    Devlin Cronin . resolved

    is it non-deterministic how many tabs get discarded?

    Tim

    Not so much non-deterministic, but more just potentially racy and I worry might differ on different platforms (ExtensionTabsTest.DiscardWithoutId is already disabled for Mac and ExtensionTabsTest.DiscardedProperty is disabled for Linux). Although I think I was being overly cautious here, to the point that this loop doesn't really give any guarantee that the error was ever returned.

    I've changed this to be much more explicit in how I _understand_ the discarding behavior to behave and added comments explaining the assumptions that led to the specific numbers being used in the checks here. I worry this may lead to flaking in some ways on different platform behavior, but I did a gtest_repeat=200 on linux using swarming and that at least didn't hit any problems.

    Line 2129, Patchset 7: std::vector<base::DictValue> results;

    for (int i = 0; i < 4; ++i) {
    auto discard_no_id = base::MakeRefCounted<TabsDiscardFunction>();
    discard_no_id->set_extension(extension.get());
    if (api_test_utils::RunFunction(discard_no_id.get(), "[]", profile(),
    api_test_utils::FunctionMode::kNone)) {
    if (discard_no_id->GetResultListForTest() &&
    !discard_no_id->GetResultListForTest()->empty()) {
    results.push_back(utils::ToDict(
    discard_no_id->GetResultListForTest()->front().Clone()));
    }
    } else {
    EXPECT_EQ("Cannot find a tab to discard.", discard_no_id->GetError());
    }
    }

    // We should have at least one result from the discardable normal tab.
    EXPECT_GT(results.size(), 0u);
    for (const auto& result : results) {
    // Check that the returned tab does not have sensitive incognito
    // information. It must be a normal tab. Since the extension has "tabs"
    // permission, it should include url and title for the normal tab.
    EXPECT_FALSE(api_test_utils::GetBoolean(result, "incognito"));
    EXPECT_TRUE(result.contains("url"));
    EXPECT_TRUE(result.contains("title"));
    }
    Devlin Cronin . resolved

    optional: here and below, do you think any of these tests would be easier / cleaner with a TestExtensionDir and executing script in the SW with chrome.test?

    (I'm fine either way)

    Tim

    Going that route the TestExtensionDir boilerplate ends up a lot larger and I find it overall less clear with back and forth messaging. Directly creating the TabsDiscardFunction also matches the approach existing discard tests use around here.

    File chrome/browser/resource_coordinator/utils.h
    Line 52, Patchset 7:// specific set of browser contexts.
    Devlin Cronin . resolved

    nit: put this below `urgent_protection_time` docs, since it's after in the param list

    Tim

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Joe Mason
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
    Gerrit-Change-Number: 7866020
    Gerrit-PatchSet: 9
    Gerrit-Owner: Tim <tjud...@chromium.org>
    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Reviewer: Joe Mason <joenot...@google.com>
    Gerrit-Attention: Joe Mason <joenot...@google.com>
    Gerrit-Comment-Date: Tue, 09 Jun 2026 00:13:52 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Tim (Gerrit)

    unread,
    Jun 10, 2026, 1:26:49 PMJun 10
    to Devlin Cronin, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, chrome-gr...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Devlin Cronin and Joe Mason

    Tim added 2 comments

    Patchset-level comments
    File-level comment, Patchset 10 (Latest):
    Tim . resolved

    Adding people back to the attention set after changing up the tabs-test a bit and fixing the issues with android bot again (incognito tab counts are different on android, because the incognito browser launches with 1 tab, as opposed to other platforms launching with 0).

    Devlin: Could you take another look over the tabs tests as they had to change a fair bit to make them more deterministic (and deal with android discrepancies).

    Joe: Could you take a look at the performance manager and resource coordinator code?

    Thanks!

    File chrome/browser/extensions/api/tabs/tabs_test.cc
    Line 2118, Patchset 10 (Latest): int normal_tab_count = GetTabListInterface()->GetTabCount();
    // Note: To avoid having to deal with any platform differences between default
    // tabs when creating a browser changing the total count, we just validate we
    // have more than 0 tabs, so we know the loop below actually does something.
    EXPECT_GT(normal_tab_count, 0);
    Tim . unresolved

    I made these dynamically calculated throughout after discovering the difference with incognito android getting an extra tab. An alternative would be to just hard code how many tabs we expect and add +1 on android incognito, but I felt that is giving this test too much knowledge of specific implementation details from elsewhere in the code. Doing it dynamically makes this resistant to any future changes that might happen there as well.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Devlin Cronin
    • Joe Mason
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
    Gerrit-Change-Number: 7866020
    Gerrit-PatchSet: 10
    Gerrit-Owner: Tim <tjud...@chromium.org>
    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Reviewer: Joe Mason <joenot...@google.com>
    Gerrit-Reviewer: Tim <tjud...@chromium.org>
    Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Attention: Joe Mason <joenot...@google.com>
    Gerrit-Comment-Date: Wed, 10 Jun 2026 17:26:27 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joe Mason (Gerrit)

    unread,
    Jun 10, 2026, 5:17:56 PMJun 10
    to Tim, Devlin Cronin, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, chrome-gr...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Devlin Cronin and Tim

    Joe Mason voted and added 4 comments

    Votes added by Joe Mason

    Code-Review+1

    4 comments

    Patchset-level comments
    Joe Mason . resolved

    LGTM with nits.

    File chrome/browser/extensions/api/tabs/tabs_api.cc
    Line 4090, Patchset 10 (Latest): base::flat_set<base::UnguessableToken> allowed_tokens;
    Joe Mason . unresolved

    Optional nit: current guidance is to use `absl::flat_hash_set` by default. (Not a big deal here because the set's always so small, though.)

    File chrome/browser/performance_manager/policies/page_discarding_helper.cc
    Line 131, Patchset 5: DiscardEligibilityPolicy::DiscardReason discard_reason,
    base::TimeDelta minimum_time_in_background) {
    Tim . resolved

    Note: There's an argument for keeping this surface (and maybe ImmediatelyDiscardMultiplePages) uniform and also take an allowed_browser_context_ids set, but I thought it was better to only add it where we need it for now (DiscardAPage).

    Joe Mason

    Acknowledged

    File chrome/browser/performance_manager/policies/page_discarding_helper_browsertest.cc
    Line 738, Patchset 10 (Latest): EXPECT_TRUE(IsTabDiscarded(
    Joe Mason . unresolved

    Nit: this seems like it could be flaky, since it only attempts 1 tab discard it might randomly discard the incognito tab anyway. I suggest calling DiscardAPage twice, and validating that only the one expected page gets discarded, then call it again with nullopt and verify that the regular tab is discarded now.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Devlin Cronin
    • Tim
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
    Gerrit-Change-Number: 7866020
    Gerrit-PatchSet: 10
    Gerrit-Owner: Tim <tjud...@chromium.org>
    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Reviewer: Joe Mason <joenot...@google.com>
    Gerrit-Reviewer: Tim <tjud...@chromium.org>
    Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Attention: Tim <tjud...@chromium.org>
    Gerrit-Comment-Date: Wed, 10 Jun 2026 21:17:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Tim <tjud...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Devlin Cronin (Gerrit)

    unread,
    Jun 11, 2026, 1:04:50 PMJun 11
    to Tim, Devlin Cronin, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, chrome-gr...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Tim

    Devlin Cronin voted and added 2 comments

    Votes added by Devlin Cronin

    Code-Review+1

    2 comments

    Patchset-level comments
    File-level comment, Patchset 11 (Latest):
    Devlin Cronin . resolved

    s lgtm; thanks, Tim!

    File chrome/browser/extensions/api/tabs/tabs_test.cc
    Line 2118, Patchset 10: int normal_tab_count = GetTabListInterface()->GetTabCount();

    // Note: To avoid having to deal with any platform differences between default
    // tabs when creating a browser changing the total count, we just validate we
    // have more than 0 tabs, so we know the loop below actually does something.
    EXPECT_GT(normal_tab_count, 0);
    Tim . resolved

    I made these dynamically calculated throughout after discovering the difference with incognito android getting an extra tab. An alternative would be to just hard code how many tabs we expect and add +1 on android incognito, but I felt that is giving this test too much knowledge of specific implementation details from elsewhere in the code. Doing it dynamically makes this resistant to any future changes that might happen there as well.

    Devlin Cronin

    Acknowledged

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Tim
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
    Gerrit-Change-Number: 7866020
    Gerrit-PatchSet: 11
    Gerrit-Owner: Tim <tjud...@chromium.org>
    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Reviewer: Joe Mason <joenot...@google.com>
    Gerrit-Reviewer: Tim <tjud...@chromium.org>
    Gerrit-Attention: Tim <tjud...@chromium.org>
    Gerrit-Comment-Date: Thu, 11 Jun 2026 17:04:32 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Tim (Gerrit)

    unread,
    Jun 11, 2026, 2:23:05 PMJun 11
    to Devlin Cronin, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, chrome-gr...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

    Tim voted and added 3 comments

    Votes added by Tim

    Commit-Queue+2

    3 comments

    Patchset-level comments
    File-level comment, Patchset 12 (Latest):
    Tim . resolved

    Thanks folk, merging this one in!

    File chrome/browser/extensions/api/tabs/tabs_api.cc
    Line 4090, Patchset 10: base::flat_set<base::UnguessableToken> allowed_tokens;
    Joe Mason . resolved

    Optional nit: current guidance is to use `absl::flat_hash_set` by default. (Not a big deal here because the set's always so small, though.)

    Tim

    Done

    File chrome/browser/performance_manager/policies/page_discarding_helper_browsertest.cc
    Line 738, Patchset 10: EXPECT_TRUE(IsTabDiscarded(
    Joe Mason . resolved

    Nit: this seems like it could be flaky, since it only attempts 1 tab discard it might randomly discard the incognito tab anyway. I suggest calling DiscardAPage twice, and validating that only the one expected page gets discarded, then call it again with nullopt and verify that the regular tab is discarded now.

    Tim

    Done, although I went with three calls just to be thorough. I also added several comments laying out the reasoning as to exactly _why_ we don't expect certain tabs to be discarded.

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
      Gerrit-Change-Number: 7866020
      Gerrit-PatchSet: 12
      Gerrit-Owner: Tim <tjud...@chromium.org>
      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Reviewer: Joe Mason <joenot...@google.com>
      Gerrit-Reviewer: Tim <tjud...@chromium.org>
      Gerrit-Comment-Date: Thu, 11 Jun 2026 18:22:40 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Joe Mason <joenot...@google.com>
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Jun 11, 2026, 2:27:59 PMJun 11
      to Tim, Devlin Cronin, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, performance-m...@chromium.org, chrome-gr...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

      Chromium LUCI CQ submitted the change

      Unreviewed changes

      11 is the latest approved patch-set.
      No files were changed between the latest approved patch-set and the submitted one.

      Change information

      Commit message:
      [Extensions] Filter profiles for tabs.discard appropriately

      When a tab ID is not passed to tabs.discard we leave the choice of which
      tab to discard up to resource_coordinator::DiscardLeastImportantTab.
      This CL adds the ability to pass a set of allowed_browser_context_ids to
      additionally limit which browser contexts the resource coordinator can
      discard from and passes the appropriate IDs for these based on the
      extension incognito settings.

      Also adds associated tests to cover these cases.
      Fixed: 513502990
      Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
      Commit-Queue: Tim <tjud...@chromium.org>
      Reviewed-by: Joe Mason <joenot...@google.com>
      Reviewed-by: Devlin Cronin <rdevlin...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1645500}
      Files:
      • M chrome/browser/extensions/api/tabs/tabs_api.cc
      • M chrome/browser/extensions/api/tabs/tabs_test.cc
      • M chrome/browser/performance_manager/policies/page_discarding_helper.cc
      • M chrome/browser/performance_manager/policies/page_discarding_helper.h
      • M chrome/browser/performance_manager/policies/page_discarding_helper_browsertest.cc
      • M chrome/browser/resource_coordinator/utils.cc
      • M chrome/browser/resource_coordinator/utils.h
      Change size: L
      Delta: 7 files changed, 373 insertions(+), 15 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Joe Mason, +1 by Devlin Cronin
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I2b373146e921a352afc8859f8ff4ecdf104c6303
      Gerrit-Change-Number: 7866020
      Gerrit-PatchSet: 13
      Gerrit-Owner: Tim <tjud...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Reviewer: Joe Mason <joenot...@google.com>
      Gerrit-Reviewer: Tim <tjud...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages