[gjs/master.windows: 4/9] gjs/context.cpp: Build heap dumping only on UNIX



commit ba5cd446af52d2703d120adcf13aa3d2779929f8
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Feb 22 13:20:27 2019 +0800

    gjs/context.cpp: Build heap dumping only on UNIX
    
    The heap dumping code will need to be ported in order to be used on
    Windows, so don't build those portions for now.  Instead, show a message
    that indicates this when running on Windows and attempting to setup the
    heap dump.

 gjs/context.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 922cd7bb..211f6931 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -25,7 +25,6 @@
 
 #include <signal.h>
 #include <sys/types.h>
-#include <unistd.h>
 
 #include <array>
 #include <codecvt>
@@ -34,6 +33,10 @@
 
 #include <gio/gio.h>
 
+#ifdef G_OS_UNIX
+# include <unistd.h>
+#endif
+
 #include "byteArray.h"
 #include "context-private.h"
 #include "engine.h"
@@ -126,6 +129,8 @@ static GList *all_contexts = NULL;
 static GjsAutoChar dump_heap_output;
 static unsigned dump_heap_idle_id = 0;
 
+#ifdef G_OS_UNIX
+/* Currently heap dumping is only supported on UNIX platforms! */
 static void
 gjs_context_dump_heaps(void)
 {
@@ -167,6 +172,7 @@ dump_heap_signal_handler(int signum)
         dump_heap_idle_id = g_idle_add_full(G_PRIORITY_HIGH_IDLE,
                                             dump_heap_idle, nullptr, nullptr);
 }
+#endif
 
 static void
 setup_dump_heap(void)
@@ -178,6 +184,7 @@ setup_dump_heap(void)
         /* install signal handler only if environment variable is set */
         const char *heap_output = g_getenv("GJS_DEBUG_HEAP_OUTPUT");
         if (heap_output) {
+#ifdef G_OS_UNIX
             struct sigaction sa;
 
             dump_heap_output = g_strdup(heap_output);
@@ -185,6 +192,9 @@ setup_dump_heap(void)
             memset(&sa, 0, sizeof(sa));
             sa.sa_handler = dump_heap_signal_handler;
             sigaction(SIGUSR1, &sa, nullptr);
+#else
+            g_message ("heap dump is currently only supported on UNIX platforms");
+#endif
         }
     }
 }


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