Skip to content

chore: backport cppgc cleanups - #50914

Merged
MarshallOfSound merged 1 commit into
42-x-yfrom
robo/fix_gc_plugin_errors_42_x_y
Apr 11, 2026
Merged

MarshallOfSound merged 1 commit into
42-x-yfrom
robo/fix_gc_plugin_errors_42_x_y

Conversation

@deepak1556

Copy link
Copy Markdown
Member

Description of Change

Backport of #50465

Minus the gc plugin changes

Release Notes

Notes: none

Key fixes:
- Replace `base::WeakPtrFactory` with `gin::WeakCellFactory` in
  MenuMac, MenuViews, and NetLog, since weak pointers to cppgc-managed
  objects must go through weak cells
- Replace `v8::Global<v8::Value>` with `cppgc::Persistent<Menu>` for
  the menu reference in BaseWindow
- Stop using `gin_helper::Handle<T>` with cppgc types; use raw `T*`
  and add a `static_assert` to prevent future misuse
- Add proper `Trace()` overrides for Menu, MenuMac, MenuViews, and
  NetLog to ensure cppgc members are visited during garbage collection
- Replace `SelfKeepAlive` prevent-GC mechanism in Menu with a
  `cppgc::Persistent` prevent-GC captured in `BindSelfToClosure`
- Introduce `GC_PLUGIN_IGNORE` macro to suppress
  known-safe violations: mojo::Remote fields, ObjC bridging pointers,
  and intentional persistent self-references
- Mark `ArgumentHolder` as `CPPGC_STACK_ALLOCATED()` in both Electron's
  and gin's function_template.h to silence raw-pointer-to-GC-type
  warnings
@trop trop Bot mentioned this pull request Apr 10, 2026
@trop
trop Bot requested a review from a team April 10, 2026 20:12
@trop trop Bot added 42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Apr 10, 2026
@MarshallOfSound
MarshallOfSound merged commit aa7a81d into 42-x-y Apr 11, 2026
119 of 121 checks passed
@MarshallOfSound
MarshallOfSound deleted the robo/fix_gc_plugin_errors_42_x_y branch April 11, 2026 02:27
@release-clerk

release-clerk Bot commented Apr 11, 2026

Copy link
Copy Markdown

No Release Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants