[gnome-builder] subprocess: add more tracing



commit 607090a423e8116c5996ac0bbd1bb0ff25e784d1
Author: Christian Hergert <chergert redhat com>
Date:   Sun Oct 30 22:33:41 2016 -0700

    subprocess: add more tracing

 libide/subprocess/ide-simple-subprocess.c |   52 +++++++++++++++++++++++++---
 libide/subprocess/ide-subprocess.c        |   18 ++++++++--
 2 files changed, 60 insertions(+), 10 deletions(-)
---
diff --git a/libide/subprocess/ide-simple-subprocess.c b/libide/subprocess/ide-simple-subprocess.c
index 98bc99d..7047976 100644
--- a/libide/subprocess/ide-simple-subprocess.c
+++ b/libide/subprocess/ide-simple-subprocess.c
@@ -18,7 +18,9 @@
 
 #define G_LOG_DOMAIN "ide-simple-subprocess"
 
-#include "ide-simple-subprocess.h"
+#include "ide-debug.h"
+
+#include "subprocess/ide-simple-subprocess.h"
 
 struct _IdeSimpleSubprocess
 {
@@ -36,9 +38,13 @@ ide_simple_subprocess_finalize (GObject *object)
 {
   IdeSimpleSubprocess *self = (IdeSimpleSubprocess *)object;
 
+  IDE_ENTRY;
+
   g_clear_object (&self->subprocess);
 
   G_OBJECT_CLASS (ide_simple_subprocess_parent_class)->finalize (object);
+
+  IDE_EXIT;
 }
 
 static void
@@ -98,10 +104,17 @@ ide_simple_subprocess_wait_cb (GObject      *object,
   g_autoptr(GTask) task = user_data;
   g_autoptr(GError) error = NULL;
 
+  IDE_ENTRY;
+
+  g_assert (G_IS_SUBPROCESS (subprocess));
+  g_assert (G_IS_TASK (task));
+
   if (!g_subprocess_wait_finish (subprocess, result, &error))
     g_task_return_error (task, g_steal_pointer (&error));
   else
     g_task_return_boolean (task, TRUE);
+
+  IDE_EXIT;
 }
 
 static void
@@ -111,8 +124,22 @@ ide_simple_subprocess_wait_async (IdeSubprocess       *subprocess,
                                   gpointer             user_data)
 {
   IdeSimpleSubprocess *self = (IdeSimpleSubprocess *)subprocess;
-  GTask *task = g_task_new (self, cancellable, callback, user_data);
-  g_subprocess_wait_async (self->subprocess, cancellable, ide_simple_subprocess_wait_cb, task);
+  g_autoptr(GTask) task = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_SIMPLE_SUBPROCESS (self));
+  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+  task = g_task_new (self, cancellable, callback, user_data);
+  g_task_set_source_tag (task, ide_simple_subprocess_wait_async);
+
+  g_subprocess_wait_async (self->subprocess,
+                           cancellable,
+                           ide_simple_subprocess_wait_cb,
+                           g_steal_pointer (&task));
+
+  IDE_EXIT;
 }
 
 static gboolean
@@ -120,7 +147,16 @@ ide_simple_subprocess_wait_finish (IdeSubprocess  *subprocess,
                                    GAsyncResult   *result,
                                    GError        **error)
 {
-  return g_task_propagate_boolean (G_TASK (result), error);
+  gboolean ret;
+
+  IDE_ENTRY;
+
+  g_assert (IDE_IS_SIMPLE_SUBPROCESS (subprocess));
+  g_assert (G_IS_TASK (result));
+
+  ret = g_task_propagate_boolean (G_TASK (result), error);
+
+  IDE_RETURN (ret);
 }
 
 static gboolean
@@ -163,13 +199,17 @@ static void
 ide_simple_subprocess_send_signal (IdeSubprocess *subprocess,
                                    gint           signal_num)
 {
-  return WRAP_INTERFACE_METHOD (send_signal, signal_num);
+  IDE_ENTRY;
+  WRAP_INTERFACE_METHOD (send_signal, signal_num);
+  IDE_EXIT;
 }
 
 static void
 ide_simple_subprocess_force_exit (IdeSubprocess *subprocess)
 {
-  return WRAP_INTERFACE_METHOD (force_exit);
+  IDE_ENTRY;
+  WRAP_INTERFACE_METHOD (force_exit);
+  IDE_EXIT;
 }
 
 static gboolean
diff --git a/libide/subprocess/ide-subprocess.c b/libide/subprocess/ide-subprocess.c
index 5781067..a981f08 100644
--- a/libide/subprocess/ide-subprocess.c
+++ b/libide/subprocess/ide-subprocess.c
@@ -18,7 +18,9 @@
 
 #define G_LOG_DOMAIN "ide-subprocess"
 
-#include "ide-subprocess.h"
+#include "ide-debug.h"
+
+#include "subprocess/ide-subprocess.h"
 
 G_DEFINE_INTERFACE (IdeSubprocess, ide_subprocess, G_TYPE_OBJECT)
 
@@ -46,7 +48,7 @@ ide_subprocess_get_identifier (IdeSubprocess *self)
  * Returns: (transfer none): A #GInputStream or %NULL.
  */
 GInputStream *
-ide_subprocess_get_stdout_pipe  (IdeSubprocess *self)
+ide_subprocess_get_stdout_pipe (IdeSubprocess *self)
 {
   g_return_val_if_fail (IDE_IS_SUBPROCESS (self), NULL);
 
@@ -133,22 +135,26 @@ ide_subprocess_wait_check_cb (GObject      *object,
   g_autoptr(GTask) task = user_data;
   g_autoptr(GError) error = NULL;
 
+  IDE_ENTRY;
+
   g_assert (IDE_IS_SUBPROCESS (self));
   g_assert (G_IS_TASK (task));
 
   if (!ide_subprocess_wait_finish (self, result, &error))
     {
       g_task_return_error (task, g_steal_pointer (&error));
-      return;
+      IDE_EXIT;
     }
 
   if (!ide_subprocess_check_exit_status (self, &error))
     {
       g_task_return_error (task, g_steal_pointer (&error));
-      return;
+      IDE_EXIT;
     }
 
   g_task_return_boolean (task, TRUE);
+
+  IDE_EXIT;
 }
 
 void
@@ -159,6 +165,8 @@ ide_subprocess_wait_check_async (IdeSubprocess       *self,
 {
   g_autoptr(GTask) task = NULL;
 
+  IDE_ENTRY;
+
   g_return_if_fail (IDE_IS_SUBPROCESS (self));
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
 
@@ -169,6 +177,8 @@ ide_subprocess_wait_check_async (IdeSubprocess       *self,
                              cancellable,
                              ide_subprocess_wait_check_cb,
                              g_steal_pointer (&task));
+
+  IDE_EXIT;
 }
 
 gboolean


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