Trace `WindowProxy::global_proxy_`
Originally, this field was a ScopedPersistent, making it a strong GC root from Blink to v8::Context. When the context was disposed (e.g. when detaching the frame or purging v8), it was important to convert it to a weak GC root with SetPhantom(). Otherwise, even if WindowProxy itself was no longer reachable via Blink C++ objects, the strong V8 reference could create a reference cycle preventing GC of both Blink and v8 objects. WindowProxy -> global_proxy_ -> v8::Context -> JS object -> chain of Blink C++ objects -> WindowProxy With unified tracing, global_proxy_ can simply be a traced v8 reference. Once WindowProxy is no longer reachable from a GC root (typically via WebFrame (retained via a SelfKeepAlive) -> Frame -> WindowProxy), WindowProxy and the associated v8::Context become collectible with no need to explitily break a cycle. Change-Id: If009b16260100a840c96ba4550a3da51554015fc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2598664 Commit-Queue: Daniel Cheng <dcheng@chromium.org> Reviewed-by:Kentaro Hara <haraken@chromium.org> Reviewed-by:
Yuki Shiino <yukishiino@chromium.org> Reviewed-by:
Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#841023}
Showing
Please register or sign in to comment