[Persist] Simplify LoadTab method for NodeIdMapper [chromium/src : main]

0 views
Skip to first unread message

Fiaz Muhammad (Gerrit)

unread,
10:06 AM (5 hours ago) 10:06 AM
to Sky Malice, Calder Kitagawa, chromium...@chromium.org, jinsukk...@chromium.org
Attention needed from Calder Kitagawa and Sky Malice

Fiaz Muhammad voted

Auto-Submit+1
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Calder Kitagawa
  • Sky Malice
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: I4eb0a14141119a66763cd4fb4b813fff43e444a4
Gerrit-Change-Number: 7124659
Gerrit-PatchSet: 2
Gerrit-Owner: Fiaz Muhammad <mf...@google.com>
Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
Gerrit-Reviewer: Fiaz Muhammad <mf...@google.com>
Gerrit-Reviewer: Sky Malice <sk...@chromium.org>
Gerrit-Attention: Sky Malice <sk...@chromium.org>
Gerrit-Attention: Calder Kitagawa <ckit...@chromium.org>
Gerrit-Comment-Date: Wed, 05 Nov 2025 15:06:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Fiaz Muhammad (Gerrit)

unread,
10:24 AM (5 hours ago) 10:24 AM
to Chromium LUCI CQ, Sky Malice, Calder Kitagawa, chromium...@chromium.org, jinsukk...@chromium.org
Attention needed from Calder Kitagawa, Fiaz Muhammad and Sky Malice

Message from Fiaz Muhammad

Set Ready For Review

Open in Gerrit

Related details

Attention is currently required from:
  • Calder Kitagawa
  • Fiaz Muhammad
  • Sky Malice
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: I4eb0a14141119a66763cd4fb4b813fff43e444a4
Gerrit-Change-Number: 7124659
Gerrit-PatchSet: 2
Gerrit-Owner: Fiaz Muhammad <mf...@google.com>
Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
Gerrit-Reviewer: Fiaz Muhammad <mf...@google.com>
Gerrit-Reviewer: Sky Malice <sk...@chromium.org>
Gerrit-Attention: Sky Malice <sk...@chromium.org>
Gerrit-Attention: Calder Kitagawa <ckit...@chromium.org>
Gerrit-Attention: Fiaz Muhammad <mf...@google.com>
Gerrit-Comment-Date: Wed, 05 Nov 2025 15:24:27 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Fiaz Muhammad (Gerrit)

unread,
10:26 AM (5 hours ago) 10:26 AM
to Chromium LUCI CQ, Sky Malice, Calder Kitagawa, chromium...@chromium.org, jinsukk...@chromium.org
Attention needed from Calder Kitagawa and Sky Malice

Fiaz Muhammad added 1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Fiaz Muhammad . resolved

I had this in another branch since I thought the earlier CL would have been merged. I should have probably just combined the two CLs.

Open in Gerrit

Related details

Attention is currently required from:
  • Calder Kitagawa
  • Sky Malice
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: I4eb0a14141119a66763cd4fb4b813fff43e444a4
Gerrit-Change-Number: 7124659
Gerrit-PatchSet: 2
Gerrit-Owner: Fiaz Muhammad <mf...@google.com>
Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
Gerrit-Reviewer: Fiaz Muhammad <mf...@google.com>
Gerrit-Reviewer: Sky Malice <sk...@chromium.org>
Gerrit-Attention: Sky Malice <sk...@chromium.org>
Gerrit-Attention: Calder Kitagawa <ckit...@chromium.org>
Gerrit-Comment-Date: Wed, 05 Nov 2025 15:26:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Calder Kitagawa (Gerrit)

unread,
10:42 AM (5 hours ago) 10:42 AM
to Fiaz Muhammad, Chromium LUCI CQ, Sky Malice, chromium...@chromium.org, jinsukk...@chromium.org
Attention needed from Fiaz Muhammad and Sky Malice

Calder Kitagawa added 1 comment

File chrome/browser/android/storage_node_id_mapper_android.cc
Line 41, Patchset 2 (Latest):bool StorageNodeIdMapperAndroid::LoadTab(const TabInterface* tab) {
const TabAndroid* tab_android = static_cast<const TabAndroid*>(tab);

if (tab_id_to_callback_.contains(tab_android->GetAndroidId())) {
return false;
}

auto map_entry = tab_id_to_callback_.extract(tab_android->GetAndroidId());
DCHECK(!map_entry.empty());
std::move(map_entry.mapped()).Run(tab);

return true;
}
Calder Kitagawa . unresolved

Whoa are we using TabAndroid or [TabInterfaceAndroid](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/android/tab_interface_android.h;drc=f49e23d8e2bd190b42ec62284b8be10dcccd0446;l=19) here?

I'm a bit confused.

TabStripCollection hosts tabs as `TabInterfaceAndroid` instances (weak ptr to TabAndroid) to avoid the problem of memory management. I thought all our APIs were going to use TabAndroid directly or TabInterfaceAndroid when coming from a collection. This static cast has me concerned because it is now unclear which type we are using in interfaces that tab TabInterface* as an input.

Open in Gerrit

Related details

Attention is currently required from:
  • Fiaz Muhammad
  • Sky Malice
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: I4eb0a14141119a66763cd4fb4b813fff43e444a4
    Gerrit-Change-Number: 7124659
    Gerrit-PatchSet: 2
    Gerrit-Owner: Fiaz Muhammad <mf...@google.com>
    Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
    Gerrit-Reviewer: Fiaz Muhammad <mf...@google.com>
    Gerrit-Reviewer: Sky Malice <sk...@chromium.org>
    Gerrit-Attention: Fiaz Muhammad <mf...@google.com>
    Gerrit-Attention: Sky Malice <sk...@chromium.org>
    Gerrit-Comment-Date: Wed, 05 Nov 2025 15:42:37 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fiaz Muhammad (Gerrit)

    unread,
    11:04 AM (4 hours ago) 11:04 AM
    to Chromium LUCI CQ, Sky Malice, Calder Kitagawa, chromium...@chromium.org, jinsukk...@chromium.org
    Attention needed from Calder Kitagawa and Sky Malice

    Fiaz Muhammad added 1 comment

    File chrome/browser/android/storage_node_id_mapper_android.cc
    Line 41, Patchset 2 (Latest):bool StorageNodeIdMapperAndroid::LoadTab(const TabInterface* tab) {
    const TabAndroid* tab_android = static_cast<const TabAndroid*>(tab);

    if (tab_id_to_callback_.contains(tab_android->GetAndroidId())) {
    return false;
    }

    auto map_entry = tab_id_to_callback_.extract(tab_android->GetAndroidId());
    DCHECK(!map_entry.empty());
    std::move(map_entry.mapped()).Run(tab);

    return true;
    }
    Calder Kitagawa . unresolved

    Whoa are we using TabAndroid or [TabInterfaceAndroid](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/android/tab_interface_android.h;drc=f49e23d8e2bd190b42ec62284b8be10dcccd0446;l=19) here?

    I'm a bit confused.

    TabStripCollection hosts tabs as `TabInterfaceAndroid` instances (weak ptr to TabAndroid) to avoid the problem of memory management. I thought all our APIs were going to use TabAndroid directly or TabInterfaceAndroid when coming from a collection. This static cast has me concerned because it is now unclear which type we are using in interfaces that tab TabInterface* as an input.

    Fiaz Muhammad

    Thanks for the clarification, that is really helpful. I know you mentioned it earlier offline, but this makes it a lot clearer.

    I think in cases that will only be used by TabCollection-sourced tabs, such as this, we have passed the original TabInterface object to the service. I'm assuming this is a TabInterfaceAndroid\*. Maybe we should cast it to a TabAndroid\* before passing it?

    Our service gets called with TabAndroid\*, such as when we call the Java class. We attempted to keep this consistent across the board. Maybe I could pass a standardizer to the service (from the factory). On android, this would perform casts to TabAndroid\*, and this would guarantee that we are consistent when it comes to handles. Thoughts?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Calder Kitagawa
    • Sky Malice
    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: I4eb0a14141119a66763cd4fb4b813fff43e444a4
    Gerrit-Change-Number: 7124659
    Gerrit-PatchSet: 2
    Gerrit-Owner: Fiaz Muhammad <mf...@google.com>
    Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
    Gerrit-Reviewer: Fiaz Muhammad <mf...@google.com>
    Gerrit-Reviewer: Sky Malice <sk...@chromium.org>
    Gerrit-Attention: Calder Kitagawa <ckit...@chromium.org>
    Gerrit-Attention: Sky Malice <sk...@chromium.org>
    Gerrit-Comment-Date: Wed, 05 Nov 2025 16:04:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Calder Kitagawa <ckit...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fiaz Muhammad (Gerrit)

    unread,
    11:44 AM (4 hours ago) 11:44 AM
    to Chromium LUCI CQ, Sky Malice, Calder Kitagawa, chromium...@chromium.org, jinsukk...@chromium.org
    Attention needed from Calder Kitagawa and Sky Malice

    Fiaz Muhammad added 1 comment

    File chrome/browser/android/storage_node_id_mapper_android.cc
    Line 41, Patchset 2 (Latest):bool StorageNodeIdMapperAndroid::LoadTab(const TabInterface* tab) {
    const TabAndroid* tab_android = static_cast<const TabAndroid*>(tab);

    if (tab_id_to_callback_.contains(tab_android->GetAndroidId())) {
    return false;
    }

    auto map_entry = tab_id_to_callback_.extract(tab_android->GetAndroidId());
    DCHECK(!map_entry.empty());
    std::move(map_entry.mapped()).Run(tab);

    return true;
    }
    Calder Kitagawa . unresolved

    Whoa are we using TabAndroid or [TabInterfaceAndroid](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/android/tab_interface_android.h;drc=f49e23d8e2bd190b42ec62284b8be10dcccd0446;l=19) here?

    I'm a bit confused.

    TabStripCollection hosts tabs as `TabInterfaceAndroid` instances (weak ptr to TabAndroid) to avoid the problem of memory management. I thought all our APIs were going to use TabAndroid directly or TabInterfaceAndroid when coming from a collection. This static cast has me concerned because it is now unclear which type we are using in interfaces that tab TabInterface* as an input.

    Fiaz Muhammad

    Thanks for the clarification, that is really helpful. I know you mentioned it earlier offline, but this makes it a lot clearer.

    I think in cases that will only be used by TabCollection-sourced tabs, such as this, we have passed the original TabInterface object to the service. I'm assuming this is a TabInterfaceAndroid\*. Maybe we should cast it to a TabAndroid\* before passing it?

    Our service gets called with TabAndroid\*, such as when we call the Java class. We attempted to keep this consistent across the board. Maybe I could pass a standardizer to the service (from the factory). On android, this would perform casts to TabAndroid\*, and this would guarantee that we are consistent when it comes to handles. Thoughts?

    Fiaz Muhammad

    Here's a proof-of-concept. Let me know if it isn't correct: https://crrev.com/c/7125058

    I use a pretty heavy assumption that TabInterface\* can be cast to TabAndroid\* in Android.

    Gerrit-Comment-Date: Wed, 05 Nov 2025 16:44:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Fiaz Muhammad <mf...@google.com>
    Comment-In-Reply-To: Calder Kitagawa <ckit...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages