[TabRendererData] Move discard code into the TabUiHelper [chromium/src : main]

0 views
Skip to first unread message

Steven Luong (Gerrit)

unread,
Feb 12, 2026, 7:01:58 PM (8 days ago) Feb 12
to Eshwar Stalin, Chromium LUCI CQ, chromium...@chromium.org, chrome-gr...@chromium.org
Attention needed from Eshwar Stalin

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Eshwar Stalin
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • 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: Ice4f078ab77d4b99c95128dfdfe7a250a876524d
Gerrit-Change-Number: 7569197
Gerrit-PatchSet: 3
Gerrit-Owner: Steven Luong <stl...@chromium.org>
Gerrit-Reviewer: Eshwar Stalin <est...@chromium.org>
Gerrit-Reviewer: Steven Luong <stl...@chromium.org>
Gerrit-Attention: Eshwar Stalin <est...@chromium.org>
Gerrit-Comment-Date: Fri, 13 Feb 2026 00:01:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Eshwar Stalin (Gerrit)

unread,
Feb 12, 2026, 8:40:10 PM (8 days ago) Feb 12
to Steven Luong, Chromium LUCI CQ, chromium...@chromium.org, chrome-gr...@chromium.org
Attention needed from Steven Luong

Eshwar Stalin added 7 comments

File chrome/browser/ui/tab_ui_helper.h
Line 91, Patchset 3 (Latest): base::ByteSize DiscardedMemorySavings();
Eshwar Stalin . unresolved

Should this be optional?

Line 62, Patchset 3 (Latest): using TitleUpdatedCallbackList =
base::RepeatingCallbackList<void(std::u16string)>;
base::CallbackListSubscription AddTitleUpdatedCallback(
TitleUpdatedCallbackList::CallbackType callback);
Eshwar Stalin . unresolved

Seems like this isn't used other than test, can we remove?

Line 43, Patchset 3 (Latest): base::CallbackListSubscription AddTabUiChangeCallback(
Eshwar Stalin . unresolved

Please capitalize UI

File chrome/browser/ui/tab_ui_helper.cc
Line 137, Patchset 3 (Latest): title_change_callbacks_.Notify(GetTitle());
Eshwar Stalin . unresolved

Can we use the new callback? Also look at other places where this needs to be notified.

Line 155, Patchset 3 (Latest): // Notify observers that the tab should update its UI to show discard status.
if (ShouldShowDiscardUi()) {
Eshwar Stalin . unresolved

Shouldn't this be fired unconditionally? What if we want to update from showing -> not showing state?

File chrome/browser/ui/tabs/tab_renderer_data.cc
Line 154, Patchset 3 (Latest): data.should_show_discard_status = tab_ui_helper->ShouldShowDiscardUi();
Eshwar Stalin . unresolved

nit: ShouldShowDiscardStatus instead of UI.

Line 155, Patchset 3 (Latest): data.discarded_memory_savings = tab_ui_helper->DiscardedMemorySavings();
Eshwar Stalin . unresolved

nit: GetDiscardedMemorySavings?

Open in Gerrit

Related details

Attention is currently required from:
  • Steven Luong
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: Ice4f078ab77d4b99c95128dfdfe7a250a876524d
    Gerrit-Change-Number: 7569197
    Gerrit-PatchSet: 3
    Gerrit-Owner: Steven Luong <stl...@chromium.org>
    Gerrit-Reviewer: Eshwar Stalin <est...@chromium.org>
    Gerrit-Reviewer: Steven Luong <stl...@chromium.org>
    Gerrit-Attention: Steven Luong <stl...@chromium.org>
    Gerrit-Comment-Date: Fri, 13 Feb 2026 01:40:01 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Steven Luong (Gerrit)

    unread,
    Feb 13, 2026, 1:07:15 PM (7 days ago) Feb 13
    to Eshwar Stalin, Chromium LUCI CQ, chromium...@chromium.org, chrome-gr...@chromium.org
    Attention needed from Eshwar Stalin

    Steven Luong added 7 comments

    File chrome/browser/ui/tab_ui_helper.h
    Line 91, Patchset 3: base::ByteSize DiscardedMemorySavings();
    Eshwar Stalin . resolved

    Should this be optional?

    Steven Luong

    Right now the TabRendererData code treats non-discarded memory savings as 0 since the tab is not discarded but semantically making it optional probably makes more sense.

    Line 62, Patchset 3: using TitleUpdatedCallbackList =

    base::RepeatingCallbackList<void(std::u16string)>;
    base::CallbackListSubscription AddTitleUpdatedCallback(
    TitleUpdatedCallbackList::CallbackType callback);
    Eshwar Stalin . resolved

    Seems like this isn't used other than test, can we remove?

    Steven Luong

    Ack. Yeah I will remove this in a follow up CL since the callback should be moved into the generic tab changed callback.

    Line 43, Patchset 3: base::CallbackListSubscription AddTabUiChangeCallback(
    Eshwar Stalin . resolved

    Please capitalize UI

    Steven Luong

    Acknowledged

    File chrome/browser/ui/tab_ui_helper.cc
    Line 137, Patchset 3: title_change_callbacks_.Notify(GetTitle());
    Eshwar Stalin . resolved

    Can we use the new callback? Also look at other places where this needs to be notified.

    Steven Luong

    Ack. Will move this to the new callback in a follow up CL since we can probably just delete the title change.

    Line 155, Patchset 3: // Notify observers that the tab should update its UI to show discard status.
    if (ShouldShowDiscardUi()) {
    Eshwar Stalin . unresolved

    Shouldn't this be fired unconditionally? What if we want to update from showing -> not showing state?

    Steven Luong

    TabUIHelper::WasDiscarded() is only called after the tab is discarded. The only time we go from showing->not showing the UI is when the discarded tab gets reloaded and that doesn't trigger a WasDiscarded() call.

    File chrome/browser/ui/tabs/tab_renderer_data.cc
    Line 154, Patchset 3: data.should_show_discard_status = tab_ui_helper->ShouldShowDiscardUi();
    Eshwar Stalin . resolved

    nit: ShouldShowDiscardStatus instead of UI.

    Steven Luong

    Done

    Line 155, Patchset 3: data.discarded_memory_savings = tab_ui_helper->DiscardedMemorySavings();
    Eshwar Stalin . resolved

    nit: GetDiscardedMemorySavings?

    Steven Luong

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Eshwar Stalin
    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: Ice4f078ab77d4b99c95128dfdfe7a250a876524d
    Gerrit-Change-Number: 7569197
    Gerrit-PatchSet: 4
    Gerrit-Owner: Steven Luong <stl...@chromium.org>
    Gerrit-Reviewer: Eshwar Stalin <est...@chromium.org>
    Gerrit-Reviewer: Steven Luong <stl...@chromium.org>
    Gerrit-Attention: Eshwar Stalin <est...@chromium.org>
    Gerrit-Comment-Date: Fri, 13 Feb 2026 18:07:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Eshwar Stalin <est...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Eshwar Stalin (Gerrit)

    unread,
    Feb 13, 2026, 2:00:13 PM (7 days ago) Feb 13
    to Steven Luong, Chromium LUCI CQ, chromium...@chromium.org, chrome-gr...@chromium.org
    Attention needed from Steven Luong

    Eshwar Stalin voted and added 2 comments

    Votes added by Eshwar Stalin

    Code-Review+1

    2 comments

    File chrome/browser/ui/tab_ui_helper.cc
    Line 155, Patchset 3: // Notify observers that the tab should update its UI to show discard status.
    if (ShouldShowDiscardUi()) {
    Eshwar Stalin . unresolved

    Shouldn't this be fired unconditionally? What if we want to update from showing -> not showing state?

    Steven Luong

    TabUIHelper::WasDiscarded() is only called after the tab is discarded. The only time we go from showing->not showing the UI is when the discarded tab gets reloaded and that doesn't trigger a WasDiscarded() call.

    Eshwar Stalin

    Ok in that case, we need to notify in that scenario as well. Would that be covered when we notify during page reload?

    I think this is where I think we need to dig into how that all needs to be coordinated since some of that logic is currently happening in browser.cc. From what I see it doing is its coalesing updates and batching them. So it does provide a functionality that cannot be simply handled in TabUIHelper. I believe what we can do is have browser.cc call into TabUIHelper to trigger the update instead of going to TabStripModel.

    This feedback isn't blocking this CL but effectively tab_ui_change_callbacks_ in its current state doesn't really work. So two options 1) Leave for now. It really doesn't work but we will fix it correctly in the future. Until then don't have any clients use tab_ui_change_callbacks_. 2) Land the change for observation as a separate CL once we consolidate more things into TabUIHelper and we fully integrate with browser.cc.

    Eitherway is fine with me.

    Line 174, Patchset 5 (Latest): content::WebContents* const web_contents = tab().GetContents();
    Eshwar Stalin . resolved

    This uses the new contents that was created after discarding correct?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Steven Luong
    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: Ice4f078ab77d4b99c95128dfdfe7a250a876524d
    Gerrit-Change-Number: 7569197
    Gerrit-PatchSet: 5
    Gerrit-Owner: Steven Luong <stl...@chromium.org>
    Gerrit-Reviewer: Eshwar Stalin <est...@chromium.org>
    Gerrit-Reviewer: Steven Luong <stl...@chromium.org>
    Gerrit-Attention: Steven Luong <stl...@chromium.org>
    Gerrit-Comment-Date: Fri, 13 Feb 2026 19:00:03 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Steven Luong <stl...@chromium.org>
    Comment-In-Reply-To: Eshwar Stalin <est...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Steven Luong (Gerrit)

    unread,
    Feb 13, 2026, 2:14:25 PM (7 days ago) Feb 13
    to Eshwar Stalin, Chromium LUCI CQ, chromium...@chromium.org, chrome-gr...@chromium.org

    Steven Luong added 1 comment

    File chrome/browser/ui/tab_ui_helper.cc
    Line 155, Patchset 3: // Notify observers that the tab should update its UI to show discard status.
    if (ShouldShowDiscardUi()) {
    Eshwar Stalin . resolved

    Shouldn't this be fired unconditionally? What if we want to update from showing -> not showing state?

    Steven Luong

    TabUIHelper::WasDiscarded() is only called after the tab is discarded. The only time we go from showing->not showing the UI is when the discarded tab gets reloaded and that doesn't trigger a WasDiscarded() call.

    Eshwar Stalin

    Ok in that case, we need to notify in that scenario as well. Would that be covered when we notify during page reload?

    I think this is where I think we need to dig into how that all needs to be coordinated since some of that logic is currently happening in browser.cc. From what I see it doing is its coalesing updates and batching them. So it does provide a functionality that cannot be simply handled in TabUIHelper. I believe what we can do is have browser.cc call into TabUIHelper to trigger the update instead of going to TabStripModel.

    This feedback isn't blocking this CL but effectively tab_ui_change_callbacks_ in its current state doesn't really work. So two options 1) Leave for now. It really doesn't work but we will fix it correctly in the future. Until then don't have any clients use tab_ui_change_callbacks_. 2) Land the change for observation as a separate CL once we consolidate more things into TabUIHelper and we fully integrate with browser.cc.

    Eitherway is fine with me.

    Steven Luong

    Ack. Yup when the TabUIHelper accounts for when tabs are reloading, then it will automatically handle the state from showing -> not showing discard UI. In that case, I'll move forward with option 2.

    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: Ice4f078ab77d4b99c95128dfdfe7a250a876524d
      Gerrit-Change-Number: 7569197
      Gerrit-PatchSet: 5
      Gerrit-Owner: Steven Luong <stl...@chromium.org>
      Gerrit-Reviewer: Eshwar Stalin <est...@chromium.org>
      Gerrit-Reviewer: Steven Luong <stl...@chromium.org>
      Gerrit-Comment-Date: Fri, 13 Feb 2026 19:14:16 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      open
      diffy

      Steven Luong (Gerrit)

      unread,
      Feb 13, 2026, 2:14:44 PM (7 days ago) Feb 13
      to Eshwar Stalin, Chromium LUCI CQ, chromium...@chromium.org, chrome-gr...@chromium.org

      Steven Luong voted Commit-Queue+2

      Commit-Queue+2
      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: Ice4f078ab77d4b99c95128dfdfe7a250a876524d
      Gerrit-Change-Number: 7569197
      Gerrit-PatchSet: 6
      Gerrit-Owner: Steven Luong <stl...@chromium.org>
      Gerrit-Reviewer: Eshwar Stalin <est...@chromium.org>
      Gerrit-Reviewer: Steven Luong <stl...@chromium.org>
      Gerrit-Comment-Date: Fri, 13 Feb 2026 19:14:34 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Feb 13, 2026, 2:18:00 PM (7 days ago) Feb 13
      to Steven Luong, Eshwar Stalin, chromium...@chromium.org, chrome-gr...@chromium.org

      Chromium LUCI CQ submitted the change

      Unreviewed changes

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

      Change information

      Commit message:
      [TabRendererData] Move discard code into the TabUiHelper

      Moves the discard logic from the TabRendererData and into the
      TabUiHelper.
      Bug: 447216103
      Change-Id: Ice4f078ab77d4b99c95128dfdfe7a250a876524d
      Commit-Queue: Steven Luong <stl...@chromium.org>
      Reviewed-by: Eshwar Stalin <est...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1584792}
      Files:
      • M chrome/browser/ui/tab_ui_helper.cc
      • M chrome/browser/ui/tab_ui_helper.h
      • M chrome/browser/ui/tab_ui_helper_browsertest.cc
      • M chrome/browser/ui/tabs/tab_renderer_data.cc
      Change size: M
      Delta: 4 files changed, 99 insertions(+), 32 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Eshwar Stalin
      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: Ice4f078ab77d4b99c95128dfdfe7a250a876524d
      Gerrit-Change-Number: 7569197
      Gerrit-PatchSet: 7
      Gerrit-Owner: Steven Luong <stl...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Eshwar Stalin <est...@chromium.org>
      Gerrit-Reviewer: Steven Luong <stl...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages