[gjs/wip/ptomato/mozjs52: 9/33] js: Weak pointer callback API change
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs52: 9/33] js: Weak pointer callback API change
- Date: Sun, 11 Jun 2017 05:38:30 +0000 (UTC)
commit 389aeb82fffa9a3b6e1d3eeba817802d5649ee53
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Mar 19 05:10:35 2017 +0000
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.
gi/gtype.cpp | 10 ++++++----
gi/object.cpp | 10 ++++++----
2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index 4c19a3b..3b832da 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 e00eeb1..dc4fe08 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1129,8 +1129,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;
@@ -1158,8 +1159,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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]