File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 24
24
class JobQueue : public JS ::JobQueue {
25
25
26
26
public:
27
- explicit JobQueue (JSContext *cx) : finalizationRegistryCallbacks(cx) {}
27
+ explicit JobQueue (JSContext *cx);
28
28
~JobQueue () = default ;
29
29
30
30
/* *
@@ -97,7 +97,7 @@ bool runFinalizationRegistryCallbacks(JSContext *cx);
97
97
private:
98
98
99
99
using FunctionVector = JS::GCVector<JSFunction *, 0 , js::SystemAllocPolicy>;
100
- JS::PersistentRooted<FunctionVector> finalizationRegistryCallbacks;
100
+ JS::PersistentRooted<FunctionVector> * finalizationRegistryCallbacks;
101
101
102
102
/* *
103
103
* @brief Capture this JobQueue's current job queue as a SavedJobQueue and return it,
Original file line number Diff line number Diff line change 20
20
21
21
#include < stdexcept>
22
22
23
+ JobQueue::JobQueue (JSContext *cx) {
24
+ finalizationRegistryCallbacks = new JS::PersistentRooted<FunctionVector>(cx);
25
+ }
26
+
23
27
JSObject *JobQueue::getIncumbentGlobal (JSContext *cx) {
24
28
return JS::CurrentGlobalOrNull (cx);
25
29
}
@@ -113,13 +117,13 @@ bool sendJobToMainLoop(PyObject *pyFunc) {
113
117
}
114
118
115
119
void JobQueue::queueFinalizationRegistryCallback (JSFunction *callback) {
116
- mozilla::Unused << finalizationRegistryCallbacks. append (callback);
120
+ mozilla::Unused << finalizationRegistryCallbacks-> append (callback);
117
121
}
118
122
119
123
bool JobQueue::runFinalizationRegistryCallbacks (JSContext *cx) {
120
124
bool ranCallbacks = false ;
121
125
JS::Rooted<FunctionVector> callbacks (cx);
122
- std::swap (callbacks.get (), finalizationRegistryCallbacks. get ());
126
+ std::swap (callbacks.get (), finalizationRegistryCallbacks-> get ());
123
127
for (JSFunction *f: callbacks) {
124
128
JS::ExposeObjectToActiveJS (JS_GetFunctionObject (f));
125
129
Original file line number Diff line number Diff line change @@ -254,8 +254,8 @@ PyTypeObject JSObjectItemsProxyType = {
254
254
255
255
static void cleanup () {
256
256
delete autoRealm;
257
- if (GLOBAL_CX) JS_DestroyContext (GLOBAL_CX);
258
257
delete global;
258
+ if (GLOBAL_CX) JS_DestroyContext (GLOBAL_CX);
259
259
delete JOB_QUEUE;
260
260
JS_ShutDown ();
261
261
}
You can’t perform that action at this time.
0 commit comments