summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2014-02-27 13:53:52 -0800
committerCosimo Cecchi <cosimoc@gnome.org>2014-04-10 13:54:25 -0700
commit4e6ae069f76f34b3a13b3b601777e4f6123948e1 (patch)
tree86f911afe0c46f449ffd560c6d0c0d64eebd97f4
parent79075a41be7bfeb8706b66aef4280db0d73d50d8 (diff)
downloadgjs-4e6ae069f76f34b3a13b3b601777e4f6123948e1.tar.gz
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
-rw-r--r--gjs/jsapi-private.h2
-rw-r--r--gjs/jsapi-util.cpp21
2 files changed, 15 insertions, 8 deletions
diff --git a/gjs/jsapi-private.h b/gjs/jsapi-private.h
index c140f15f..ca99310f 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 942cd106..f4f6c65a 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