-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: integrate ContextifyContext to cppgc #56522
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56522 +/- ##
=======================================
Coverage 89.16% 89.17%
=======================================
Files 662 662
Lines 191745 191750 +5
Branches 36902 36901 -1
=======================================
+ Hits 170971 170985 +14
- Misses 13627 13628 +1
+ Partials 7147 7137 -10
|
28b6b67
to
4cfe15f
Compare
38132a2
to
bcb919d
Compare
This simplifies the memory management of ContextifyContext, making all references visible to V8. The destructors don't need to do anything because when the wrapper is going away, the context is already going away or otherwise it would've been holding the wrapper alive, so there's no need to reset the pointers in the context. Also, any global handles to the context would've been empty at this point, and the per-Environment context tracking code is capable of dealing with empty handles from contexts purged elsewhere. To this end, the context tracking code also purges empty handles from the list now, to prevent keeping too many empty handles around.
bcb919d
to
a4ef690
Compare
After tracing the lifetime of ContextifyContexts a bit I realized that ContextifyContext does not even need to do any special cleanups, as the weak global handles in the context list would just become empty when the cycle involving Context/ContextifyContext is unreachable and will get purged sooner or later. So this no longer depend on #56534 |
This simplifies the memory management of ContextifyContext,
making all references visible to V8.
The destructors don't need to do anything because when the wrapper is
going away, the context is already going away or otherwise it would've
been holding the wrapper alive, so there's no need to reset the
pointers in the context. Also, any global handles to the context
would've been empty at this point, and the per-Environment context
tracking code is capable of dealing with empty handles from contexts
purged elsewhere.
To this end, the context tracking code also purges empty handles
from the list now, to prevent keeping too many empty handles around.