[gtk/matthiasc/for-master] filechooserwidget: Remove homegrown profiling



commit 1e1e4c28a30cb68e9f359f7e16437e2a8d3a4f6b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jul 12 10:05:57 2020 -0400

    filechooserwidget: Remove homegrown profiling
    
    We have sysprof support now, so we no longer have
    to use this homegrown profiler.

 gtk/gtkfilechooserwidget.c | 114 +--------------------------------------------
 1 file changed, 1 insertion(+), 113 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index ac9e8721a1..7607ba9dbb 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -118,56 +118,6 @@
 /* 150 mseconds of delay */
 #define LOCATION_CHANGED_TIMEOUT 150
 
-/* Profiling stuff */
-#undef PROFILE_FILE_CHOOSER
-#ifdef PROFILE_FILE_CHOOSER
-
-
-#ifndef F_OK 
-#define F_OK 0
-#endif
-
-#define PROFILE_INDENT 4
-
-static int profile_indent;
-
-static void
-profile_add_indent (int indent)
-{
-  profile_indent += indent;
-  if (profile_indent < 0)
-    g_error ("You screwed up your indentation");
-}
-
-static void
-_gtk_file_chooser_profile_log (const char *func, int indent, const char *msg1, const char *msg2)
-{
-  char *str;
-
-  if (indent < 0)
-    profile_add_indent (indent);
-
-  if (profile_indent == 0)
-    str = g_strdup_printf ("MARK: %s %s %s", func ? func : "", msg1 ? msg1 : "", msg2 ? msg2 : "");
-  else
-    str = g_strdup_printf ("MARK: %*c %s %s %s", profile_indent - 1, ' ', func ? func : "", msg1 ? msg1 : 
"", msg2 ? msg2 : "");
-
-  access (str, F_OK);
-  g_free (str);
-
-  if (indent > 0)
-    profile_add_indent (indent);
-}
-
-#define profile_start(x, y) _gtk_file_chooser_profile_log (G_STRFUNC, PROFILE_INDENT, x, y)
-#define profile_end(x, y) _gtk_file_chooser_profile_log (G_STRFUNC, -PROFILE_INDENT, x, y)
-#define profile_msg(x, y) _gtk_file_chooser_profile_log (NULL, 0, x, y)
-#else
-#define profile_start(x, y)
-#define profile_end(x, y)
-#define profile_msg(x, y)
-#endif
-
 enum {
   PROP_SEARCH_MODE = 1,
   PROP_SUBTITLE
@@ -2589,15 +2539,11 @@ gtk_file_chooser_widget_constructed (GObject *object)
 {
   GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (object);
 
-  profile_start ("start", NULL);
-
   G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->constructed (object);
 
   g_assert (impl->file_system);
 
   update_appearance (impl);
-
-  profile_end ("end", NULL);
 }
 
 static void
@@ -3245,15 +3191,11 @@ gtk_file_chooser_widget_unroot (GtkWidget *widget)
 static void
 change_icon_theme (GtkFileChooserWidget *impl)
 {
-  profile_start ("start", NULL);
-
   /* the first cell in the first column is the icon column, and we have a fixed size there */
   set_icon_cell_renderer_fixed_size (impl);
 
   clear_model_cache (impl, MODEL_COL_ICON);
   gtk_widget_queue_resize (impl->browse_files_tree_view);
-
-  profile_end ("end", NULL);
 }
 
 /* Callback used when a GtkSettings value changes */
@@ -3264,14 +3206,10 @@ settings_notify_cb (GObject               *object,
 {
   const char *name;
 
-  profile_start ("start", NULL);
-
   name = g_param_spec_get_name (pspec);
 
   if (strcmp (name, "gtk-icon-theme-name") == 0)
     change_icon_theme (impl);
-
-  profile_end ("end", NULL);
 }
 
 /* Installs a signal handler for GtkSettings so that we can monitor changes in
@@ -3282,21 +3220,14 @@ check_icon_theme (GtkFileChooserWidget *impl)
 {
   GtkSettings *settings;
 
-  profile_start ("start", NULL);
-
   if (impl->settings_signal_id)
-    {
-      profile_end ("end", NULL);
-      return;
-    }
+    return;
 
   settings = gtk_widget_get_settings (GTK_WIDGET (impl));
   impl->settings_signal_id = g_signal_connect (settings, "notify",
                                                G_CALLBACK (settings_notify_cb), impl);
 
   change_icon_theme (impl);
-
-  profile_end ("end", NULL);
 }
 
 static void
@@ -3305,17 +3236,11 @@ gtk_file_chooser_widget_css_changed (GtkWidget         *widget,
 {
   GtkFileChooserWidget *impl;
 
-  profile_start ("start", NULL);
-
   impl = GTK_FILE_CHOOSER_WIDGET (widget);
 
-  profile_msg ("    parent class css_changed start", NULL);
   GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->css_changed (widget, change);
-  profile_msg ("    parent class css_changed end", NULL);
 
   change_icon_theme (impl);
-
-  profile_end ("end", NULL);
 }
 
 static void
@@ -3551,8 +3476,6 @@ gtk_file_chooser_widget_map (GtkWidget *widget)
 {
   GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
 
-  profile_start ("start", NULL);
-
   impl->browse_files_interaction_frozen = FALSE;
 
   GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->map (widget);
@@ -3579,8 +3502,6 @@ gtk_file_chooser_widget_map (GtkWidget *widget)
           g_assert_not_reached ();
       }
     }
-
-  profile_end ("end", NULL);
 }
 
 /* GtkWidget::unmap method */
@@ -3880,22 +3801,16 @@ update_columns (GtkFileChooserWidget *impl,
 static void
 load_set_model (GtkFileChooserWidget *impl)
 {
-  profile_start ("start", NULL);
-
   g_assert (impl->browse_files_model != NULL);
 
-  profile_msg ("    gtk_tree_view_set_model start", NULL);
   gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
                            GTK_TREE_MODEL (impl->browse_files_model));
   update_columns (impl, FALSE, _("Modified"));
   file_list_set_sort_column_ids (impl);
   set_sort_column (impl);
-  profile_msg ("    gtk_tree_view_set_model end", NULL);
   impl->list_sort_ascending = TRUE;
 
   g_set_object (&impl->model_for_search, impl->browse_files_model);
-
-  profile_end ("end", NULL);
 }
 
 /* Timeout callback used when the loading timer expires */
@@ -3904,8 +3819,6 @@ load_timeout_cb (gpointer data)
 {
   GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (data);
 
-  profile_start ("start", NULL);
-
   g_assert (impl->load_state == LOAD_PRELOAD);
   g_assert (impl->load_timeout_id != 0);
   g_assert (impl->browse_files_model != NULL);
@@ -3915,8 +3828,6 @@ load_timeout_cb (gpointer data)
 
   load_set_model (impl);
 
-  profile_end ("end", NULL);
-
   return FALSE;
 }
 
@@ -4169,8 +4080,6 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel   *model,
                                         GError               *error,
                                         GtkFileChooserWidget *impl)
 {
-  profile_start ("start", NULL);
-
   if (error)
     {
       set_busy_cursor (impl, FALSE);
@@ -4191,7 +4100,6 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel   *model,
       /* We can't g_assert_not_reached(), as something other than us may have
        *  initiated a folder reload.  See #165556.
        */
-      profile_end ("end", NULL);
       return;
     }
 
@@ -4201,11 +4109,6 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel   *model,
 
   pending_select_files_process (impl);
   set_busy_cursor (impl, FALSE);
-#ifdef PROFILE_FILE_CHOOSER
-  access ("MARK: *** FINISHED LOADING", F_OK);
-#endif
-
-  profile_end ("end", NULL);
 }
 
 /* Callback used when file system model adds or updates a file.
@@ -4722,8 +4625,6 @@ set_list_model (GtkFileChooserWidget  *impl,
       _gtk_file_system_model_get_directory (impl->browse_files_model) == impl->current_folder)
     return TRUE;
 
-  profile_start ("start", NULL);
-
   stop_loading_and_clear_list_model (impl, TRUE);
 
   set_busy_cursor (impl, TRUE);
@@ -4737,7 +4638,6 @@ set_list_model (GtkFileChooserWidget  *impl,
 
   _gtk_file_system_model_set_show_hidden (impl->browse_files_model, impl->show_hidden);
 
-  profile_msg ("    set sort function", NULL);
   gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_NAME, 
name_sort_func, impl, NULL);
   gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_SIZE, 
size_sort_func, impl, NULL);
   gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_TYPE, 
type_sort_func, impl, NULL);
@@ -4758,8 +4658,6 @@ set_list_model (GtkFileChooserWidget  *impl,
 
   _gtk_file_system_model_set_filter (impl->browse_files_model, impl->current_filter);
 
-  profile_end ("end", NULL);
-
   return TRUE;
 }
 
@@ -5156,8 +5054,6 @@ gtk_file_chooser_widget_update_current_folder (GtkFileChooser  *chooser,
   GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
   struct UpdateCurrentFolderData *data;
 
-  profile_start ("start", NULL);
-
   g_object_ref (file);
 
   operation_mode_set (impl, OPERATION_MODE_BROWSE);
@@ -5183,7 +5079,6 @@ gtk_file_chooser_widget_update_current_folder (GtkFileChooser  *chooser,
   set_busy_cursor (impl, TRUE);
   g_object_unref (file);
 
-  profile_end ("end", NULL);
   return TRUE;
 }
 
@@ -7959,11 +7854,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
 {
   GtkExpression *expression;
 
-  profile_start ("start", NULL);
-#ifdef PROFILE_FILE_CHOOSER
-  access ("MARK: *** CREATE FILE CHOOSER", F_OK);
-#endif
-
   impl->select_multiple = FALSE;
   impl->show_hidden = FALSE;
   impl->show_size_column = TRUE;
@@ -8011,8 +7901,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
    * which cannot be done with GtkBuilder
    */
   post_process_ui (impl);
-
-  profile_end ("end", NULL);
 }
 
 /**


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