@@ -615,6 +615,12 @@ class Cleanable {
615615 friend class Environment ;
616616};
617617
618+ class CppgcWrapperCleanup {
619+ public:
620+ virtual void Clean () = 0;
621+ ListNode<CppgcWrapperCleanup> wrapper_queue;
622+ };
623+
618624/* *
619625 * Environment is a per-isolate data structure that represents an execution
620626 * environment. Each environment has a principal realm. An environment can
@@ -703,6 +709,7 @@ class Environment final : public MemoryRetainer {
703709 Realm* realm,
704710 const ContextInfo& info);
705711 void UnassignFromContext (v8::Local<v8::Context> context);
712+ void UntrackContext (v8::Local<v8::Context> context);
706713 void TrackShadowRealm (shadow_realm::ShadowRealm* realm);
707714 void UntrackShadowRealm (shadow_realm::ShadowRealm* realm);
708715
@@ -910,12 +917,17 @@ class Environment final : public MemoryRetainer {
910917 typedef ListHead<HandleWrap, &HandleWrap::handle_wrap_queue_> HandleWrapQueue;
911918 typedef ListHead<ReqWrapBase, &ReqWrapBase::req_wrap_queue_> ReqWrapQueue;
912919 typedef ListHead<Cleanable, &Cleanable::cleanable_queue_> CleanableQueue;
920+ typedef ListHead<CppgcWrapperCleanup, &CppgcWrapperCleanup::wrapper_queue>
921+ CppgcWrapperQueue;
913922
914923 inline HandleWrapQueue* handle_wrap_queue () { return &handle_wrap_queue_; }
915924 inline CleanableQueue* cleanable_queue () {
916925 return &cleanable_queue_;
917926 }
918927 inline ReqWrapQueue* req_wrap_queue () { return &req_wrap_queue_; }
928+ inline CppgcWrapperQueue* cppgc_wrapper_queue () {
929+ return &cppgc_wrapper_queue_;
930+ }
919931
920932 // https://w3c.github.io/hr-time/#dfn-time-origin
921933 inline uint64_t time_origin () {
@@ -1084,7 +1096,6 @@ class Environment final : public MemoryRetainer {
10841096 v8::Local<v8::Value>),
10851097 const char* errmsg);
10861098 void TrackContext (v8::Local<v8::Context> context);
1087- void UntrackContext (v8::Local<v8::Context> context);
10881099
10891100 std::list<binding::DLib> loaded_addons_;
10901101 v8::Isolate* const isolate_;
@@ -1203,6 +1214,8 @@ class Environment final : public MemoryRetainer {
12031214 CleanableQueue cleanable_queue_;
12041215 HandleWrapQueue handle_wrap_queue_;
12051216 ReqWrapQueue req_wrap_queue_;
1217+ CppgcWrapperQueue cppgc_wrapper_queue_;
1218+
12061219 int handle_cleanup_waiting_ = 0 ;
12071220 int request_waiting_ = 0 ;
12081221
0 commit comments