[DebugUITabStrip] Add SessionRestore metadata to tab-strip-internals [chromium/src : main]

0 views
Skip to first unread message

Brijesh Giri (Gerrit)

unread,
Oct 26, 2025, 9:35:56 AMOct 26
to Darryl James, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Darryl James

Brijesh Giri added 2 comments

File chrome/browser/sessions/session_restore.cc
Line 1522, Patchset 1:void SessionRestore::OnGotSession(
Brijesh Giri . unresolved

Does this method represent a `Primitive Obsession` code-smell?

Would it make sense to group related session restore properties together in a struct (data-class)?

File chrome/browser/sessions/session_restore_observer.h
Line 42, Patchset 1: virtual void OnGotSession(
Brijesh Giri . unresolved

Question: Does adding a new overload here break Interface Segregation Principle?

Or does providing a default no-op implementation make it exempt from the anti-pattern?

Open in Gerrit

Related details

Attention is currently required from:
  • Darryl James
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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
Gerrit-Change-Number: 7063490
Gerrit-PatchSet: 3
Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
Gerrit-Attention: Darryl James <dlj...@chromium.org>
Gerrit-Comment-Date: Sun, 26 Oct 2025 13:35:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Brijesh Giri (Gerrit)

unread,
Oct 26, 2025, 10:06:59 AMOct 26
to Darryl James, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Darryl James

Brijesh Giri added 1 comment

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals.mojom
Line 18, Patchset 3: SessionRestoreData restored_session;
Brijesh Giri . unresolved

@dlj...@chromium.org

I was able to hook into both `SessionService` (to read session data from disk without invalidating it) and `SessionRestoreObserver` (to observe callbacks when a session is restored). I added fields for both data sources to test how they behave in different scenarios.

From my testing, retrieving data through the observer is more ephemeral i.e. our debug page must already be open when the restore action occurs for it to receive those callbacks. In other words, you need to open the debug page first and then trigger the restore; refreshing the page creates new instances that no longer have access to the previously received callback data, resulting in an empty `restored_session`.

In contrast, the `saved_session` data obtained through SessionService remains valid across refreshes and after restore operations. During testing, I observed that the session data persisted on disk and was not immediately invalidated by a restore. Only closing the browser caused the on-disk session state to be replaced with new data.

Open in Gerrit

Related details

Attention is currently required from:
  • Darryl James
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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
Gerrit-Change-Number: 7063490
Gerrit-PatchSet: 5
Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
Gerrit-Attention: Darryl James <dlj...@chromium.org>
Gerrit-Comment-Date: Sun, 26 Oct 2025 14:06:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Brijesh Giri (Gerrit)

unread,
Oct 27, 2025, 2:32:02 PMOct 27
to Atharv Maan, Darryl James, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Atharv Maan and Darryl James

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Atharv Maan
  • Darryl James
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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
Gerrit-Change-Number: 7063490
Gerrit-PatchSet: 5
Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
Gerrit-Attention: Darryl James <dlj...@chromium.org>
Gerrit-Attention: Atharv Maan <athar...@chromium.org>
Gerrit-Comment-Date: Mon, 27 Oct 2025 18:31:56 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Darryl James (Gerrit)

unread,
Oct 31, 2025, 2:33:38 PMOct 31
to Brijesh Giri, Atharv Maan, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Atharv Maan and Brijesh Giri

Darryl James added 4 comments

File chrome/browser/sessions/session_restore.h
Line 128, Patchset 5 (Latest): int window_count,
Darryl James . unresolved

This one can be removed since we can get the number of windows from `windows`

File chrome/browser/sessions/session_restore.cc
Line 1522, Patchset 1:void SessionRestore::OnGotSession(
Brijesh Giri . unresolved

Does this method represent a `Primitive Obsession` code-smell?

Would it make sense to group related session restore properties together in a struct (data-class)?

Darryl James

You can definitely group the properties in a struct, however in this case there are few enough parameters where it won't give us too much value (especially when window count gets removed).

File chrome/browser/sessions/session_restore_observer.h
Line 42, Patchset 1: virtual void OnGotSession(
Brijesh Giri . unresolved

Question: Does adding a new overload here break Interface Segregation Principle?

Or does providing a default no-op implementation make it exempt from the anti-pattern?

Darryl James

I would update the existing one and remove this overload. `window_count` can be inferred from `windows`. This also allows the callers to be funnelled into one function making it easier to debug (you only have to worry about 1 implementation).

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals.mojom
Line 18, Patchset 3: SessionRestoreData restored_session;
Brijesh Giri . resolved

@dlj...@chromium.org

I was able to hook into both `SessionService` (to read session data from disk without invalidating it) and `SessionRestoreObserver` (to observe callbacks when a session is restored). I added fields for both data sources to test how they behave in different scenarios.

From my testing, retrieving data through the observer is more ephemeral i.e. our debug page must already be open when the restore action occurs for it to receive those callbacks. In other words, you need to open the debug page first and then trigger the restore; refreshing the page creates new instances that no longer have access to the previously received callback data, resulting in an empty `restored_session`.

In contrast, the `saved_session` data obtained through SessionService remains valid across refreshes and after restore operations. During testing, I observed that the session data persisted on disk and was not immediately invalidated by a restore. Only closing the browser caused the on-disk session state to be replaced with new data.

Darryl James

That is surprising to me! Let's keep this behavior for now 👍

Open in Gerrit

Related details

Attention is currently required from:
  • Atharv Maan
  • Brijesh Giri
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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
Gerrit-Change-Number: 7063490
Gerrit-PatchSet: 5
Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
Gerrit-Attention: Brijesh Giri <brijes...@gmail.com>
Gerrit-Attention: Atharv Maan <athar...@chromium.org>
Gerrit-Comment-Date: Fri, 31 Oct 2025 18:33:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Brijesh Giri <brijes...@gmail.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Brijesh Giri (Gerrit)

unread,
Nov 25, 2025, 12:21:25 AMNov 25
to Atharv Maan, Darryl James, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Darryl James

Brijesh Giri added 5 comments

File chrome/browser/ash/app_restore/full_restore_app_launch_handler.cc
Line 202, Patchset 6 (Latest): const std::vector<const sessions::SessionWindow*>& windows) {
Brijesh Giri . unresolved

@dlj...@chromium.org

Could this potentially be a dangling reference issue if the caller of this observer method is destroyed while the observer is acting on the callback?

For context, these observer methods are invoked by `SessionRestore` which owns the actual `SessionWindow` objects. The observers only receive a vector of raw pointers to the `SessionWindow` objects.

File chrome/browser/sessions/session_restore.h
Line 128, Patchset 5: int window_count,
Darryl James . resolved

This one can be removed since we can get the number of windows from `windows`

Brijesh Giri

Done

File chrome/browser/sessions/session_restore.cc
Line 1522, Patchset 1:void SessionRestore::OnGotSession(
Brijesh Giri . resolved

Does this method represent a `Primitive Obsession` code-smell?

Would it make sense to group related session restore properties together in a struct (data-class)?

Darryl James

You can definitely group the properties in a struct, however in this case there are few enough parameters where it won't give us too much value (especially when window count gets removed).

Brijesh Giri

Done

File chrome/browser/sessions/session_restore_observer.h
Line 42, Patchset 1: virtual void OnGotSession(
Brijesh Giri . resolved

Question: Does adding a new overload here break Interface Segregation Principle?

Or does providing a default no-op implementation make it exempt from the anti-pattern?

Darryl James

I would update the existing one and remove this overload. `window_count` can be inferred from `windows`. This also allows the callers to be funnelled into one function making it easier to debug (you only have to worry about 1 implementation).

Brijesh Giri

Done

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_observer.cc
Line 186, Patchset 6 (Latest): last_session_windows_.push_back(DeepCopySessionWindow(window));
Brijesh Giri . unresolved

@dlj...@chromium.org

Deep copying as a precaution in-case the caller of this observer method gets destroyed before this callback is fully processed.

`SessionRestore` passes a vector of raw pointers to `SessionWindow` objects to the observers, which could potentially be destroyed before the TabStripInternalsObserver is completed with its callback flow.

Open in Gerrit

Related details

Attention is currently required from:
  • Darryl James
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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
Gerrit-Change-Number: 7063490
Gerrit-PatchSet: 6
Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
Gerrit-Attention: Darryl James <dlj...@chromium.org>
Gerrit-Comment-Date: Tue, 25 Nov 2025 05:21:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Brijesh Giri <brijes...@gmail.com>
Comment-In-Reply-To: Darryl James <dlj...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Darryl James (Gerrit)

unread,
Nov 25, 2025, 1:09:41 PMNov 25
to Brijesh Giri, Atharv Maan, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Brijesh Giri

Darryl James added 4 comments

File chrome/browser/ash/app_restore/full_restore_app_launch_handler.cc
Line 202, Patchset 6: const std::vector<const sessions::SessionWindow*>& windows) {
Brijesh Giri . resolved

@dlj...@chromium.org

Could this potentially be a dangling reference issue if the caller of this observer method is destroyed while the observer is acting on the callback?

For context, these observer methods are invoked by `SessionRestore` which owns the actual `SessionWindow` objects. The observers only receive a vector of raw pointers to the `SessionWindow` objects.

Darryl James

Were you seeing this happen by any chance?

I think in the general sense that would be possible but if we look at when the observers are notified [starting from here](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/sessions/session_restore.cc;drc=b32663066c4707a90f117b579f1993c7b74a0ad1;l=284) we can see that in the callback we are passing a weak ptr which helps us with the lifetime management if session restore is destroyed.

Going into OnGotSession, we can see that at that point in time we have the windows vector and that the observers are immediately notified of the session we have retrieved. From that perspective, we should not encounter any dangling pointer issues. I guess someone could remove / delete one of the session windows before handing the vector to callers but that would be a separate issue entirely!

So overall, I don't think we have a dangling pointer here. Do let me know if that is not the case!

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals.mojom
Line 232, Patchset 7 (Latest):// `components/sessions/core/session_types.h.h`
Darryl James . unresolved

super nit: remove the additional `.h` 👍

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_handler.cc
Line 38, Patchset 7 (Latest): pending_callback_ = std::move(callback);
Darryl James . unresolved

Should we check if there are an already pending_callback_ before doing anything else? Maybe early return?

My worry is that this could get called multiple times and we end up overwriting the data and the wrong callback ends up getting called.

My preference would be to early return if there is an early callback. But depending on how we want to handle things, it would also be okay to store a list of pending callbacks that we process asynchronously / as they are called. But that might be more than we need in this case.

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_observer.cc
Line 186, Patchset 6: last_session_windows_.push_back(DeepCopySessionWindow(window));
Brijesh Giri . unresolved

@dlj...@chromium.org

Deep copying as a precaution in-case the caller of this observer method gets destroyed before this callback is fully processed.

`SessionRestore` passes a vector of raw pointers to `SessionWindow` objects to the observers, which could potentially be destroyed before the TabStripInternalsObserver is completed with its callback flow.

Darryl James

Let's add a brief comment to why we are deep copying here for future reference 👍

Open in Gerrit

Related details

Attention is currently required from:
  • Brijesh Giri
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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
Gerrit-Change-Number: 7063490
Gerrit-PatchSet: 7
Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
Gerrit-Attention: Brijesh Giri <brijes...@gmail.com>
Gerrit-Comment-Date: Tue, 25 Nov 2025 18:09:30 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Brijesh Giri (Gerrit)

unread,
Nov 26, 2025, 4:35:24 PMNov 26
to Atharv Maan, Darryl James, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Darryl James

Brijesh Giri added 1 comment

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_handler.cc
Line 38, Patchset 7: pending_callback_ = std::move(callback);
Darryl James . unresolved

Should we check if there are an already pending_callback_ before doing anything else? Maybe early return?

My worry is that this could get called multiple times and we end up overwriting the data and the wrong callback ends up getting called.

My preference would be to early return if there is an early callback. But depending on how we want to handle things, it would also be okay to store a list of pending callbacks that we process asynchronously / as they are called. But that might be more than we need in this case.

Brijesh Giri

Good idea. I admit that in-case of multiple calls, we would respond to the latest (incorrect) callback.

I have a chain of thought that I need to validate with you, apologies in advance for the long comment.

Could we also potentially add a `CHECK` to guard against having multiple in-flight requests?

My reasoning here is that we never call this method twice from our renderer process. We only call `GetTabStripData` once during page load.

I assume that on a page refresh, the entire WebUI stack is torn down: the C++ objects (controller and page handler) are destroyed along with any `pending_callback_`, the Mojo pipes are closed, and the JS objects are discarded. A new set of C++ and JS objects are then created, and the renderer issues a fresh `GetTabStripData()` call to the new handler. In summary, a stale pending_callback_ cannot survive a reload.

Similarly, if multiple `chrome://tab-strip-internals` tabs are open, each tab has its own independent C++ and JS WebUI instances. Each one calls GetTabStripData() exactly once on its own handler, so even in this scenario we never end up issuing multiple calls to the same handler instance.

We have below three options, all of which ensure we send response to the correct callback:

  • Early return (Drop duplicates)
  • Maintain a list of callbacks
  • Establish that only 1 in-flight request can be handled from the a single renderer (debug UI tab) at a time by adding a CHECK

I agree with the `early return` suggestion, just needed to confirm my understanding of object lifecycle in a WebUI, hence the comment.

Open in Gerrit

Related details

Attention is currently required from:
  • Darryl James
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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
Gerrit-Change-Number: 7063490
Gerrit-PatchSet: 8
Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
Gerrit-Attention: Darryl James <dlj...@chromium.org>
Gerrit-Comment-Date: Wed, 26 Nov 2025 21:35:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Darryl James <dlj...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Brijesh Giri (Gerrit)

unread,
Nov 26, 2025, 4:35:49 PMNov 26
to Atharv Maan, Darryl James, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Darryl James

Brijesh Giri added 2 comments

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals.mojom
Line 232, Patchset 7:// `components/sessions/core/session_types.h.h`
Darryl James . resolved

super nit: remove the additional `.h` 👍

Brijesh Giri

Done. Thanks for catching this!

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_observer.cc
Line 186, Patchset 6: last_session_windows_.push_back(DeepCopySessionWindow(window));
Brijesh Giri . resolved

@dlj...@chromium.org

Deep copying as a precaution in-case the caller of this observer method gets destroyed before this callback is fully processed.

`SessionRestore` passes a vector of raw pointers to `SessionWindow` objects to the observers, which could potentially be destroyed before the TabStripInternalsObserver is completed with its callback flow.

Darryl James

Let's add a brief comment to why we are deep copying here for future reference 👍

Brijesh Giri

Done

Gerrit-Comment-Date: Wed, 26 Nov 2025 21:35:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Darryl James (Gerrit)

unread,
Nov 26, 2025, 5:38:44 PMNov 26
to Brijesh Giri, Atharv Maan, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Brijesh Giri

Darryl James added 1 comment

File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_handler.cc
Line 38, Patchset 7: pending_callback_ = std::move(callback);
Darryl James . resolved

Should we check if there are an already pending_callback_ before doing anything else? Maybe early return?

My worry is that this could get called multiple times and we end up overwriting the data and the wrong callback ends up getting called.

My preference would be to early return if there is an early callback. But depending on how we want to handle things, it would also be okay to store a list of pending callbacks that we process asynchronously / as they are called. But that might be more than we need in this case.

Brijesh Giri

Good idea. I admit that in-case of multiple calls, we would respond to the latest (incorrect) callback.

I have a chain of thought that I need to validate with you, apologies in advance for the long comment.

Could we also potentially add a `CHECK` to guard against having multiple in-flight requests?

My reasoning here is that we never call this method twice from our renderer process. We only call `GetTabStripData` once during page load.

I assume that on a page refresh, the entire WebUI stack is torn down: the C++ objects (controller and page handler) are destroyed along with any `pending_callback_`, the Mojo pipes are closed, and the JS objects are discarded. A new set of C++ and JS objects are then created, and the renderer issues a fresh `GetTabStripData()` call to the new handler. In summary, a stale pending_callback_ cannot survive a reload.

Similarly, if multiple `chrome://tab-strip-internals` tabs are open, each tab has its own independent C++ and JS WebUI instances. Each one calls GetTabStripData() exactly once on its own handler, so even in this scenario we never end up issuing multiple calls to the same handler instance.

We have below three options, all of which ensure we send response to the correct callback:

  • Early return (Drop duplicates)
  • Maintain a list of callbacks
  • Establish that only 1 in-flight request can be handled from the a single renderer (debug UI tab) at a time by adding a CHECK

I agree with the `early return` suggestion, just needed to confirm my understanding of object lifecycle in a WebUI, hence the comment.

Darryl James

Good question, my understanding is that in general everything gets torn down when the page is reloaded / a new render frame host is assigned to the web contents.

I wouldn't be surprised if there were caveats to this rule though. So playing it safe is preferred. If possible I would like to avoid CHECKs on the UI as that would crash the program when it doesn't have to. It's okay to show stale data in this case.

Open in Gerrit

Related details

Attention is currently required from:
  • Brijesh Giri
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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
    Gerrit-Change-Number: 7063490
    Gerrit-PatchSet: 8
    Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
    Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
    Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
    Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
    Gerrit-Attention: Brijesh Giri <brijes...@gmail.com>
    Gerrit-Comment-Date: Wed, 26 Nov 2025 22:38:38 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Darryl James (Gerrit)

    unread,
    Dec 5, 2025, 2:18:12 PM (11 days ago) Dec 5
    to Brijesh Giri, Atharv Maan, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Brijesh Giri

    Darryl James added 1 comment

    File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_handler.cc
    Line 40, Patchset 8 (Latest): return;
    Darryl James . unresolved

    Let's also call `std::move(callback).Run(BuildSnapshot());` in this block. I want to prevent the UI from hanging if this is called multiple times and we have an in flight request. By running the snapshot immediately, stale data will return but that is okay provided the asynchronous data will update the page once it is done. Otherwise the user should be able to refresh the page to get the latest data 👍

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brijesh Giri
    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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
      Gerrit-Change-Number: 7063490
      Gerrit-PatchSet: 8
      Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
      Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
      Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
      Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
      Gerrit-Attention: Brijesh Giri <brijes...@gmail.com>
      Gerrit-Comment-Date: Fri, 05 Dec 2025 19:18:02 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Brijesh Giri (Gerrit)

      unread,
      Dec 7, 2025, 6:48:08 PM (9 days ago) Dec 7
      to Atharv Maan, Darryl James, Chromium LUCI CQ, chromium...@chromium.org
      Attention needed from Darryl James

      Brijesh Giri added 1 comment

      File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_handler.cc
      Line 40, Patchset 8: return;
      Darryl James . resolved

      Let's also call `std::move(callback).Run(BuildSnapshot());` in this block. I want to prevent the UI from hanging if this is called multiple times and we have an in flight request. By running the snapshot immediately, stale data will return but that is okay provided the asynchronous data will update the page once it is done. Otherwise the user should be able to refresh the page to get the latest data 👍

      Brijesh Giri

      Done!

      PS: I tested out both the scenarios (hanging the UI as well as sending stale data). The UI lag is not that noticeable because the async call resolves pretty quickly.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Darryl James
      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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
        Gerrit-Change-Number: 7063490
        Gerrit-PatchSet: 9
        Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
        Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
        Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
        Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
        Gerrit-Attention: Darryl James <dlj...@chromium.org>
        Gerrit-Comment-Date: Sun, 07 Dec 2025 23:48:02 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Darryl James <dlj...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Atharv Maan (Gerrit)

        unread,
        Dec 11, 2025, 3:42:46 PM (5 days ago) Dec 11
        to Brijesh Giri, Darryl James, Chromium LUCI CQ, chromium...@chromium.org
        Attention needed from Brijesh Giri and Darryl James

        Atharv Maan added 5 comments

        File chrome/browser/ash/app_restore/full_restore_app_launch_handler.h
        Line 102, Patchset 9 (Latest): const std::vector<const sessions::SessionWindow*>& windows) override;
        Atharv Maan . unresolved

        forward declare this.

        File chrome/browser/sessions/session_restore.cc
        Line 544, Patchset 9 (Latest): windows_view.reserve(windows_.size());
        Atharv Maan . unresolved

        What's the difference in using `windows` vs `windows_`? Is there a reason why we switched to the class member `windows_`?

        File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_handler.h
        Line 20, Patchset 9 (Latest):namespace sessions {

        struct SessionWindow;

        } // namespace sessions
        Atharv Maan . unresolved

        supernit: remove the newlines inside namespace

        File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_observer.cc
        Line 19, Patchset 9 (Latest):std::unique_ptr<sessions::SessionTab> DeepCopySessionTab(
        Atharv Maan . unresolved

        IWYU

        File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_util.h
        Line 42, Patchset 9 (Latest): const std::vector<std::unique_ptr<sessions::SessionWindow>>& windows);
        Atharv Maan . unresolved

        include <memory> and <vector>

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Brijesh Giri
        • Darryl James
        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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
          Gerrit-Change-Number: 7063490
          Gerrit-PatchSet: 9
          Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
          Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
          Gerrit-Attention: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Attention: Darryl James <dlj...@chromium.org>
          Gerrit-Comment-Date: Thu, 11 Dec 2025 20:42:39 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Brijesh Giri (Gerrit)

          unread,
          Dec 14, 2025, 11:18:49 PM (2 days ago) Dec 14
          to Atharv Maan, Darryl James, Chromium LUCI CQ, chromium...@chromium.org
          Attention needed from Atharv Maan and Darryl James

          Brijesh Giri added 5 comments

          File chrome/browser/ash/app_restore/full_restore_app_launch_handler.h
          Line 102, Patchset 9: const std::vector<const sessions::SessionWindow*>& windows) override;
          Atharv Maan . unresolved

          forward declare this.

          Brijesh Giri

          It is already forward-declared in the `c/b/sessions/session_restore_observer.h` header that this file depends due to inheritance i.e. `FullRestoreAppLaunchHandler` is a `SessionRestoreObserver` and needs to import it's header.

          File chrome/browser/sessions/session_restore.cc
          Line 544, Patchset 9: windows_view.reserve(windows_.size());
          Atharv Maan . unresolved

          What's the difference in using `windows` vs `windows_`? Is there a reason why we switched to the class member `windows_`?

          Brijesh Giri

          In the existing code `windows` gets copied over to `windows_` with the below comment and cleared immediately:

          ```
          // Copy windows into windows_ so that we can combine both app and browser
          // windows together before doing a one-pass restore.
          std::ranges::move(windows, std::back_inserter(windows_));
          SessionRestore::OnGotSession(profile(), for_apps, windows.size());
          windows.clear();
          ```

          Both are identical at the point when our newly added code gets executed:
          ```
          // Build a read-only view of the windows for the observers.
          std::vector<const sessions::SessionWindow*> windows_view;
          windows_view.reserve(windows_.size());
          for (const auto& w : windows_) {
          windows_view.push_back(w.get());
          }
          ```

          There was no specific reason for choosing one over the other, either of them work for our purpose of building a read-only view.

          File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_handler.h
          Line 20, Patchset 9:namespace sessions {


          struct SessionWindow;

          } // namespace sessions
          Atharv Maan . resolved

          supernit: remove the newlines inside namespace

          Brijesh Giri

          Done

          File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_observer.cc
          Line 19, Patchset 9:std::unique_ptr<sessions::SessionTab> DeepCopySessionTab(
          Atharv Maan . resolved

          IWYU

          Brijesh Giri

          Done

          File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals_util.h
          Line 42, Patchset 9: const std::vector<std::unique_ptr<sessions::SessionWindow>>& windows);
          Atharv Maan . resolved

          include <memory> and <vector>

          Brijesh Giri

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Atharv Maan
          • Darryl James
          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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
          Gerrit-Change-Number: 7063490
          Gerrit-PatchSet: 10
          Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
          Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
          Gerrit-Attention: Darryl James <dlj...@chromium.org>
          Gerrit-Attention: Atharv Maan <athar...@chromium.org>
          Gerrit-Comment-Date: Mon, 15 Dec 2025 04:18:43 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Atharv Maan <athar...@chromium.org>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Darryl James (Gerrit)

          unread,
          Dec 15, 2025, 2:46:31 PM (21 hours ago) Dec 15
          to Brijesh Giri, Atharv Maan, Chromium LUCI CQ, chromium...@chromium.org
          Attention needed from Atharv Maan and Brijesh Giri

          Darryl James voted and added 2 comments

          Votes added by Darryl James

          Code-Review+1

          2 comments

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

          lgtm!

          File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals.mojom
          Line 21, Patchset 10 (Latest): // Session data that is saved on disk
          // to be restored on next startup after a crash.
          Darryl James . unresolved

          super nit: Let's wrap at 80 characters here per style guide 👍

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Atharv Maan
          • Brijesh Giri
          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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
          Gerrit-Change-Number: 7063490
          Gerrit-PatchSet: 10
          Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
          Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
          Gerrit-Attention: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Attention: Atharv Maan <athar...@chromium.org>
          Gerrit-Comment-Date: Mon, 15 Dec 2025 19:46:13 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Brijesh Giri (Gerrit)

          unread,
          Dec 15, 2025, 7:35:06 PM (16 hours ago) Dec 15
          to Darryl James, Atharv Maan, Chromium LUCI CQ, chromium...@chromium.org
          Attention needed from Atharv Maan and Darryl James

          Brijesh Giri added 1 comment

          File chrome/browser/ui/webui/tab_strip_internals/tab_strip_internals.mojom
          Line 21, Patchset 10: // Session data that is saved on disk

          // to be restored on next startup after a crash.
          Darryl James . resolved

          super nit: Let's wrap at 80 characters here per style guide 👍

          Brijesh Giri

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Atharv Maan
          • Darryl James
          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: I7e914db14ab111885a31a9242d4be0e8c2efeec1
          Gerrit-Change-Number: 7063490
          Gerrit-PatchSet: 12
          Gerrit-Owner: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Reviewer: Atharv Maan <athar...@chromium.org>
          Gerrit-Reviewer: Brijesh Giri <brijes...@gmail.com>
          Gerrit-Reviewer: Darryl James <dlj...@chromium.org>
          Gerrit-Attention: Darryl James <dlj...@chromium.org>
          Gerrit-Attention: Atharv Maan <athar...@chromium.org>
          Gerrit-Comment-Date: Tue, 16 Dec 2025 00:35:00 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Darryl James <dlj...@chromium.org>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages