diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2017-03-19 05:10:35 +0000 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2017-05-05 23:26:30 -0700 |
commit | 80102b052f985558288b7662069bc4e2114774c5 (patch) | |
tree | 61406f69f8246541c5329574cf8029a35b990359 | |
parent | 0e4bec680d3b51e87833e110345397961b870f5e (diff) | |
download | gjs-80102b052f985558288b7662069bc4e2114774c5.tar.gz |
js: Weak pointer callback API change
Weak pointer callbacks now come in two flavours: per-zone and
per-compartment. We do everything in one compartment, and don't care
about zones, so we should use the per-compartment flavour.
-rw-r--r-- | gi/gtype.cpp | 10 | ||||
-rw-r--r-- | gi/object.cpp | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/gi/gtype.cpp b/gi/gtype.cpp index 4c19a3b6..3b832dac 100644 --- a/gi/gtype.cpp +++ b/gi/gtype.cpp @@ -57,8 +57,9 @@ gjs_get_gtype_wrapper_quark(void) } static void -update_gtype_weak_pointers(JSRuntime *rt, - void *data) +update_gtype_weak_pointers(JSRuntime *rt, + JSCompartment *compartment, + void *data) { for (auto iter = weak_pointer_list.begin(); iter != weak_pointer_list.end(); ) { auto heap_wrapper = static_cast<JS::Heap<JSObject *> *>(g_type_get_qdata(*iter, gjs_get_gtype_wrapper_quark())); @@ -74,8 +75,9 @@ static void ensure_weak_pointer_callback(JSContext *cx) { if (!weak_pointer_callback) { - JS_AddWeakPointerCallback(JS_GetRuntime(cx), update_gtype_weak_pointers, - nullptr); + JS_AddWeakPointerCompartmentCallback(JS_GetRuntime(cx), + update_gtype_weak_pointers, + nullptr); weak_pointer_callback = true; } } diff --git a/gi/object.cpp b/gi/object.cpp index 7cd08e11..f69735ef 100644 --- a/gi/object.cpp +++ b/gi/object.cpp @@ -1149,8 +1149,9 @@ init_object_private (JSContext *context, } static void -update_heap_wrapper_weak_pointers(JSRuntime *rt, - gpointer data) +update_heap_wrapper_weak_pointers(JSRuntime *rt, + JSCompartment *compartment, + gpointer data) { std::vector<GObject *> to_be_disassociated; @@ -1178,8 +1179,9 @@ static void ensure_weak_pointer_callback(JSContext *cx) { if (!weak_pointer_callback) { - JS_AddWeakPointerCallback(JS_GetRuntime(cx), - update_heap_wrapper_weak_pointers, NULL); + JS_AddWeakPointerCompartmentCallback(JS_GetRuntime(cx), + update_heap_wrapper_weak_pointers, + nullptr); weak_pointer_callback = true; } } |