[Webkit-unassigned] [Bug 96201] [EFL][WK2] WKEinaSharedString needs a function to adopt eina stringshare.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Sep 9 22:05:38 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=96201





--- Comment #6 from Simon Hausmann <hausmann at webkit.org>  2012-09-09 22:05:54 PST ---
(In reply to comment #4)
> (In reply to comment #2)
> > (From update of attachment 163001 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=163001&action=review
> > 
> > > Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h:73
> > > +WK_EXPORT WKEinaSharedString adoptEinaStringShare(const char* string);
> > 
> > Why not make it an overloaded constructor instead? WKEinaSharedString(AdoptTag, const char*) ? Seems more consistent with other adoption patterns in WebKit.
> 
> 
> Yes, I considered using WKAdoptTag initially, but that seems to be designed to adopt data from api object type (WKXXX) that is related with APIObject and Opaque types.
> (This seems to be a reason that the adopt tag name is 'AdoptWK' - adopting WK api object)
> 
> But the data that this function tries to adopt is not WK api object type, but eina stringshare which is provided by efl platform and has it's own ref, unref function - eina_stringshare_add, eina_stringshare_del)
> And Wrapper class for the eina stringshare is that WKEinaSharedString.
> So I decided not to use AdoptWK tag but add a function for adopt.
> (I referenced the adoptRef() function, and the function also defined as a friend function of PassRefPtr)
> 
> If there is any way that I can apply the adoption pattern with AdoptTag, please share it. It will be very helpful.

Don't worry, I doubt anybody is going to complain if you decide to use the pattern in a slightly different way in _your_ API :)

That said, it's completely up to you. This is a question of aesthetics, i.e. which approach you find more readable on the caller side and which approach creates a cleaner implementation.

You could also consider using a new tag, like AdoptCF and AdoptNS are used in WTF for the adoption of CoreFoundation and NextStep objects that follow the same reference counting pattern.

Anyway, just saying that it's up to you - whichever you like better.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list