[gjs/wip/ptomato/mozjs52: 12/38] js: Weak pointer callback API change



commit c246ff66bdc8a5ba8ea44ef9d9aac562fa76e0e0
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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784196

 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]