Skip to content

refactor: webContents managed by cppgc - #53757

Merged
deepak1556 merged 12 commits into
robo/cppgc_web_contents_lifecyclefrom
robo/cppgc_web_contents
Sep 21, 2026
Merged

deepak1556 merged 12 commits into
robo/cppgc_web_contents_lifecyclefrom
robo/cppgc_web_contents

Conversation

@deepak1556

@deepak1556 deepak1556 commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Description of Change

Refs #47922

Release Notes

Notes: none

@deepak1556
deepak1556 added this pull request to stack #53756 September 9, 2026 04:38
@deepak1556 deepak1556 added semver/patch backwards-compatible bug fixes no-backport labels Sep 9, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Sep 9, 2026
@deepak1556
deepak1556 force-pushed the robo/cppgc_web_contents branch from 3fb63fe to bb905e2 Compare September 9, 2026 13:51
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Sep 10, 2026

@MarshallOfSound MarshallOfSound left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two crashes inline, both reproduced on this branch: will-destroy / destroyed listeners at quit now run after Session has torn down, and a collected Debugger can still receive CDP messages before its finalizer detaches it. The destroyed / WeakPtr crash from #53755 is also still reachable here.

@deepak1556
deepak1556 force-pushed the robo/cppgc_web_contents branch from 6e990ce to 8c67f1c Compare September 18, 2026 07:58
@deepak1556
deepak1556 removed this pull request from stack #53756 September 18, 2026 07:59
@deepak1556
deepak1556 added this pull request to stack #54079 September 18, 2026 08:03
@deepak1556
deepak1556 marked this pull request as ready for review September 18, 2026 22:19
@ckerr
ckerr force-pushed the robo/cppgc_web_contents branch from c462f13 to c4b30c7 Compare September 18, 2026 23:01

@ckerr ckerr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Astra, xhigh)

Move api::WebContents onto the cppgc managed gin::Wrappable, so the
wrapper participates in unified heap tracing instead of being pinned and
deleted by hand. NativeLifecycle now holds a weak link into the GC
heap, registers a dispose observer to drain native resources before
isolate shutdown, and is deleted in a follow up task so native teardown
never runs during sweeping.
Retain the Debugger until native target teardown so the detach event remains
observable, without capturing the WebContents in the listener closure.

Avoid polling WeakRefs during forced collection because deref() keeps the
target alive until the end of the current V8 job.
Register setEventEmitterPrototype as a direct method instead of converting
a base callback through TranslatorHolder.

The linked binding can remain reachable until isolate shutdown, where V8 does
not guarantee weak callback execution, leaving the native holder allocated.
Route DevToolsAgentHost callbacks through a native proxy that holds a weak
cppgc reference to the debugger wrapper.
Store guest embedders as weak cppgc references so attached guests do not retain
their embedders and native resources indefinitely. Guard later embedder access
and keep the guest delegate's native embedder reference weak.

Handle a cleared WebContents WeakCell when queued printToPDF jobs start after
the WebContents has been destroyed, rejecting instead of dereferencing null.
@deepak1556
deepak1556 merged commit 6aa00bb into main Sep 21, 2026
72 checks passed
@deepak1556
deepak1556 deleted the robo/cppgc_web_contents branch September 21, 2026 09:59
@release-clerk

release-clerk Bot commented Sep 21, 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

no-backport semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants