[Spice-devel] [PATCH 03/14] Introduce simple RedPipeItem class
Christophe Fergeau
cfergeau at redhat.com
Mon Apr 11 06:57:16 UTC 2016
On Fri, Apr 08, 2016 at 03:13:48PM -0500, Jonathon Jongsma wrote:
> On Thu, 2016-04-07 at 17:11 -0500, Jonathon Jongsma wrote:
> > From: Christophe Fergeau <cfergeau at redhat.com>
> >
> > This is similar to PipeItem (which is a type id + a RingItem linked list
> > member), except that it's refcounted. A user-defined callback is called
> > when the refcount drops to 0.
>
> It's not so much "like" a PipeItem -- it actually "contains" a PipeItem or
> "inherits" from PipeItem.
Ok, "This inherits from PipeItem and will act as a base class for
refcounted pipe items."
>
> > Refcounted is open coded for several classes deriving from PipeItem, so
>
> I'm unfamiliar with the term "open coded". Is that a reference to the fact that
> the ref/unref functions take a void* argument? If so, I'm not sure that I like
> that idea very much, though I do admit that it probably makes usage a bit more
> convenient...
I think there is some expression meaning that some code is duplicated
every time needed rather than being gathered in a single common place,
but I forgot what it is. Maybe it's 'open coded', maybe it's something
else. What I meant is that with this base class, the refcounting code
will be in a single place rather than being reimplemented in each
derived class. Which also means we have a generic
"red_pipe_item_{ref,unref}" which we can call on all the subclasses
regardless of their types rather than having to use
red_pipe_item_foo_ref, red_pipe_item_bar_ref, ...
>
> > this base class will help to share this code, and allow to remove some
> > ref/unref virtual functions in some interfaces when we can assume every
> > instance derives from this base class.
>
> A bit more information about why this class is useful and how it will be used in
> the future would be nice here (I'm sure it will become obvious as I look at
> future patches...)
I think the paragraphs above makes the intent clearer? Or does this need
more details?
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160411/6e9fe937/attachment.sig>
More information about the Spice-devel
mailing list