[soft navs] Use a prefinalizer instead of UntracedMember for SoftNavigationContext [chromium/src : main]

0 views
Skip to first unread message

Scott Haseley (Gerrit)

unread,
Dec 12, 2025, 3:38:22 PM (4 days ago) Dec 12
to Michal Mocny, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, speed-metrics...@chromium.org
Attention needed from Michal Mocny

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Michal Mocny
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement 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: Id7932cf4f12f838c588aaf559053421bb494235a
Gerrit-Change-Number: 7256268
Gerrit-PatchSet: 3
Gerrit-Owner: Scott Haseley <shas...@chromium.org>
Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Comment-Date: Fri, 12 Dec 2025 20:38:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

AI Code Reviewer (Gerrit)

unread,
Dec 12, 2025, 3:40:53 PM (4 days ago) Dec 12
to Scott Haseley, Michal Mocny, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, speed-metrics...@chromium.org
Attention needed from Michal Mocny

AI Code Reviewer added 1 comment

File third_party/blink/renderer/core/timing/soft_navigation_context.cc
Line 242, Patchset 3 (Latest): // wasn't shut down by the associated `SoftNavigationHeuritics`, which happens
AI Code Reviewer . unresolved

nit: Fix typos in comments: 'SoftNavigationHeuritics' -> 'SoftNavigationHeuristics' and 'isn'st' -> 'isn't'.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Open in Gerrit

Related details

Attention is currently required from:
  • Michal Mocny
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: Id7932cf4f12f838c588aaf559053421bb494235a
    Gerrit-Change-Number: 7256268
    Gerrit-PatchSet: 3
    Gerrit-Owner: Scott Haseley <shas...@chromium.org>
    Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
    Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
    Gerrit-Comment-Date: Fri, 12 Dec 2025 20:40:49 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Scott Haseley (Gerrit)

    unread,
    Dec 12, 2025, 5:03:38 PM (4 days ago) Dec 12
    to AI Code Reviewer, Michal Mocny, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, speed-metrics...@chromium.org
    Attention needed from Michal Mocny

    Scott Haseley added 1 comment

    File third_party/blink/renderer/core/timing/soft_navigation_context.cc
    Line 242, Patchset 3: // wasn't shut down by the associated `SoftNavigationHeuritics`, which happens
    AI Code Reviewer . resolved

    nit: Fix typos in comments: 'SoftNavigationHeuritics' -> 'SoftNavigationHeuristics' and 'isn'st' -> 'isn't'.

    To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
    **Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


    _This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
    _AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
    _[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

    Scott Haseley

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michal Mocny
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement 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: Id7932cf4f12f838c588aaf559053421bb494235a
      Gerrit-Change-Number: 7256268
      Gerrit-PatchSet: 4
      Gerrit-Owner: Scott Haseley <shas...@chromium.org>
      Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
      Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
      Gerrit-Comment-Date: Fri, 12 Dec 2025 22:03:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Michal Mocny (Gerrit)

      unread,
      Dec 15, 2025, 9:58:40 AM (22 hours ago) Dec 15
      to Scott Haseley, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, speed-metrics...@chromium.org
      Attention needed from Scott Haseley

      Michal Mocny added 2 comments

      File third_party/blink/renderer/core/timing/soft_navigation_context.cc
      Line 247, Patchset 4 (Latest): }
      Michal Mocny . resolved

      Would we report less histograms (for the failed-to-emit cases) with these guards, and the timing of Dispose now vs prior?

      I think it's fine to break these but should consider what type of reporting will be useful in the future.

      Perhaps just:

      • #context-created (should eventually == #interactions?)
      • #icp-reported
      • #soft-nav-emitted

      Perhaps would suffice. We could count exhausted context by comparing counts.

      (We might want to report the status of active un-emitted context at document unload for the cases that are still active)

      File third_party/blink/renderer/core/timing/soft_navigation_heuristics.cc
      Line 553, Patchset 4 (Latest): potential_soft_navigations_.erase(iter);
      Michal Mocny . unresolved

      My understanding was that this automatically happens after dispose for HeapHashSet of pure weakness members?

      https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/renderer/platform/heap/BlinkGCAPIReference.md#weak-collections

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Scott Haseley
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement 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: Id7932cf4f12f838c588aaf559053421bb494235a
        Gerrit-Change-Number: 7256268
        Gerrit-PatchSet: 4
        Gerrit-Owner: Scott Haseley <shas...@chromium.org>
        Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
        Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
        Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
        Gerrit-Attention: Scott Haseley <shas...@chromium.org>
        Gerrit-Comment-Date: Mon, 15 Dec 2025 14:58:34 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Michal Mocny (Gerrit)

        unread,
        Dec 15, 2025, 9:59:24 AM (22 hours ago) Dec 15
        to Scott Haseley, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, speed-metrics...@chromium.org
        Attention needed from Scott Haseley

        Michal Mocny voted and added 1 comment

        Votes added by Michal Mocny

        Code-Review+1

        1 comment

        Patchset-level comments
        File-level comment, Patchset 4 (Latest):
        Michal Mocny . resolved

        ( I think we could follow with removing most of the histograms for the exhausted case )

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Scott Haseley
        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: Id7932cf4f12f838c588aaf559053421bb494235a
          Gerrit-Change-Number: 7256268
          Gerrit-PatchSet: 4
          Gerrit-Owner: Scott Haseley <shas...@chromium.org>
          Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
          Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
          Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
          Gerrit-Attention: Scott Haseley <shas...@chromium.org>
          Gerrit-Comment-Date: Mon, 15 Dec 2025 14:59:14 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Scott Haseley (Gerrit)

          unread,
          Dec 15, 2025, 2:53:50 PM (17 hours ago) Dec 15
          to Michal Mocny, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, speed-metrics...@chromium.org

          Scott Haseley added 2 comments

          File third_party/blink/renderer/core/timing/soft_navigation_context.cc
          Michal Mocny . resolved

          Would we report less histograms (for the failed-to-emit cases) with these guards, and the timing of Dispose now vs prior?

          I think it's fine to break these but should consider what type of reporting will be useful in the future.

          Perhaps just:

          • #context-created (should eventually == #interactions?)
          • #icp-reported
          • #soft-nav-emitted

          Perhaps would suffice. We could count exhausted context by comparing counts.

          (We might want to report the status of active un-emitted context at document unload for the cases that are still active)

          Scott Haseley
          It shouldn't change the counts:
          - `window_ == null` --> Shutdown() was called, and the heuristics class flushes metrics for all pending contexts at that point.
          - `heuristics == null` --> unit test. I don't think this can happen outside of tests if the context hasn't been shut down.
          File third_party/blink/renderer/core/timing/soft_navigation_heuristics.cc
          Line 553, Patchset 4: potential_soft_navigations_.erase(iter);
          Michal Mocny . resolved

          My understanding was that this automatically happens after dispose for HeapHashSet of pure weakness members?

          https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/renderer/platform/heap/BlinkGCAPIReference.md#weak-collections

          Scott Haseley

          Oh, duh, forgot I changed this to be a weak set. Thanks. Removed the erase call.

          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: Id7932cf4f12f838c588aaf559053421bb494235a
            Gerrit-Change-Number: 7256268
            Gerrit-PatchSet: 5
            Gerrit-Owner: Scott Haseley <shas...@chromium.org>
            Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
            Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
            Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
            Gerrit-Comment-Date: Mon, 15 Dec 2025 19:53:41 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Michal Mocny <mmo...@chromium.org>
            satisfied_requirement
            open
            diffy

            Scott Haseley (Gerrit)

            unread,
            Dec 15, 2025, 4:29:05 PM (15 hours ago) Dec 15
            to Michal Mocny, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, speed-metrics...@chromium.org

            Scott Haseley voted and added 1 comment

            Votes added by Scott Haseley

            Commit-Queue+2

            1 comment

            Patchset-level comments
            File-level comment, Patchset 6 (Latest):
            Scott Haseley . resolved

            Thanks!

            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: Id7932cf4f12f838c588aaf559053421bb494235a
            Gerrit-Change-Number: 7256268
            Gerrit-PatchSet: 6
            Gerrit-Owner: Scott Haseley <shas...@chromium.org>
            Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
            Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
            Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
            Gerrit-Comment-Date: Mon, 15 Dec 2025 21:28:53 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            open
            diffy

            Chromium LUCI CQ (Gerrit)

            unread,
            Dec 15, 2025, 5:45:09 PM (14 hours ago) Dec 15
            to Scott Haseley, Michal Mocny, AI Code Reviewer, chromium...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, speed-metrics...@chromium.org

            Chromium LUCI CQ submitted the change with unreviewed changes

            Unreviewed changes

            4 is the latest approved patch-set.
            The change was submitted with unreviewed changes in the following files:

            ```
            The name of the file: third_party/blink/renderer/core/timing/soft_navigation_heuristics.cc
            Insertions: 1, Deletions: 3.

            The diff is too large to show. Please review the diff.
            ```

            Change information

            Commit message:
            [soft navs] Use a prefinalizer instead of UntracedMember for SoftNavigationContext

            SoftNavigationHeuristics does custom tracing of the set of contexts
            using UntracedMember. This used to be how we detect the set becoming
            empty, but we don't track this any longer. We do still, however, record
            some metrics and end a trace event, so I think we still need detect
            when soft nav contexts are disposed.

            This CL changes how we do this to use a prefinalizer instead, which is
            generally preferred to UntracedMember. This is being done to make set
            iteration safer, since HashSet entry erasure invalidates iterators,
            which would be a problem if a set interaction causes a GC, e.g. due to
            an allocation. This is a prerequisite for crrev.com/c/7120640, where I
            don't trust that an iteration I need to add is safe.
            Bug: 454082771, 454082773
            Change-Id: Id7932cf4f12f838c588aaf559053421bb494235a
            Commit-Queue: Scott Haseley <shas...@chromium.org>
            Reviewed-by: Michal Mocny <mmo...@chromium.org>
            Cr-Commit-Position: refs/heads/main@{#1559010}
            Files:
            • M third_party/blink/renderer/core/timing/soft_navigation_context.cc
            • M third_party/blink/renderer/core/timing/soft_navigation_context.h
            • M third_party/blink/renderer/core/timing/soft_navigation_heuristics.cc
            • M third_party/blink/renderer/core/timing/soft_navigation_heuristics.h
            Change size: M
            Delta: 4 files changed, 31 insertions(+), 43 deletions(-)
            Branch: refs/heads/main
            Submit Requirements:
            • requirement satisfiedCode-Review: +1 by Michal Mocny
            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: Id7932cf4f12f838c588aaf559053421bb494235a
            Gerrit-Change-Number: 7256268
            Gerrit-PatchSet: 7
            Gerrit-Owner: Scott Haseley <shas...@chromium.org>
            Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
            Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
            Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
            Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
            open
            diffy
            satisfied_requirement
            Reply all
            Reply to author
            Forward
            0 new messages