[gjs] jsapi-util: split a gjs_gc_if_needed() function



commit 4e6ae069f76f34b3a13b3b601777e4f6123948e1
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Feb 27 13:53:52 2014 -0800

    jsapi-util: split a gjs_gc_if_needed() function
    
    We're going to use this later.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725099

 gjs/jsapi-private.h |    2 ++
 gjs/jsapi-util.cpp  |   21 +++++++++++++--------
 2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/gjs/jsapi-private.h b/gjs/jsapi-private.h
index c140f15..ca99310 100644
--- a/gjs/jsapi-private.h
+++ b/gjs/jsapi-private.h
@@ -35,6 +35,8 @@
 
 G_BEGIN_DECLS
 
+void gjs_gc_if_needed      (JSContext *context);
+
 G_END_DECLS
 
 #endif  /* __GJS_JSAPI_PRIVATE_H__ */
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 942cd10..f4f6c65 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -1178,16 +1178,9 @@ _linux_get_self_process_size (gulong *vm_size,
 static gulong linux_rss_trigger;
 #endif
 
-/**
- * gjs_maybe_gc:
- *
- * Low level version of gjs_context_maybe_gc().
- */
 void
-gjs_maybe_gc (JSContext *context)
+gjs_gc_if_needed (JSContext *context)
 {
-    JS_MaybeGC(context);
-
 #ifdef __linux__
     {
         /* We initiate a GC if VM or RSS has grown by this much */
@@ -1218,6 +1211,18 @@ gjs_maybe_gc (JSContext *context)
 }
 
 /**
+ * gjs_maybe_gc:
+ *
+ * Low level version of gjs_context_maybe_gc().
+ */
+void
+gjs_maybe_gc (JSContext *context)
+{
+    JS_MaybeGC(context);
+    gjs_gc_if_needed(context);
+}
+
+/**
  * gjs_strip_unix_shebang:
  *
  * @script: (in): A pointer to a JS script


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