[gjs/wip/ptomato/mozjs45prep: 12/23] js: weak pointer callbacks now take either a zone or a compartment



commit 18d2848c9ab32e29f9b9faa68ae1e889335ae5e1
Author: Philip Chimento <philip endlessm com>
Date:   Sun Mar 19 05:10:35 2017 +0000

    js: weak pointer callbacks now take either a zone or a compartment

 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 f91d3ac..1752ee0 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -58,8 +58,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()));
@@ -75,8 +76,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 a3f6e24..0679d53 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1319,8 +1319,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;
@@ -1343,8 +1344,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]