[gjs/gnome-3-12: 1/6] object: remove bogus comment and code about GC in a secondary thread



commit f69d4de34288befbae3b16f4960c48ec10abe5bc
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Feb 23 22:25:03 2014 +0100

    object: remove bogus comment and code about GC in a secondary thread
    
    handle_toggle_up() is only ever called from the main thread, and
    that's where GC marking happens. The background GC thread only
    deals with sweeping, and not even of JS objects!
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725024

 gi/object.cpp |   26 +++++---------------------
 1 files changed, 5 insertions(+), 21 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 5809e08..8a63809 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -865,8 +865,7 @@ handle_toggle_down(GObject *gobj)
 }
 
 static void
-handle_toggle_up(GObject   *gobj,
-                 gboolean   gc_already_blocked)
+handle_toggle_up(GObject   *gobj)
 {
     ObjectInstance *priv;
     JSObject *obj;
@@ -874,22 +873,11 @@ handle_toggle_up(GObject   *gobj,
     /* We need to root the JSObject associated with the passed in GObject so it
      * doesn't get garbage collected (and lose any associated javascript state
      * such as custom properties).
-     *
-     * Note it's possible that the garbage collector is running in a secondary
-     * thread right now. If it is, we need to wait for it to finish, then block
-     * it from starting again while we root the object. After it's blocked we need
-     * to check if the associated JSObject was reaped. If it was we need to
-     * abort mission.
      */
-    if (!gc_already_blocked)
-        gjs_block_gc();
-
     obj = peek_js_obj(gobj);
 
-    if (!obj) {
-        /* Object already GC'd */
-        goto out;
-    }
+    if (!obj) /* Object already GC'd */
+        return;
 
     priv = (ObjectInstance *) JS_GetPrivate(obj);
 
@@ -911,10 +899,6 @@ handle_toggle_up(GObject   *gobj,
                                  obj,
                                  priv);
     }
-
-out:
-    if (!gc_already_blocked)
-        gjs_unblock_gc();
 }
 
 static gboolean
@@ -929,7 +913,7 @@ idle_handle_toggle(gpointer data)
 
     switch (operation->direction) {
         case TOGGLE_UP:
-            handle_toggle_up(operation->gobj, FALSE);
+            handle_toggle_up(operation->gobj);
             break;
         case TOGGLE_DOWN:
             handle_toggle_down(operation->gobj);
@@ -1065,7 +1049,7 @@ wrapped_gobj_toggle_notify(gpointer      data,
                         G_OBJECT_TYPE_NAME(gobj));
             }
 
-            handle_toggle_up(gobj, gc_blocked);
+            handle_toggle_up(gobj);
         } else {
             queue_toggle_idle(gobj, TOGGLE_UP);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]