brasero r1244 - in trunk: . src



Author: philippr
Date: Thu Sep  4 16:05:15 2008
New Revision: 1244
URL: http://svn.gnome.org/viewvc/brasero?rev=1244&view=rev

Log:
	(Sometimes huge) speed gain when loading files by returning many at a
	time when they are pending

	* src/brasero-io.c (brasero_io_return_result_idle):


Modified:
   trunk/ChangeLog
   trunk/src/brasero-io.c

Modified: trunk/src/brasero-io.c
==============================================================================
--- trunk/src/brasero-io.c	(original)
+++ trunk/src/brasero-io.c	Thu Sep  4 16:05:15 2008
@@ -288,36 +288,41 @@
 	BraseroIOResultCallbackData *data;
 	BraseroIOJobResult *result;
 	BraseroIOPrivate *priv;
+	int i;
 
 	priv = BRASERO_IO_PRIVATE (self);
 
-	g_mutex_lock (priv->lock);
-
-	if (!priv->results) {
-		priv->results_id = 0;
-		g_mutex_unlock (priv->lock);
-		return FALSE;
-	}
+	/* Return several results at a time that can be a huge speed gain.
+	 * What should be the value that provides speed and responsiveness. */
+	for (i = 0; i < 25; i ++) {
+		g_mutex_lock (priv->lock);
 
-	result = priv->results->data;
-	priv->results = g_slist_remove (priv->results, result);
+		if (!priv->results) {
+			priv->results_id = 0;
+			g_mutex_unlock (priv->lock);
+			return FALSE;
+		}
 
-	g_mutex_unlock (priv->lock);
+		result = priv->results->data;
+		priv->results = g_slist_remove (priv->results, result);
 
-	data = result->callback_data;
-	if (result->uri || result->info || result->error)
-		result->base->callback (result->base->object,
-					result->error,
-					result->uri,
-					result->info,
-					data? data->callback_data:NULL);
+		g_mutex_unlock (priv->lock);
 
-	/* Else this is just to call destroy () for callback data */
-	brasero_io_unref_result_callback_data (data,
-					       result->base->object,
-					       result->base->destroy,
-					       FALSE);
-	brasero_io_job_result_free (result);
+		data = result->callback_data;
+		if (result->uri || result->info || result->error)
+			result->base->callback (result->base->object,
+						result->error,
+						result->uri,
+						result->info,
+						data? data->callback_data:NULL);
+
+		/* Else this is just to call destroy () for callback data */
+		brasero_io_unref_result_callback_data (data,
+						       result->base->object,
+						       result->base->destroy,
+						       FALSE);
+		brasero_io_job_result_free (result);
+	}
 	return TRUE;
 }
 



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