[mutter] cogl/journal: Make CoglJournal a free-form struct



commit 631056bf496161d05c46b166197a8074649cd524
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Mar 31 14:01:00 2022 -0300

    cogl/journal: Make CoglJournal a free-form struct
    
    There is no need to make CoglJournal a CoglObject, nor any kind of
    object for that matter, since it doesn't require refcounting at all.
    CoglJournal is entirely private to, and managed by, CoglFramebuffer,
    and it only needs to create and destroy it.
    
    Make CoglJournal a free-form struct, and adjust CoglFramebuffer to
    call _cogl_journal_free() instead of cogl_object_unref().
    
    Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2087
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>

 cogl/cogl/cogl-framebuffer.c     | 2 +-
 cogl/cogl/cogl-journal-private.h | 5 +++--
 cogl/cogl/cogl-journal.c         | 8 ++------
 3 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c
index 6f24b2e427..d8ffbcd1ca 100644
--- a/cogl/cogl/cogl-framebuffer.c
+++ b/cogl/cogl/cogl-framebuffer.c
@@ -346,7 +346,7 @@ cogl_framebuffer_dispose (GObject *object)
   g_clear_pointer (&priv->clip_stack, _cogl_clip_stack_unref);
   cogl_clear_object (&priv->modelview_stack);
   cogl_clear_object (&priv->projection_stack);
-  cogl_clear_object (&priv->journal);
+  g_clear_pointer (&priv->journal, _cogl_journal_free);
 
   ctx->framebuffers = g_list_remove (ctx->framebuffers, framebuffer);
 
diff --git a/cogl/cogl/cogl-journal-private.h b/cogl/cogl/cogl-journal-private.h
index d38c3df1af..21214a6d0c 100644
--- a/cogl/cogl/cogl-journal-private.h
+++ b/cogl/cogl/cogl-journal-private.h
@@ -40,8 +40,6 @@
 
 typedef struct _CoglJournal
 {
-  CoglObject _parent;
-
   /* A pointer the framebuffer that is using this journal. This is
      only valid when the journal is not empty. It *does* take a
      reference on the framebuffer. Although this creates a circular
@@ -88,6 +86,9 @@ typedef struct _CoglJournalEntry
 CoglJournal *
 _cogl_journal_new (CoglFramebuffer *framebuffer);
 
+void
+_cogl_journal_free (CoglJournal *journal);
+
 void
 _cogl_journal_log_quad (CoglJournal  *journal,
                         const float  *position,
diff --git a/cogl/cogl/cogl-journal.c b/cogl/cogl/cogl-journal.c
index 26edb4ebf8..4ed508a7f6 100644
--- a/cogl/cogl/cogl-journal.c
+++ b/cogl/cogl/cogl-journal.c
@@ -122,11 +122,7 @@ typedef void (*CoglJournalBatchCallback) (CoglJournalEntry *start,
 typedef gboolean (*CoglJournalBatchTest) (CoglJournalEntry *entry0,
                                           CoglJournalEntry *entry1);
 
-static void _cogl_journal_free (CoglJournal *journal);
-
-COGL_OBJECT_INTERNAL_DEFINE (Journal, journal);
-
-static void
+void
 _cogl_journal_free (CoglJournal *journal)
 {
   int i;
@@ -154,7 +150,7 @@ _cogl_journal_new (CoglFramebuffer *framebuffer)
 
   _cogl_list_init (&journal->pending_fences);
 
-  return _cogl_journal_object_new (journal);
+  return journal;
 }
 
 static void


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