[gnome-photos] base-item: Short-circuit loading if we already have the pipeline ready



commit e2a45a30370bb9f0219877b9513e832bb6751498
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Dec 15 15:45:29 2015 +0100

    base-item: Short-circuit loading if we already have the pipeline ready
    
    If we have the pipeline and buffers setup, then there is no need to
    repeat the same steps.

 src/photos-base-item.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 7eb74a2..d627f4c 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1740,6 +1740,7 @@ photos_base_item_load_async (PhotosBaseItem *self,
                              GAsyncReadyCallback callback,
                              gpointer user_data)
 {
+  PhotosBaseItemPrivate *priv = self->priv;
   GTask *task;
 
   g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
@@ -1747,7 +1748,21 @@ photos_base_item_load_async (PhotosBaseItem *self,
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_source_tag (task, photos_base_item_load_async);
 
-  photos_base_item_load_buffer_async (self, cancellable, photos_base_item_load_load_buffer, g_object_ref 
(task));
+  if (priv->pipeline != NULL)
+    {
+      GeglNode *graph;
+
+      graph = photos_pipeline_get_graph (priv->pipeline);
+      g_task_return_pointer (task, g_object_ref (graph), g_object_unref);
+    }
+  else
+    {
+      photos_base_item_load_buffer_async (self,
+                                          cancellable,
+                                          photos_base_item_load_load_buffer,
+                                          g_object_ref (task));
+    }
+
   g_object_unref (task);
 }
 


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