Repository navigation
chore: backport cppgc cleanups - #50915
Conversation
2143eef to
ad4bb32
Compare
ckerr
left a comment
There was a problem hiding this comment.
Failing to build here:
2026-04-10T23:44:35.3098520Z In file included from ../../electron/shell/browser/api/electron_api_tray.cc:24:
menu;
2026-04-10T23:44:35.3695290Z ##[error]../../electron/shell/common/gin_helper/handle.h:25:17: error: static assertion failed due to requirement '!cppgc::IsGarbageCollectedTypeVelectron::api::Menu': gin_helper::Handle must not be used with cppgc garbage-collected types. Use T* directly instead.
2026-04-10T23:44:35.3707560Z 25 | static_assert(!cppgc::IsGarbageCollectedTypeV,
2026-04-10T23:44:35.3708010Z | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2026-04-10T23:44:35.3709450Z ../../electron/shell/browser/api/electron_api_tray.cc:377:28: note: in instantiation of template class 'gin_helper::Handleelectron::api::Menu' requested here
2026-04-10T23:44:35.3710070Z 377 | gin_helper::Handle
2026-04-10T23:44:35.3710380Z | ^
2026-04-10T23:44:35.3710660Z 1 error generated.
2026-04-10T23:44:35.3710800Z
2026-04-10T23:44:35.3710800Z
2026-04-10T23:44:35.6462010Z build failed
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
1db3261 to
2fef39d
Compare
|
Failing tests are unrelated and addressed in dad4ab6, merging. |
|
No Release Notes |
Description of Change
Backport of #50465
Minus the gc plugin changes
Release Notes
Notes: none