summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnestas Kulik <ernestask@gnome.org>2017-06-26 10:58:53 +0300
committerCarlos Soriano <csoriano@localhost.localdomain>2017-08-17 15:38:46 +0200
commitd4535d9cf06d1a0787acb5af1b40f1310050a04e (patch)
tree4e47f776ec396c7b144dc3224ad4d5d9f3e02ee5
parentb468a3f6a62256b09218d6a53119595475e16188 (diff)
downloadnautilus-d4535d9cf06d1a0787acb5af1b40f1310050a04e.tar.gz
general: print debug info unconditionally
Chasing down macros to get some debugging output gets tedious and the effect on performance should be negligible. https://bugzilla.gnome.org/show_bug.cgi?id=784200
-rw-r--r--src/nautilus-directory-async.c42
-rw-r--r--src/nautilus-thumbnails.c88
2 files changed, 42 insertions, 88 deletions
diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c
index 05e138ae3..05a87e360 100644
--- a/src/nautilus-directory-async.c
+++ b/src/nautilus-directory-async.c
@@ -37,21 +37,11 @@
#include <stdio.h>
#include <stdlib.h>
-/* turn this on to see messages about each load_directory call: */
-#if 0
-#define DEBUG_LOAD_DIRECTORY
-#endif
-
/* turn this on to check if async. job calls are balanced */
#if 0
#define DEBUG_ASYNC_JOBS
#endif
-/* turn this on to log things starting and stopping */
-#if 0
-#define DEBUG_START_STOP
-#endif
-
#define DIRECTORY_LOAD_ITEMS_PER_CALLBACK 100
/* Keep async. jobs down to this number for all directories. */
@@ -376,9 +366,7 @@ async_job_start (NautilusDirectory *directory,
char *key;
#endif
-#ifdef DEBUG_START_STOP
- g_message ("starting %s in %p", job, directory->details->location);
-#endif
+ g_debug ("starting %s in %p", job, directory->details->location);
g_assert (async_job_count >= 0);
g_assert (async_job_count <= MAX_ASYNC_JOBS);
@@ -430,9 +418,7 @@ async_job_end (NautilusDirectory *directory,
gpointer table_key, value;
#endif
-#ifdef DEBUG_START_STOP
- g_message ("stopping %s in %p", job, directory->details->location);
-#endif
+ g_debug ("stopping %s in %p", job, directory->details->location);
g_assert (async_job_count > 0);
@@ -2296,9 +2282,7 @@ start_monitoring_file_list (NautilusDirectory *directory)
state->load_directory_file->details->loading_directory = TRUE;
-#ifdef DEBUG_LOAD_DIRECTORY
- g_message ("load_directory called to monitor file list of %p", directory->details->location);
-#endif
+ g_debug ("load_directory called to monitor file list of %p", directory->details->location);
directory->details->directory_load_in_progress = state;
@@ -2742,14 +2726,12 @@ directory_count_start (NautilusDirectory *directory,
directory->details->count_in_progress = state;
location = nautilus_file_get_location (file);
-#ifdef DEBUG_LOAD_DIRECTORY
+
{
- char *uri;
+ g_autofree char *uri = NULL;
uri = g_file_get_uri (location);
- g_message ("load_directory called to get shallow file count for %s", uri);
- g_free (uri);
+ g_debug ("load_directory called to get shallow file count for %s", uri);
}
-#endif
g_file_enumerate_children_async (location,
G_FILE_ATTRIBUTE_STANDARD_NAME ","
@@ -3021,9 +3003,7 @@ deep_count_load (DeepCountState *state,
{
state->deep_count_location = g_object_ref (location);
-#ifdef DEBUG_LOAD_DIRECTORY
- g_message ("load_directory called to get deep file count for %p", location);
-#endif
+ g_debug ("load_directory called to get deep file count for %p", location);
g_file_enumerate_children_async (state->deep_count_location,
G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
@@ -3410,14 +3390,12 @@ mime_list_start (NautilusDirectory *directory,
directory->details->mime_list_in_progress = state;
location = nautilus_file_get_location (file);
-#ifdef DEBUG_LOAD_DIRECTORY
+
{
- char *uri;
+ g_autofree char *uri = NULL;
uri = g_file_get_uri (location);
- g_message ("load_directory called to get MIME list of %s", uri);
- g_free (uri);
+ g_debug ("load_directory called to get MIME list of %s", uri);
}
-#endif
g_file_enumerate_children_async (location,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
diff --git a/src/nautilus-thumbnails.c b/src/nautilus-thumbnails.c
index 167ef539c..f6e2aeee3 100644
--- a/src/nautilus-thumbnails.c
+++ b/src/nautilus-thumbnails.c
@@ -44,11 +44,6 @@
#include "nautilus-file-private.h"
-/* turn this on to see messages about thumbnail creation */
-#if 0
-#define DEBUG_THUMBNAILS
-#endif
-
/* Should never be a reasonable actual mtime */
#define INVALID_MTIME 0
@@ -164,9 +159,8 @@ thumbnail_thread_starter_cb (gpointer data)
thumbnail_factory = get_thumbnail_factory ();
}
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Main Thread) Creating thumbnails thread\n");
-#endif
+ g_debug ("(Main Thread) Creating thumbnails thread\n");
+
/* We set a flag to indicate the thread is running, so we don't create
* a new one. We don't need to lock a mutex here, as the thumbnail
* thread isn't running yet. And we know we won't create the thread
@@ -187,9 +181,8 @@ nautilus_thumbnail_remove_from_queue (const char *file_uri)
{
GList *node;
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Remove from queue) Locking mutex\n");
-#endif
+ g_debug ("(Remove from queue) Locking mutex\n");
+
g_mutex_lock (&thumbnails_mutex);
/*********************************
@@ -212,9 +205,8 @@ nautilus_thumbnail_remove_from_queue (const char *file_uri)
* MUTEX UNLOCKED
*********************************/
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Remove from queue) Unlocking mutex\n");
-#endif
+ g_debug ("(Remove from queue) Unlocking mutex\n");
+
g_mutex_unlock (&thumbnails_mutex);
}
@@ -223,9 +215,8 @@ nautilus_thumbnail_prioritize (const char *file_uri)
{
GList *node;
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Prioritize) Locking mutex\n");
-#endif
+ g_debug ("(Prioritize) Locking mutex\n");
+
g_mutex_lock (&thumbnails_mutex);
/*********************************
@@ -247,9 +238,8 @@ nautilus_thumbnail_prioritize (const char *file_uri)
* MUTEX UNLOCKED
*********************************/
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Prioritize) Unlocking mutex\n");
-#endif
+ g_debug ("(Prioritize) Unlocking mutex\n");
+
g_mutex_unlock (&thumbnails_mutex);
}
@@ -269,9 +259,8 @@ thumbnail_thread_notify_file_changed (gpointer image_uri)
NautilusFile *file;
file = nautilus_file_get_by_uri ((char *) image_uri);
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Thumbnail Thread) Notifying file changed file:%p uri: %s\n", file, (char *) image_uri);
-#endif
+
+ g_debug ("(Thumbnail Thread) Notifying file changed file:%p uri: %s\n", file, (char *) image_uri);
if (file != NULL)
{
@@ -407,9 +396,8 @@ nautilus_create_thumbnail (NautilusFile *file)
info->original_file_mtime = file_mtime;
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Main Thread) Locking mutex\n");
-#endif
+ g_debug ("(Main Thread) Locking mutex\n");
+
g_mutex_lock (&thumbnails_mutex);
/*********************************
@@ -427,10 +415,8 @@ nautilus_create_thumbnail (NautilusFile *file)
if (existing == NULL)
{
/* Add the thumbnail to the list. */
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Main Thread) Adding thumbnail: %s\n",
+ g_debug ("(Main Thread) Adding thumbnail: %s\n",
info->image_uri);
-#endif
g_queue_push_tail ((GQueue *) &thumbnails_to_make, info);
node = g_queue_peek_tail_link ((GQueue *) &thumbnails_to_make);
g_hash_table_insert (thumbnails_to_make_hash,
@@ -448,10 +434,9 @@ nautilus_create_thumbnail (NautilusFile *file)
}
else
{
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Main Thread) Updating non-current mtime: %s\n",
+ g_debug ("(Main Thread) Updating non-current mtime: %s\n",
info->image_uri);
-#endif
+
/* The file in the queue might need a new original mtime */
existing_info = existing->data;
existing_info->original_file_mtime = info->original_file_mtime;
@@ -462,9 +447,8 @@ nautilus_create_thumbnail (NautilusFile *file)
* MUTEX UNLOCKED
*********************************/
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Main Thread) Unlocking mutex\n");
-#endif
+ g_debug ("(Main Thread) Unlocking mutex\n");
+
g_mutex_unlock (&thumbnails_mutex);
}
@@ -485,9 +469,8 @@ thumbnail_thread_func (GTask *task,
* we exit the thread. */
for (;; )
{
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Thumbnail Thread) Locking mutex\n");
-#endif
+ g_debug ("(Thumbnail Thread) Locking mutex\n");
+
g_mutex_lock (&thumbnails_mutex);
/*********************************
@@ -518,9 +501,8 @@ thumbnail_thread_func (GTask *task,
* exit the thread. */
if (g_queue_is_empty ((GQueue *) &thumbnails_to_make))
{
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Thumbnail Thread) Exiting\n");
-#endif
+ g_debug ("(Thumbnail Thread) Exiting\n");
+
thumbnail_thread_is_running = FALSE;
g_mutex_unlock (&thumbnails_mutex);
return;
@@ -536,9 +518,8 @@ thumbnail_thread_func (GTask *task,
* MUTEX UNLOCKED
*********************************/
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Thumbnail Thread) Unlocking mutex\n");
-#endif
+ g_debug ("(Thumbnail Thread) Unlocking mutex\n");
+
g_mutex_unlock (&thumbnails_mutex);
time (&current_time);
@@ -548,10 +529,9 @@ thumbnail_thread_func (GTask *task,
if (current_time < current_orig_mtime + THUMBNAIL_CREATION_DELAY_SECS &&
current_time >= current_orig_mtime)
{
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Thumbnail Thread) Skipping: %s\n",
+ g_debug ("(Thumbnail Thread) Skipping: %s\n",
info->image_uri);
-#endif
+
/* Reschedule thumbnailing via a change notification */
g_timeout_add_seconds (1, thumbnail_thread_notify_file_changed,
g_strdup (info->image_uri));
@@ -559,10 +539,8 @@ thumbnail_thread_func (GTask *task,
}
/* Create the thumbnail. */
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Thumbnail Thread) Creating thumbnail: %s\n",
+ g_debug ("(Thumbnail Thread) Creating thumbnail: %s\n",
info->image_uri);
-#endif
pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (thumbnail_factory,
info->image_uri,
@@ -570,10 +548,9 @@ thumbnail_thread_func (GTask *task,
if (pixbuf)
{
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Thumbnail Thread) Saving thumbnail: %s\n",
+ g_debug ("(Thumbnail Thread) Saving thumbnail: %s\n",
info->image_uri);
-#endif
+
gnome_desktop_thumbnail_factory_save_thumbnail (thumbnail_factory,
pixbuf,
info->image_uri,
@@ -582,10 +559,9 @@ thumbnail_thread_func (GTask *task,
}
else
{
-#ifdef DEBUG_THUMBNAILS
- g_message ("(Thumbnail Thread) Thumbnail failed: %s\n",
+ g_debug ("(Thumbnail Thread) Thumbnail failed: %s\n",
info->image_uri);
-#endif
+
gnome_desktop_thumbnail_factory_create_failed_thumbnail (thumbnail_factory,
info->image_uri,
current_orig_mtime);