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>
This commit is contained in:
Georges Basile Stavracas Neto 2022-03-31 14:01:00 -03:00
parent 2c520f76b5
commit 631056bf49
3 changed files with 6 additions and 9 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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