[gnome-shell] shell-global: Add shell_global_maybe_gc



commit 9fca747ef439a94f537b0b8923ae30a469841f7c
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Sat Apr 3 12:48:18 2010 +0200

    shell-global: Add shell_global_maybe_gc
    
    Add a method to call JS_MaybeGC, see
    https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_MaybeGC
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614725

 src/shell-global.c |   16 ++++++++++++++++
 src/shell-global.h |    2 ++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index 531ef2c..11f0ee4 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -841,6 +841,22 @@ shell_global_gc (ShellGlobal *global)
   JS_GC (context);
 }
 
+/**
+ * shell_global_maybe_gc:
+ * @global: A #ShellGlobal
+ *
+ * Start a garbage collection process when it would free up enough memory
+ * to be worth the amount of time it would take
+ * https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_MaybeGC
+ */
+void
+shell_global_maybe_gc (ShellGlobal *global)
+{
+  JSContext *context = gjs_context_get_native_context (global->js_context);
+
+  JS_MaybeGC (context);
+}
+
 void
 shell_global_grab_dbus_service (ShellGlobal *global)
 {
diff --git a/src/shell-global.h b/src/shell-global.h
index 480d47b..e46bea1 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -74,6 +74,8 @@ void shell_global_breakpoint (ShellGlobal *global);
 
 void shell_global_gc (ShellGlobal *global);
 
+void shell_global_maybe_gc (ShellGlobal *global);
+
 void shell_global_format_time_relative_pretty (ShellGlobal *global, guint delta, char **text, guint *update_time);
 
 ClutterActor *shell_global_create_root_pixmap_actor (ShellGlobal *global);



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