[gjs/wip/ptomato/mozjs52: 10/37] js: Weak pointer callback API change
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs52: 10/37] js: Weak pointer callback API change
- Date: Sun, 25 Jun 2017 06:55:07 +0000 (UTC)
commit 2e69979da32a7441d9b3db07b8e5a98b89f4ba72
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 84bcb03..facd361 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1131,8 +1131,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;
@@ -1160,8 +1161,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]