bindings/heap: Move GC prologue callbacks to ThreadState [chromium/src : main]

0 views
Skip to first unread message

Michael Lippautz (Gerrit)

unread,
Jun 24, 2025, 1:19:18 PMJun 24
to Kentaro Hara, chromium...@chromium.org, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, oilpan-rev...@chromium.org, zol...@webkit.org
Attention needed from Kentaro Hara

Michael Lippautz voted and added 3 comments

Votes added by Michael Lippautz

Commit-Queue+1

3 comments

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Michael Lippautz . resolved

Hey Kentaro, I get asked repeatedly how GC is wired up in Blink. One feedback I got there is that it's confusing that things are often split apart for historical reasons and I have to agree. This CL here moves the GC callbacks into ThreadState to consolidate that setup. It also makes it easier to follow ASWManager. There's only one callback that requires `core/` (DevTools) which we can probably fix with a proper observer when it's needed.

File third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc
Line 73, Patchset 3 (Latest):v8::EmbedderGraph::Node::Detachedness V8GCController::DetachednessFromWrapper(
Michael Lippautz . unresolved

I couldn't think of a good place for this one. It's not "GC controller" but just used for heap snapshots at this point. Maybe just putting it in `v8_initializer.cc` would be good enough.

(It needs to stay in `core/` because of `Node`).

File third_party/blink/renderer/platform/heap/thread_state.h
Line 161, Patchset 3 (Latest): DevToolsCountersCallback dev_tools_counters_callback_;
Michael Lippautz . unresolved

This callback (devtools tracing scope) requires `core/`. I was asked already if we can make a GC observer at some point which we should probably do when there's more uses.

Open in Gerrit

Related details

Attention is currently required from:
  • Kentaro Hara
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Iec87004f31a4d7ae8e1a73a544285c21d1167aad
Gerrit-Change-Number: 6667824
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
Gerrit-Attention: Kentaro Hara <har...@chromium.org>
Gerrit-Comment-Date: Tue, 24 Jun 2025 17:19:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Kentaro Hara (Gerrit)

unread,
Jun 24, 2025, 7:42:55 PMJun 24
to Michael Lippautz, Chromium LUCI CQ, chromium...@chromium.org, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, oilpan-rev...@chromium.org, zol...@webkit.org
Attention needed from Michael Lippautz

Kentaro Hara voted and added 3 comments

Votes added by Kentaro Hara

Code-Review+1

3 comments

Patchset-level comments
Kentaro Hara . resolved

LGTM

File third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc
Line 73, Patchset 3 (Latest):v8::EmbedderGraph::Node::Detachedness V8GCController::DetachednessFromWrapper(
Michael Lippautz . resolved

I couldn't think of a good place for this one. It's not "GC controller" but just used for heap snapshots at this point. Maybe just putting it in `v8_initializer.cc` would be good enough.

(It needs to stay in `core/` because of `Node`).

Kentaro Hara

Acknowledged

File third_party/blink/renderer/platform/heap/thread_state.h
Line 161, Patchset 3 (Latest): DevToolsCountersCallback dev_tools_counters_callback_;
Michael Lippautz . unresolved

This callback (devtools tracing scope) requires `core/`. I was asked already if we can make a GC observer at some point which we should probably do when there's more uses.

Kentaro Hara

+1 to introduce an observer pattern only when we have multiple cases.

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: Iec87004f31a4d7ae8e1a73a544285c21d1167aad
    Gerrit-Change-Number: 6667824
    Gerrit-PatchSet: 3
    Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
    Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Comment-Date: Tue, 24 Jun 2025 23:42:23 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Michael Lippautz (Gerrit)

    unread,
    Jun 25, 2025, 4:23:01 AMJun 25
    to Kentaro Hara, Chromium LUCI CQ, chromium...@chromium.org, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, oilpan-rev...@chromium.org, zol...@webkit.org

    Michael Lippautz voted and added 1 comment

    Votes added by Michael Lippautz

    Commit-Queue+2

    1 comment

    File third_party/blink/renderer/platform/heap/thread_state.h
    Line 161, Patchset 3 (Latest): DevToolsCountersCallback dev_tools_counters_callback_;
    Michael Lippautz . resolved

    This callback (devtools tracing scope) requires `core/`. I was asked already if we can make a GC observer at some point which we should probably do when there's more uses.

    Kentaro Hara

    +1 to introduce an observer pattern only when we have multiple cases.

    Michael Lippautz

    Acknowledged

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    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: Iec87004f31a4d7ae8e1a73a544285c21d1167aad
    Gerrit-Change-Number: 6667824
    Gerrit-PatchSet: 3
    Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
    Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Comment-Date: Wed, 25 Jun 2025 08:22:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Kentaro Hara <har...@chromium.org>
    Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    Jun 25, 2025, 4:25:50 AMJun 25
    to Michael Lippautz, Kentaro Hara, chromium...@chromium.org, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, oilpan-rev...@chromium.org, zol...@webkit.org

    Chromium LUCI CQ submitted the change

    Change information

    Commit message:
    bindings/heap: Move GC prologue callbacks to ThreadState

    ThreadState is already the home for anything garbage collection
    related in Blink. It combines the various GC related calls and ways to
    attach GC to an Isolate for custom logic around some weakness
    clearing.

    The CL moves the prologue and epilogue callbacks to ThreadState as
    well to unify the place where GC behavior is customized. This makes it
    easier to find and explain where GC is configured in Blink.
    Change-Id: Iec87004f31a4d7ae8e1a73a544285c21d1167aad
    Commit-Queue: Michael Lippautz <mlip...@chromium.org>
    Reviewed-by: Kentaro Hara <har...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1478413}
    Files:
    • M third_party/blink/renderer/bindings/bindings.gni
    • M third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h
    • D third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.cc
    • D third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.h
    • M third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc
    • M third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
    • M third_party/blink/renderer/core/html/forms/html_input_element.cc
    • M third_party/blink/renderer/core/layout/layout_object.cc
    • M third_party/blink/renderer/platform/bindings/active_script_wrappable_base.cc
    • M third_party/blink/renderer/platform/bindings/active_script_wrappable_base.h
    • M third_party/blink/renderer/platform/bindings/script_forbidden_scope.h
    • M third_party/blink/renderer/platform/bindings/v8_per_isolate_data.cc
    • M third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h
    • M third_party/blink/renderer/platform/heap/thread_state.cc
    • M third_party/blink/renderer/platform/heap/thread_state.h
    • M third_party/blink/renderer/platform/testing/main_thread_isolate.cc
    Change size: L
    Delta: 16 files changed, 173 insertions(+), 213 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Kentaro Hara
    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: Iec87004f31a4d7ae8e1a73a544285c21d1167aad
    Gerrit-Change-Number: 6667824
    Gerrit-PatchSet: 4
    Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
    Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages