Remove kDafsaNotFound in favor of using std::optional [chromium/src : main]

0 views
Skip to first unread message

Chris Fredrickson (Gerrit)

unread,
Feb 20, 2026, 1:16:09 PM (yesterday) Feb 20
to Chris Thompson, Lei Zhang, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org
Attention needed from Chris Thompson, Lei Zhang and mmenke

Chris Fredrickson voted and added 1 comment

Votes added by Chris Fredrickson

Auto-Submit+1

1 comment

Patchset-level comments
File-level comment, Patchset 3:
Chris Fredrickson . resolved

+mmenke for //net/;
+cthomp for //components/url_formatter/;
+theestig for //chrome/browser/media/.

Open in Gerrit

Related details

Attention is currently required from:
  • Chris Thompson
  • Lei Zhang
  • mmenke
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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
Gerrit-Change-Number: 7595406
Gerrit-PatchSet: 4
Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Reviewer: mmenke <mme...@chromium.org>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: mmenke <mme...@chromium.org>
Gerrit-Attention: Lei Zhang <the...@chromium.org>
Gerrit-Attention: Chris Thompson <cth...@chromium.org>
Gerrit-Comment-Date: Fri, 20 Feb 2026 18:16:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Lei Zhang (Gerrit)

unread,
Feb 20, 2026, 1:25:22 PM (yesterday) Feb 20
to Chris Fredrickson, Lei Zhang, Chris Thompson, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org
Attention needed from Chris Fredrickson, Chris Thompson and mmenke

Lei Zhang voted and added 7 comments

Votes added by Lei Zhang

Code-Review+1

7 comments

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Lei Zhang . resolved

Just my take, but I defer to //net owners.

File chrome/browser/media/media_engagement_preloaded_list.cc
Line 125, Patchset 4 (Latest): std::optional<int> result = net::LookupStringInFixedSet(dafsa_, input);
Lei Zhang . unresolved

Can this be `return net::LookupStringInFixedSet(dafsa_, input).value_or(DafsaResult::kNotFound);`?

File net/base/lookup_string_in_fixed_set.h
Line 36, Patchset 4 (Latest):// value is std::nullopt, kDafsaFound, or a bitmap consisting of one or more
Lei Zhang . unresolved

Would you mind wrapping these in backticks while this is changing anyway?

Line 21, Patchset 4 (Latest):enum {
Lei Zhang . unresolved

Can the enum have a name, or LookupStringInFixedSet() can return that? I don't know the historical context, so if it is this way for a reason, then it's fine to leave it be.

File net/base/lookup_string_in_fixed_set.cc
Line 165, Patchset 4 (Latest): } else {
Lei Zhang . unresolved

No need for `else` after the return now.

Line 223, Patchset 4 (Latest): if (value) {
Lei Zhang . unresolved

Consistently use has_value().

File net/base/registry_controlled_domains/registry_controlled_domain.cc
Line 243, Patchset 4 (Latest): CHECK(type.has_value());
Lei Zhang . unresolved

Not sure if this makes sense, as line 227 already called value(). If that didn't crash, then this always evaluates to true.

Open in Gerrit

Related details

Attention is currently required from:
  • Chris Fredrickson
  • Chris Thompson
  • mmenke
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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
    Gerrit-Change-Number: 7595406
    Gerrit-PatchSet: 4
    Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
    Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
    Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
    Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
    Gerrit-Reviewer: mmenke <mme...@chromium.org>
    Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
    Gerrit-Attention: mmenke <mme...@chromium.org>
    Gerrit-Attention: Chris Thompson <cth...@chromium.org>
    Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
    Gerrit-Comment-Date: Fri, 20 Feb 2026 18:25:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Chris Fredrickson (Gerrit)

    unread,
    Feb 20, 2026, 1:37:46 PM (yesterday) Feb 20
    to Lei Zhang, Chris Thompson, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org
    Attention needed from Chris Thompson and mmenke

    Chris Fredrickson voted and added 6 comments

    Votes added by Chris Fredrickson

    Auto-Submit+1

    6 comments

    File chrome/browser/media/media_engagement_preloaded_list.cc
    Line 125, Patchset 4: std::optional<int> result = net::LookupStringInFixedSet(dafsa_, input);
    Lei Zhang . resolved

    Can this be `return net::LookupStringInFixedSet(dafsa_, input).value_or(DafsaResult::kNotFound);`?

    Chris Fredrickson

    Ah nice, I forgot about `value_or`. Done.

    File net/base/lookup_string_in_fixed_set.h
    Line 36, Patchset 4:// value is std::nullopt, kDafsaFound, or a bitmap consisting of one or more
    Lei Zhang . resolved

    Would you mind wrapping these in backticks while this is changing anyway?

    Chris Fredrickson

    Done

    Line 21, Patchset 4:enum {
    Lei Zhang . resolved

    Can the enum have a name, or LookupStringInFixedSet() can return that? I don't know the historical context, so if it is this way for a reason, then it's fine to leave it be.

    Chris Fredrickson

    I plan to give it a name (and convert to `enum class`) and make LookupStringInFixedSet return a `base::EnumSet<...>`, yeah. But that will have some downstream logic changes (e.g. that will expose a bug in chrome/browser/media/media_engagement_preloaded_list.cc, where that code doesn't handle the bitset properly and currently assumes it is just a single tag value), so I'm going to make that change in a followup CL.

    File net/base/lookup_string_in_fixed_set.cc
    Line 165, Patchset 4: } else {
    Lei Zhang . resolved

    No need for `else` after the return now.

    Chris Fredrickson

    Done

    Line 223, Patchset 4: if (value) {
    Lei Zhang . resolved

    Consistently use has_value().

    Chris Fredrickson

    Done

    File net/base/registry_controlled_domains/registry_controlled_domain.cc
    Line 243, Patchset 4: CHECK(type.has_value());
    Lei Zhang . resolved

    Not sure if this makes sense, as line 227 already called value(). If that didn't crash, then this always evaluates to true.

    Chris Fredrickson

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Chris Thompson
    • mmenke
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not 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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
      Gerrit-Change-Number: 7595406
      Gerrit-PatchSet: 5
      Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
      Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
      Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
      Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
      Gerrit-Reviewer: mmenke <mme...@chromium.org>
      Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
      Gerrit-Attention: mmenke <mme...@chromium.org>
      Gerrit-Attention: Chris Thompson <cth...@chromium.org>
      Gerrit-Comment-Date: Fri, 20 Feb 2026 18:37:41 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Lei Zhang <the...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      mmenke (Gerrit)

      unread,
      Feb 20, 2026, 2:05:08 PM (yesterday) Feb 20
      to Chris Fredrickson, Lei Zhang, Chris Thompson, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org
      Attention needed from Chris Fredrickson and Chris Thompson

      mmenke added 4 comments

      File chrome/browser/media/media_engagement_preloaded_list.cc
      Line 123, Patchset 5 (Latest):MediaEngagementPreloadedList::CheckStringIsPresent(
      mmenke . unresolved

      BUG: DafsaResult::kNotFound is now wrong.

      File net/base/lookup_string_in_fixed_set.h
      Line 140, Patchset 5 (Latest): // bitmask of `kDafsaExceptionRule`, `kDafsaWildcardRule`, and
      // `kDafsaPrivateRule`.
      mmenke . unresolved

      Again, this documentation seems confusing to me.

      Line 35, Patchset 5 (Latest):// byte array which should be supplied via the |graph| parameter. The return
      // value is `std::nullopt`, `kDafsaFound`, or a bitmap consisting of one or more
      // of `kDafsaExceptionRule`, `kDafsaWildcardRule` and `kDafsaPrivateRule` ORed
      // together.
      mmenke . unresolved

      This is confusing, since the comment above implies those values are only for use by GetDomainAndRegistry(), but this is specced to return them. Also, MediaEngagementPreloadedList::CheckStringIsPresent() is clearly not using these to get bitmaps of the listed values.

      I think we should clean up all the documentation here, removing mention of these values, when we also move out that enum above.

      Line 23, Patchset 5 (Latest): // The following return values are used by the implementation of
      // GetDomainAndRegistry() and are probably not generally useful.
      mmenke . unresolved

      Can we move this into a GetDomainAndRegistry()-specific file? Fine to do in a followup. Even kDafsaFound seems not generally useful (And it's only used in a single test, with one use of it looking scary to me - https://source.chromium.org/chromium/chromium/src/+/main:net/tools/tld_cleanup/tld_cleanup_util_unittest.cc;l=184?q=kDafsaFound%20&ss=chromium%2Fchromium%2Fsrc)

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Chris Fredrickson
      • Chris Thompson
      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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
        Gerrit-Change-Number: 7595406
        Gerrit-PatchSet: 5
        Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
        Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
        Gerrit-Reviewer: mmenke <mme...@chromium.org>
        Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
        Gerrit-Attention: Chris Thompson <cth...@chromium.org>
        Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Comment-Date: Fri, 20 Feb 2026 19:05:02 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Chris Fredrickson (Gerrit)

        unread,
        Feb 20, 2026, 2:25:50 PM (yesterday) Feb 20
        to Lei Zhang, Chris Thompson, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org
        Attention needed from Chris Thompson and mmenke

        Chris Fredrickson added 4 comments

        File chrome/browser/media/media_engagement_preloaded_list.cc
        Line 123, Patchset 5 (Latest):MediaEngagementPreloadedList::CheckStringIsPresent(
        mmenke . unresolved

        BUG: DafsaResult::kNotFound is now wrong.

        Chris Fredrickson

        Can you elaborate? IIUC `DafsaResult::kNotFound` is still correct (it's only used when `LookupStringInFixedSet` returns `std::nullopt`), but the other two values are definitely wrong. However, that is an existing issue for the past 8 years or so, and I'll try to address it in a followup CL.

        File net/base/lookup_string_in_fixed_set.h
        Line 140, Patchset 5 (Latest): // bitmask of `kDafsaExceptionRule`, `kDafsaWildcardRule`, and
        // `kDafsaPrivateRule`.
        mmenke . resolved

        Again, this documentation seems confusing to me.

        Chris Fredrickson

        Acknowledged

        Line 35, Patchset 5 (Latest):// byte array which should be supplied via the |graph| parameter. The return
        // value is `std::nullopt`, `kDafsaFound`, or a bitmap consisting of one or more
        // of `kDafsaExceptionRule`, `kDafsaWildcardRule` and `kDafsaPrivateRule` ORed
        // together.
        mmenke . resolved

        This is confusing, since the comment above implies those values are only for use by GetDomainAndRegistry(), but this is specced to return them. Also, MediaEngagementPreloadedList::CheckStringIsPresent() is clearly not using these to get bitmaps of the listed values.

        I think we should clean up all the documentation here, removing mention of these values, when we also move out that enum above.

        Chris Fredrickson

        Agreed, I'll try to do that in followups, but I'd like to keep this CL focused on just one step, i.e. removing `kDafsaNotFound`.

        Line 23, Patchset 5 (Latest): // The following return values are used by the implementation of
        // GetDomainAndRegistry() and are probably not generally useful.
        mmenke . resolved

        Can we move this into a GetDomainAndRegistry()-specific file? Fine to do in a followup. Even kDafsaFound seems not generally useful (And it's only used in a single test, with one use of it looking scary to me - https://source.chromium.org/chromium/chromium/src/+/main:net/tools/tld_cleanup/tld_cleanup_util_unittest.cc;l=184?q=kDafsaFound%20&ss=chromium%2Fchromium%2Fsrc)

        Chris Fredrickson

        I actually think that the comment is wrong - these values are useful outside of GetDomainAndRegistry (e.g. media_engagement_preloaded_list.cc relies on them), but I will move them to a separate file in a followup. I also agree that `kDafsaFound` isn't very useful; I'm planning on removing that in a followup as well in favor of using a `base::EnumSet<...>`, but that will force me to figure out how to fix media_engagement_preloaded_list.cc so I wanted to keep that part separate for ease of review. (Also agree about that test usage - I wrote that but now it looks wrong to me.)

        All in all I agree with you, but I'd like to handle these issues in separate followups for the sake of keeping CLs small and easy to review.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Chris Thompson
        • mmenke
        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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
        Gerrit-Change-Number: 7595406
        Gerrit-PatchSet: 5
        Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
        Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
        Gerrit-Reviewer: mmenke <mme...@chromium.org>
        Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
        Gerrit-Attention: mmenke <mme...@chromium.org>
        Gerrit-Attention: Chris Thompson <cth...@chromium.org>
        Gerrit-Comment-Date: Fri, 20 Feb 2026 19:25:45 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: mmenke <mme...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Chris Thompson (Gerrit)

        unread,
        Feb 20, 2026, 2:27:51 PM (yesterday) Feb 20
        to Chris Fredrickson, Lei Zhang, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org
        Attention needed from Chris Fredrickson and mmenke

        Chris Thompson voted and added 1 comment

        Votes added by Chris Thompson

        Code-Review+1

        1 comment

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

        components/url_formatter/ change LGTM

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Chris Fredrickson
        • mmenke
        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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
        Gerrit-Change-Number: 7595406
        Gerrit-PatchSet: 5
        Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
        Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
        Gerrit-Reviewer: mmenke <mme...@chromium.org>
        Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
        Gerrit-Attention: mmenke <mme...@chromium.org>
        Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Comment-Date: Fri, 20 Feb 2026 19:27:44 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        mmenke (Gerrit)

        unread,
        Feb 20, 2026, 2:33:23 PM (yesterday) Feb 20
        to Chris Fredrickson, Chris Thompson, Lei Zhang, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org
        Attention needed from Chris Fredrickson

        mmenke added 2 comments

        File chrome/browser/media/media_engagement_preloaded_list.cc
        Line 123, Patchset 5 (Latest):MediaEngagementPreloadedList::CheckStringIsPresent(
        mmenke . resolved

        BUG: DafsaResult::kNotFound is now wrong.

        Chris Fredrickson

        Can you elaborate? IIUC `DafsaResult::kNotFound` is still correct (it's only used when `LookupStringInFixedSet` returns `std::nullopt`), but the other two values are definitely wrong. However, that is an existing issue for the past 8 years or so, and I'll try to address it in a followup CL.

        mmenke

        Sorry, I missed that this didn't return an optional for anoptional.

        File net/base/lookup_string_in_fixed_set.h
        Line 23, Patchset 5 (Latest): // The following return values are used by the implementation of
        // GetDomainAndRegistry() and are probably not generally useful.
        mmenke . unresolved

        Can we move this into a GetDomainAndRegistry()-specific file? Fine to do in a followup. Even kDafsaFound seems not generally useful (And it's only used in a single test, with one use of it looking scary to me - https://source.chromium.org/chromium/chromium/src/+/main:net/tools/tld_cleanup/tld_cleanup_util_unittest.cc;l=184?q=kDafsaFound%20&ss=chromium%2Fchromium%2Fsrc)

        Chris Fredrickson

        I actually think that the comment is wrong - these values are useful outside of GetDomainAndRegistry (e.g. media_engagement_preloaded_list.cc relies on them), but I will move them to a separate file in a followup. I also agree that `kDafsaFound` isn't very useful; I'm planning on removing that in a followup as well in favor of using a `base::EnumSet<...>`, but that will force me to figure out how to fix media_engagement_preloaded_list.cc so I wanted to keep that part separate for ease of review. (Also agree about that test usage - I wrote that but now it looks wrong to me.)

        All in all I agree with you, but I'd like to handle these issues in separate followups for the sake of keeping CLs small and easy to review.

        mmenke

        media_engagement_preloaded_list.cc doesn't seem to rely on them at all? It relies on getting a 0 or 1 out of this API, but it doesn't use this enum at all, and uses entirely different meanings for 0 and 1. 0 means "kFoundHttpsOnly" and 1 means "kFoundHttpOrHttps", which in no way map to "kDafsaFound" and "kDafsaExceptionRule".

        The code to use them certainly seems to think they mean other things: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/media/media_engagement_preloaded_list.cc;l=99;drc=d209eefee6037bd0905e43f88570fda8edab89a1?q=kFoundHttpOrHttps&ss=chromium%2Fchromium%2Fsrc

        They seem to be using this as a way to store a bit (+not found) per match, rather than having a notion of "exception rules" that matches whatever these are intended for.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Chris Fredrickson
        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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
        Gerrit-Change-Number: 7595406
        Gerrit-PatchSet: 5
        Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
        Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
        Gerrit-Reviewer: mmenke <mme...@chromium.org>
        Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
        Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Comment-Date: Fri, 20 Feb 2026 19:33:18 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: mmenke <mme...@chromium.org>
        Comment-In-Reply-To: Chris Fredrickson <cfre...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        mmenke (Gerrit)

        unread,
        Feb 20, 2026, 2:59:56 PM (yesterday) Feb 20
        to Chris Fredrickson, Chris Thompson, Lei Zhang, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org
        Attention needed from Chris Fredrickson

        mmenke voted and added 1 comment

        Votes added by mmenke

        Code-Review+1

        1 comment

        Patchset-level comments
        mmenke . resolved

        Oh, and this LGTM

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Chris Fredrickson
        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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
        Gerrit-Change-Number: 7595406
        Gerrit-PatchSet: 5
        Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
        Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
        Gerrit-Reviewer: mmenke <mme...@chromium.org>
        Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
        Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Comment-Date: Fri, 20 Feb 2026 19:59:50 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Chris Fredrickson (Gerrit)

        unread,
        Feb 20, 2026, 3:35:00 PM (24 hours ago) Feb 20
        to Chris Thompson, Lei Zhang, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org

        Chris Fredrickson voted and added 1 comment

        Votes added by Chris Fredrickson

        Commit-Queue+2

        1 comment

        File net/base/lookup_string_in_fixed_set.h
        Line 23, Patchset 5 (Latest): // The following return values are used by the implementation of
        // GetDomainAndRegistry() and are probably not generally useful.
        mmenke . resolved

        Can we move this into a GetDomainAndRegistry()-specific file? Fine to do in a followup. Even kDafsaFound seems not generally useful (And it's only used in a single test, with one use of it looking scary to me - https://source.chromium.org/chromium/chromium/src/+/main:net/tools/tld_cleanup/tld_cleanup_util_unittest.cc;l=184?q=kDafsaFound%20&ss=chromium%2Fchromium%2Fsrc)

        Chris Fredrickson

        I actually think that the comment is wrong - these values are useful outside of GetDomainAndRegistry (e.g. media_engagement_preloaded_list.cc relies on them), but I will move them to a separate file in a followup. I also agree that `kDafsaFound` isn't very useful; I'm planning on removing that in a followup as well in favor of using a `base::EnumSet<...>`, but that will force me to figure out how to fix media_engagement_preloaded_list.cc so I wanted to keep that part separate for ease of review. (Also agree about that test usage - I wrote that but now it looks wrong to me.)

        All in all I agree with you, but I'd like to handle these issues in separate followups for the sake of keeping CLs small and easy to review.

        mmenke

        media_engagement_preloaded_list.cc doesn't seem to rely on them at all? It relies on getting a 0 or 1 out of this API, but it doesn't use this enum at all, and uses entirely different meanings for 0 and 1. 0 means "kFoundHttpsOnly" and 1 means "kFoundHttpOrHttps", which in no way map to "kDafsaFound" and "kDafsaExceptionRule".

        The code to use them certainly seems to think they mean other things: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/media/media_engagement_preloaded_list.cc;l=99;drc=d209eefee6037bd0905e43f88570fda8edab89a1?q=kFoundHttpOrHttps&ss=chromium%2Fchromium%2Fsrc

        They seem to be using this as a way to store a bit (+not found) per match, rather than having a notion of "exception rules" that matches whatever these are intended for.

        Chris Fredrickson

        Ack - right - what I meant by "relies on" is that that code makes assumptions about the values that come out of `LookupStringInFixedSet`, i.e. that it will produce values that map cleanly to `DafsaResult` values (and won't produce any _other_ values, either).

        But I see your point that that code is ascribing entirely different semantics to these values, so it doesn't really rely on the GetDomainAndRegistry-related semantics. Maybe a future followup can templatize the `LookupStringInFixedSet` machinery so that different clients can supply the sets of valid tags that they want to use.

        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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
          Gerrit-Change-Number: 7595406
          Gerrit-PatchSet: 5
          Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
          Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
          Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
          Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
          Gerrit-Reviewer: mmenke <mme...@chromium.org>
          Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
          Gerrit-Comment-Date: Fri, 20 Feb 2026 20:34:55 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Chromium LUCI CQ (Gerrit)

          unread,
          Feb 20, 2026, 4:08:08 PM (23 hours ago) Feb 20
          to Chris Fredrickson, Chris Thompson, Lei Zhang, chromium...@chromium.org, Rijubrata Bhaumik, bnc+...@chromium.org, chfreme...@chromium.org, feature-me...@chromium.org, jdeblas...@chromium.org, net-r...@chromium.org

          Chromium LUCI CQ submitted the change

          Change information

          Commit message:
          Remove kDafsaNotFound in favor of using std::optional

          This gives us a more modern and less error-prone API, and lets us remove
          an unnecessary constant.
          Change-Id: Iba8ba5ec105630957a5bac2680795c4b9eac5358
          Reviewed-by: Chris Thompson <cth...@chromium.org>
          Reviewed-by: mmenke <mme...@chromium.org>
          Auto-Submit: Chris Fredrickson <cfre...@chromium.org>
          Commit-Queue: Chris Fredrickson <cfre...@chromium.org>
          Reviewed-by: Lei Zhang <the...@chromium.org>
          Cr-Commit-Position: refs/heads/main@{#1588016}
          Files:
          • M chrome/browser/media/media_engagement_preloaded_list.cc
          • M components/url_formatter/spoof_checks/common_words/common_words_util.cc
          • M net/base/lookup_string_in_fixed_set.cc
          • M net/base/lookup_string_in_fixed_set.h
          • M net/base/lookup_string_in_fixed_set_unittest.cc
          • M net/base/registry_controlled_domains/registry_controlled_domain.cc
          Change size: M
          Delta: 6 files changed, 110 insertions(+), 79 deletions(-)
          Branch: refs/heads/main
          Submit Requirements:
          • requirement satisfiedCode-Review: +1 by mmenke, +1 by Lei Zhang, +1 by Chris Thompson
          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: Iba8ba5ec105630957a5bac2680795c4b9eac5358
          Gerrit-Change-Number: 7595406
          Gerrit-PatchSet: 6
          Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
          Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
          Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
          Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
          Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
          Gerrit-Reviewer: mmenke <mme...@chromium.org>
          open
          diffy
          satisfied_requirement
          Reply all
          Reply to author
          Forward
          0 new messages