[gjs/wip/ptomato/mozjs45: 22/33] js: Weak pointer callback API change
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs45: 22/33] js: Weak pointer callback API change
- Date: Mon, 17 Apr 2017 07:28:31 +0000 (UTC)
commit 4b569713ddc8d7d3c4bbdba7f9b5751a615549ef
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 0194803..81b33e3 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)
{
for (auto iter = weak_pointer_list.begin(); iter != weak_pointer_list.end(); ) {
ObjectInstance *priv = *iter;
@@ -1173,8 +1174,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]