filechooserwidget: Remove homegrown profiling

We have sysprof support now, so we no longer have
to use this homegrown profiler.
This commit is contained in:
Matthias Clasen 2020-07-12 10:05:57 -04:00
parent 7ddbbb50ff
commit aa5ab02166

View File

@ -117,56 +117,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
@ -2582,13 +2532,9 @@ 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);
update_appearance (impl);
profile_end ("end", NULL);
}
static void
@ -3244,15 +3190,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 */
@ -3263,14 +3205,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
@ -3281,21 +3219,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
@ -3304,17 +3235,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
@ -3550,8 +3475,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);
@ -3578,8 +3501,6 @@ gtk_file_chooser_widget_map (GtkWidget *widget)
g_assert_not_reached ();
}
}
profile_end ("end", NULL);
}
/* GtkWidget::unmap method */
@ -3879,22 +3800,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 */
@ -3903,8 +3818,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);
@ -3914,8 +3827,6 @@ load_timeout_cb (gpointer data)
load_set_model (impl);
profile_end ("end", NULL);
return FALSE;
}
@ -4168,8 +4079,6 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
GError *error,
GtkFileChooserWidget *impl)
{
profile_start ("start", NULL);
if (error)
{
set_busy_cursor (impl, FALSE);
@ -4190,7 +4099,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;
}
@ -4200,11 +4108,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.
@ -4721,8 +4624,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);
@ -4736,7 +4637,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);
@ -4757,8 +4657,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;
}
@ -5152,8 +5050,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;
}
@ -7947,11 +7842,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;
@ -7998,8 +7888,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
* which cannot be done with GtkBuilder
*/
post_process_ui (impl);
profile_end ("end", NULL);
}
/**