Teach make_dafsa.py to generate C++ within a namespace [chromium/src : main]

0 views
Skip to first unread message

Chris Fredrickson (Gerrit)

unread,
Dec 18, 2025, 2:30:51 PM (2 days ago) Dec 18
to Adam Rice, Stefano Duo, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, jdeblas...@chromium.org, bnc+...@chromium.org, fuzzin...@chromium.org, net-r...@chromium.org
Attention needed from Adam Rice

Chris Fredrickson voted and added 1 comment

Votes added by Chris Fredrickson

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Chris Fredrickson . resolved

CC Stefano since I know this rearranges some things in https://crrev.com/c/7134745. Since only one of these gperf files is generated, my hope is that splitting these actions apart actually makes it easier to deal with the generated gperf file differently if we have to.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
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: I74eec3ffc9cffd061483f8527c3e1bd6bc7c62c8
Gerrit-Change-Number: 7276584
Gerrit-PatchSet: 4
Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
Gerrit-CC: Stefano Duo <stefa...@google.com>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Comment-Date: Thu, 18 Dec 2025 19:30:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Chris Fredrickson (Gerrit)

unread,
Dec 18, 2025, 4:55:02 PM (2 days ago) Dec 18
to Mustafa Emre Acer, Adam Rice, Stefano Duo, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, jdeblas...@chromium.org, bnc+...@chromium.org, fuzzin...@chromium.org, net-r...@chromium.org
Attention needed from Adam Rice and Mustafa Emre Acer

Chris Fredrickson added 1 comment

Patchset-level comments
Chris Fredrickson . resolved

+meacer for components/lookalikes and components/url_formatter

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Mustafa Emre Acer
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: I74eec3ffc9cffd061483f8527c3e1bd6bc7c62c8
Gerrit-Change-Number: 7276584
Gerrit-PatchSet: 4
Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Reviewer: Mustafa Emre Acer <mea...@chromium.org>
Gerrit-CC: Stefano Duo <stefa...@google.com>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Mustafa Emre Acer <mea...@chromium.org>
Gerrit-Comment-Date: Thu, 18 Dec 2025 21:54:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Dec 19, 2025, 10:24:09 AM (2 days ago) Dec 19
to Chris Fredrickson, Mustafa Emre Acer, Stefano Duo, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, jdeblas...@chromium.org, bnc+...@chromium.org, fuzzin...@chromium.org, net-r...@chromium.org
Attention needed from Chris Fredrickson and Mustafa Emre Acer

Adam Rice voted and added 3 comments

Votes added by Adam Rice

Code-Review+1

3 comments

Patchset-level comments
Adam Rice . resolved

lgtm but you might want to get another reviewer for the BUILD files if you want them checker harder.

File net/base/lookup_string_in_fixed_set_fuzzer.cc
Line 17, Patchset 4 (Latest): net::LookupStringInFixedSet(net::registry_controlled_domains::kDafsa,
Adam Rice . resolved

Not required: If you happen to do another patch set,
`base::as_string_buffer(UNSAFE_BUFFERS(base::span(data, size)))` would be a nicer way to write this.

File net/base/registry_controlled_domains/BUILD.gn
Line 5, Patchset 4 (Latest):_gperf_files = [
Adam Rice . unresolved

I don't have a good understanding of GN files, so I'm assuming this is the best way to do this.

Open in Gerrit

Related details

Attention is currently required from:
  • Chris Fredrickson
  • Mustafa Emre Acer
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: I74eec3ffc9cffd061483f8527c3e1bd6bc7c62c8
    Gerrit-Change-Number: 7276584
    Gerrit-PatchSet: 4
    Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
    Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
    Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
    Gerrit-Reviewer: Mustafa Emre Acer <mea...@chromium.org>
    Gerrit-CC: Stefano Duo <stefa...@google.com>
    Gerrit-Attention: Mustafa Emre Acer <mea...@chromium.org>
    Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
    Gerrit-Comment-Date: Fri, 19 Dec 2025 15:23:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Adam Rice (Gerrit)

    unread,
    Dec 19, 2025, 10:29:04 AM (2 days ago) Dec 19
    to Chris Fredrickson, Mustafa Emre Acer, Stefano Duo, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, jdeblas...@chromium.org, bnc+...@chromium.org, fuzzin...@chromium.org, net-r...@chromium.org
    Attention needed from Chris Fredrickson and Mustafa Emre Acer

    Adam Rice voted and added 1 comment

    Votes added by Adam Rice

    Code-Review+0

    1 comment

    File net/base/registry_controlled_domains/BUILD.gn
    Line 66, Patchset 4 (Latest):foreach(_item, _gperf_files) {
    Adam Rice . unresolved

    Gemini pointed out that the two foreach loops could be combined into one. It might be worth considering.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Chris Fredrickson
    • Mustafa Emre Acer
    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: I74eec3ffc9cffd061483f8527c3e1bd6bc7c62c8
      Gerrit-Change-Number: 7276584
      Gerrit-PatchSet: 4
      Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
      Gerrit-Reviewer: Mustafa Emre Acer <mea...@chromium.org>
      Gerrit-CC: Stefano Duo <stefa...@google.com>
      Gerrit-Attention: Mustafa Emre Acer <mea...@chromium.org>
      Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
      Gerrit-Comment-Date: Fri, 19 Dec 2025 15:28:26 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Chris Fredrickson (Gerrit)

      unread,
      Dec 19, 2025, 11:16:59 AM (2 days ago) Dec 19
      to Adam Rice, Mustafa Emre Acer, Stefano Duo, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, jdeblas...@chromium.org, bnc+...@chromium.org, fuzzin...@chromium.org, net-r...@chromium.org
      Attention needed from Adam Rice and Mustafa Emre Acer

      Chris Fredrickson added 3 comments

      File net/base/lookup_string_in_fixed_set_fuzzer.cc
      Line 17, Patchset 4: net::LookupStringInFixedSet(net::registry_controlled_domains::kDafsa,
      Adam Rice . resolved

      Not required: If you happen to do another patch set,
      `base::as_string_buffer(UNSAFE_BUFFERS(base::span(data, size)))` would be a nicer way to write this.

      Chris Fredrickson

      I'm not familiar with `base::as_string_buffer` and codesearch is coming up empty, is that the right spelling?

      File net/base/registry_controlled_domains/BUILD.gn
      Line 5, Patchset 4:_gperf_files = [
      Adam Rice . resolved

      I don't have a good understanding of GN files, so I'm assuming this is the best way to do this.

      Chris Fredrickson

      Ack. I'm not an expert either, but I see similar code following this pattern in other gn files. And `action_foreach` only loops over a list of sources; it doesn't allow looping over a list of tuples.

      Line 66, Patchset 4:foreach(_item, _gperf_files) {
      Adam Rice . resolved

      Gemini pointed out that the two foreach loops could be combined into one. It might be worth considering.

      Chris Fredrickson

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Mustafa Emre Acer
      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: I74eec3ffc9cffd061483f8527c3e1bd6bc7c62c8
        Gerrit-Change-Number: 7276584
        Gerrit-PatchSet: 5
        Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
        Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
        Gerrit-Reviewer: Mustafa Emre Acer <mea...@chromium.org>
        Gerrit-CC: Stefano Duo <stefa...@google.com>
        Gerrit-Attention: Adam Rice <ri...@chromium.org>
        Gerrit-Attention: Mustafa Emre Acer <mea...@chromium.org>
        Gerrit-Comment-Date: Fri, 19 Dec 2025 16:16:53 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Mustafa Emre Acer (Gerrit)

        unread,
        Dec 19, 2025, 1:29:23 PM (2 days ago) Dec 19
        to Chris Fredrickson, Adam Rice, Stefano Duo, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, jdeblas...@chromium.org, bnc+...@chromium.org, fuzzin...@chromium.org, net-r...@chromium.org
        Attention needed from Adam Rice and Chris Fredrickson

        Mustafa Emre Acer voted and added 2 comments

        Votes added by Mustafa Emre Acer

        Code-Review+1

        2 comments

        Patchset-level comments
        File-level comment, Patchset 5 (Latest):
        Mustafa Emre Acer . resolved

        Lookalikes lgtm

        File components/url_formatter/spoof_checks/common_words/BUILD.gn
        Line 8, Patchset 5 (Parent): "data/common_words.gperf",
        Mustafa Emre Acer . resolved

        Q: Could this also be a tuple? It seems simpler, but I'm not a build expert:

        action_foreach("common_words_dafsa") {
        script = "//net/tools/dafsa/make_dafsa.py"
        sources = [
        ("data/common_words.gperf", "url_formatter::common_words"),
        ...
        ]
        outputs = [ "${target_gen_dir}/{{source_name_part}}-inc.cc" ]
        args = [
        "--namespace=${source[1]}",
        "{{source[0]}}",
        rebase_path("${target_gen_dir}/{{source_name_part}}-inc.cc",
        root_build_dir),
        ]
        }
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Adam Rice
        • Chris Fredrickson
        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: I74eec3ffc9cffd061483f8527c3e1bd6bc7c62c8
          Gerrit-Change-Number: 7276584
          Gerrit-PatchSet: 5
          Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
          Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
          Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
          Gerrit-Reviewer: Mustafa Emre Acer <mea...@chromium.org>
          Gerrit-CC: Stefano Duo <stefa...@google.com>
          Gerrit-Attention: Adam Rice <ri...@chromium.org>
          Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
          Gerrit-Comment-Date: Fri, 19 Dec 2025 18:29:10 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Chris Fredrickson (Gerrit)

          unread,
          Dec 19, 2025, 2:19:16 PM (2 days ago) Dec 19
          to Mustafa Emre Acer, Adam Rice, Stefano Duo, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, jdeblas...@chromium.org, bnc+...@chromium.org, fuzzin...@chromium.org, net-r...@chromium.org
          Attention needed from Adam Rice

          Chris Fredrickson added 1 comment

          File components/url_formatter/spoof_checks/common_words/BUILD.gn
          Line 8, Patchset 5 (Parent): "data/common_words.gperf",
          Mustafa Emre Acer . resolved

          Q: Could this also be a tuple? It seems simpler, but I'm not a build expert:

          action_foreach("common_words_dafsa") {
          script = "//net/tools/dafsa/make_dafsa.py"
          sources = [
          ("data/common_words.gperf", "url_formatter::common_words"),
          ...
          ]
          outputs = [ "${target_gen_dir}/{{source_name_part}}-inc.cc" ]
          args = [
          "--namespace=${source[1]}",
          "{{source[0]}}",
          rebase_path("${target_gen_dir}/{{source_name_part}}-inc.cc",
          root_build_dir),
          ]
          }
          Chris Fredrickson

          Unfortunately no, action_foreach only iterates over strings, not tuples of any kind. In order to make this CL work, we have to refactor to use `action` and `foreach` instead of `action_foreach`, since `foreach` can iterate over lists of tuples.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Adam Rice
          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: I74eec3ffc9cffd061483f8527c3e1bd6bc7c62c8
          Gerrit-Change-Number: 7276584
          Gerrit-PatchSet: 5
          Gerrit-Owner: Chris Fredrickson <cfre...@chromium.org>
          Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
          Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
          Gerrit-Reviewer: Mustafa Emre Acer <mea...@chromium.org>
          Gerrit-CC: Stefano Duo <stefa...@google.com>
          Gerrit-Attention: Adam Rice <ri...@chromium.org>
          Gerrit-Comment-Date: Fri, 19 Dec 2025 19:19:00 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Mustafa Emre Acer <mea...@chromium.org>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Chris Fredrickson (Gerrit)

          unread,
          Dec 19, 2025, 3:17:03 PM (2 days ago) Dec 19
          to Mustafa Emre Acer, Adam Rice, Stefano Duo, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, jdeblas...@chromium.org, bnc+...@chromium.org, fuzzin...@chromium.org, net-r...@chromium.org
          Attention needed from Adam Rice

          Chris Fredrickson voted Auto-Submit+1

          Auto-Submit+1
          Gerrit-Comment-Date: Fri, 19 Dec 2025 20:16:54 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages